Reputation: 399
I have an expression, I am unable to understand the line of code. So any one can you please explain deeply on this line of code.
public private(set) var items = [Int] ()
Here
public private(set) var items = [Int]()
Upvotes: 2
Views: 235
Reputation: 299345
This property has a public getter and a private setter.
See the Constants, Variables, Properties, and Subscripts section of Access Control in the Swift Programming Language for a full discussion of the syntax.
A quote from the document:
The structure’s members (including the numberOfEdits property) therefore have an internal access level by default. You can make the structure’s numberOfEdits property getter public, and its property setter private, by combining the public and private(set) access-level modifiers.
Upvotes: 3