It seems that there is not a private, or for that matter public, keyword in swift language. So it is possible at all to have a private property?
On a side note, Swift is very much similar to Typescript per my observation so far.
It seems that there is not a private, or for that matter public, keyword in swift language. So it is possible at all to have a private property?
On a side note, Swift is very much similar to Typescript per my observation so far.
Update:
As of Xcode 6 beta 4, Swift has Access Control - https://developer.apple.com/swift/blog/?id=5
Swift doesn't have access modifiers yet. But there are plans to add them in the future
There are also some workarounds mentioned in the above linked thread, like using nested classes:
import Foundation
class KSPoint {
/*!
* Inner class to hide the helper functions from codesense.
*/
class _KSPointInner {
class func distance(point p1 : KSPoint, toPoint p2 : KSPoint) -> Double {
return sqrt(pow(Double(p2.x - p1.x), 2) + pow(Double(p2.y - p1.y), 2))
}
}
var x : Int
var y : Int
init(x : Int = 0, y : Int = 0) {
self.x = x
self.y = y
}
func distance(point : KSPoint, toPoint : KSPoint) -> Double {
return _KSPointInner.distance(point: point, toPoint: toPoint)
}
}