In the docs in the first code example, under the heading "Getters and Setters", you can see that in order to have your own setter, the syntax is as follows:
private (set) var center: Point {...
Some clarifications: private
in Swift works a little differently - it restricts access to the property / method to the scope of the file. As long as there is more than one class in the file, they will be able to access all of their contents. In order for private
"work", you need to have your own coolness in separate files.
source share