Skip to content

Instantly share code, notes, and snippets.

@waseem-pk
Created November 23, 2021 10:21
Show Gist options
  • Save waseem-pk/f0934bf84e46f2c15c9581b5057d1459 to your computer and use it in GitHub Desktop.
Save waseem-pk/f0934bf84e46f2c15c9581b5057d1459 to your computer and use it in GitHub Desktop.
Alert Extension for SwiftUi, iOS
public struct TextAlert {
public var title: String
public var placeholder: String = ""
public var accept: String = "OK"
public var cancel: String = "Cancel"
public var action: (String?) -> ()
}
extension View {
public func alert(isPresented: Binding<Bool>, _ alert: TextAlert) -> some View {
AlertWrapper(isPresented: isPresented, alert: alert, content: self)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment