I\'m trying to figure out something with the new Apple Swift language. Let\'s say I used to do something like the following in Objective-C. I have readonly
prop
Simply prefix the property declaration with private(set)
, like so:
public private(set) var hours: UInt = 0
public private(set) var minutes: UInt = 0
public private(set) var seconds: UInt = 0
private
keeps it local to a source file, while internal
keeps it local to the module/project.
private(set)
creates a read-only
property, while private
sets both, set
and get
to private.