I seem to be misunderstanding something about access control modifiers in Swift. Here is my code from a playground:
class Something {
private (set) var name :String {
get { return "" }
set {}
}
}
var thing = Something();
thing.name = "";
My intuition and experience from other languages tells me that there should be a compiler error on the last line.
The book I'm learning from however states that private means the member being modified is only accessible from the same source file.
Am I safe to assume this scenario would generally be an error in most projects, and this is only because I'm running this code in a playground?
Is the statement that private members can only be accessed from the same source file totally accurate?