Swiftpack.co - elegantchaos/SimpleAlert as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by elegantchaos.
elegantchaos/SimpleAlert v2.0.2
Simplified SwiftUI Alert
⭐️ 0
🕓 1 year ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/elegantchaos/SimpleAlert.git", from: "v2.0.2")

SimpleAlert

SimpleAlert implements a simple way to put up a parameterised Alert in SwiftUI.

Works with SwiftUI 3 / iOS 15.0.

Usage


import SimpleInput

struct MyView: View {
    @State var input: SimpleInput?

    var body: some View {
        VStack {
            Text("Some stuff")
            Button(action: handleShowAlert) {
                Text("Show It")
            }
            .simpleAlert($alert)
        }
    }
    
    func handleShowAlert() {
        alert = SimpleAlert(
            title: "Hello",
            verbatim: "This is a simple alert",
            buttons: [
                .normal("Option A", { /* do stuff */ }),
                .normal("Option B", { /* do stuff */ }),
                .cancel
            ])
    }
}

GitHub

link
Stars: 0
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

2.0.2
1 year ago

Added a verbatim variant of the initialiser which lets you pass in a pre-localized message string.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics