Recently Swift introduced the access modifiers. What about setting some stuff in my AppDelegate private
? I wanted some of the ivars be private, like window
, for example. But I can't do so, because compiler shows a warning that I'm "Declaring a public var for an internal class" and recommends a window property to be internal
.
Well, OK. I do so. But later on I still can access that variable and if I set:
let appDelegate = UIApplication.sharedApplication().delegate as AppDelegate
appDelegate.window = nil // <- Accessible
the app crashes of course. Is there a way to make the real protection for that kind of stuff?