Show system alerts easily in SwiftUI
SwiftUIAlert.show(title: "Hello Word!", //Alert Title
message: "Lorem Ipsum", //Alert Message
preferredStyle: .alert, //Style (alert or action sheet)
actions: [UIAlertAction(title: "Done", //Action Title
style: .default, //Action Style (default, destructive, dismiss)
handler: {_ in}) //Handler for choosing that action
]
)
SwiftUIAlert.textfieldShow(title: "Test", //Alert Title
message: "Hello World!", //Alert Message
preferredStyle: .alert, //Style (alert or action sheet)
textfield: AlertTextfield(text: $text, //Textfield Text
placeholder: "", //Textfield Placeholder
clearButtonMode: .whileEditing, //When to show clear butt(always, whileEditing, unlessEditing, or never)
enablesReturnKeyAutomatically: true, //Show return key keyboard
disableAutocorrection: false, //Disable Autocorrection?
autocapitalization: .sentences, //Autocapitalization (nonsentances, allCharacter, or words)
keyboardType: .default, //The type of keyboard
returnKeyType: .default, //Type of return key on keyboard
isSecureTextEntry: .no, //Is Secure Textfield? (.yes(UITextInputPassordRules) or .no)
dismissKeyboardOnReturn: true), //Dismiss keyboard on return?
actions: [UIAlertAction(title: "Done", style: .default)]
)
Dismisses any alerts present
SwiftUIAlert.dismissAnyAlertControllerIfPresent()