I have a question related to my code:
func isNotificationsEnabled()->Bool{
var isNotificationEnabled = false
center.getNotificationSettings() { (settings) in
switch settings.soundSetting{
case .enabled:
isNotificationEnabled = true
break
case .disabled:
isNotificationEnabled = false
break
case .notSupported:
isNotificationEnabled = false
break
}
}
return isNotificationEnabled
}
This function return result before center.getNotificationSettings()
returns results. Is there any way to wait for result of center.getNotificationSettings()
and sync this function?