Simple Syntactic sugar for UIAlertController with SwiftUI Style(chain)
- Just drag and drop the BiserAlert.swift file to your project
- Download Project (Green Button 'Code')
Alert(.alert)
.title("Title")
.message("Message")
.ok("OK", action: { _ in print("ok tapped") })
.cancel("Cancel")
.present()
Alert(.actionSheet)
.ok("Gallery", [.image(.SFSymbol("rectangle.stack.fill", size: 18)), .alignment(.left), .titleColor(.black), .imageColor(.systemBlue)])
.ok("Camera", [.image(.SFSymbol("bolt.fill", size: 20)), .alignment(.left), .titleColor(.black), .imageColor(.systemBlue)])
.ok("Document", [.image(.SFSymbol("doc.text.fill", size: 20)), .alignment(.left), .titleColor(.black), .imageColor(.systemBlue)])
.ok("Location", [.image(.SFSymbol("location.fill", size: 20)), .alignment(.left), .titleColor(.black), .imageColor(.systemBlue)])
.ok("Contact", [.image(.SFSymbol("person.fill", size: 22)), .alignment(.left), .titleColor(.black), .imageColor(.systemBlue)], action: { _ in
print("Contact Tapped")
})
.cancel("Cancel")
.present()
Alert(.alert)
.attributedMessage("Enter Password", textColor: .white, backgroundColor: .black, font: UIFont.systemFont(ofSize: 20, weight: .medium))
.textField {
$0.placeholder = "I wait..."
$0.textColor = .red
$0.isSecureTextEntry = true
}
.ok("OK", action: { _ in
print("ok tapped", AlertText)
})
.cancel("Cancel")
.bottomText("Bottom Text For Example", textColor: .black, backgroundColor: .clear)
.present()
Alert(.alert)
.title("Dismiss after 5 sec")
.ok("OK", [.alignment(.right)])
.ok("OK", [.alignment(.right)])
.ok("OK", [.alignment(.right)])
.ok("OK2", [.alignment(.left)])
.ok("OK2", [.alignment(.left)])
.ok("OK2", [.alignment(.left)])
.destructive("Kangi")
.cancel("Cancel")
.bottomText("Bottom Text For Example", textColor: .black, backgroundColor: .red)
.present()
.vibro(.warning)
.dissmiss(5)
Alert(.alert)
.title("Alert")
.message("With Image")
.ok("OK", [.image(.SFSymbol("heart.fill", size: 20))], action: { _ in
print("ok tapped")
})
.cancel("Cancel", [.image(.SFSymbol("suit.spade.fill", size: 20)),.titleColor(.red)])
.present()
In no way do I pretend to be a super-duper developer, here is just a collection of useful information for me and my friends, if it was useful to you too - its good
toxic seniors get out pls