Created
January 19, 2019 14:36
-
-
Save ayoub-9/3ff607eac81b62473c6e0a9c77ff8e37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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