Skip to content

Instantly share code, notes, and snippets.

@ayoub-9
Created January 19, 2019 14:36
Show Gist options
  • Save ayoub-9/3ff607eac81b62473c6e0a9c77ff8e37 to your computer and use it in GitHub Desktop.
Save ayoub-9/3ff607eac81b62473c6e0a9c77ff8e37 to your computer and use it in GitHub Desktop.
extension TextToSpeechVC1 {
func displayMsg(title : String?, msg : String,
style: UIAlertController.Style = .alert,
dontRemindKey : String? = nil) {
if dontRemindKey != nil,
UserDefaults.standard.bool(forKey: dontRemindKey!) == true {
return
}
let ac = UIAlertController.init(title: title,
message: msg, preferredStyle: style)
ac.addAction(UIAlertAction.init(title: "ذكرني",
style: .default, handler: nil))
if dontRemindKey != nil {
ac.addAction(UIAlertAction.init(title: "حسنا",
style: .default, handler: { (aa) in
UserDefaults.standard.set(true, forKey: dontRemindKey!)
UserDefaults.standard.synchronize()
}))
}
DispatchQueue.main.async {
self.present(ac, animated: true, completion: nil)
}
}
}
-----------------
call func
------------
self.displayMsg(title: "OK", msg: "FGHJKJHG", style: .alert, dontRemindKey: "UserHasSeenMsg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment