I have a global stuct where I am keeping a few properties that are used throughout. Some of the properties need to be mutable.
Here's what I'm doing:
public struct AppGlobal {
static let someManager = PrayerManager()
static var currentUser = UserModel()
static var cache = UserCache()
// Prevent others from initializing singleton
private init() { }
}
This way, I can do AppGlobal.currentUser.prop1 = 5
. Is it still singleton and safe if I set those static properties to var
instead of let
?