I am trying to use Use ternary operator on UIImage() method with a variable from UserDefaults in that way:
var authOn = UserDefaults.standard.value(forKey: "authON")
var menu: [MyModel] = [
MyModel(icon: UIImage(systemName: (authOn == nil) ? "lock.icloud" : "lock" )!,title: (authOn == nil) ? "Identifícate" : "Usuario Registrado"),
]
but compiler gives back:
Cannot use instance member 'authOn' within property initializer; property initializers run before 'self' is available