Swiftpack.co - artemch/AlertDSL as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by artemch.
artemch/AlertDSL 0.1.0
This is declarative DSL wrapper around UIAlertController based on @_functionBuilder for UIKit.
⭐️ 1
🕓 3 years ago
iOS
.package(url: "https://github.com/artemch/AlertDSL.git", from: "0.1.0")

AlertDSL

This is declarative DSL wrapper around UIAlertController based on @_functionBuilder for UIKit.

Installation

Support swift 5.1 and heigher, iOS 13+.

Swift Package Manager

.package(url: "https://github.com/artemch/AlertDSL.git", from: "0.1.0")

CocoaPods

pod 'AlertDSL', :git => "https://github.com/artemch/AlertDSL.git", :tag => '0.1.0'

Example

Alert example:

Alert {
    Title("Alert title")
    Message("Alert Message")
    Action(title: "Ok") { print("Ok action") }
    Action.cancel(title: "Cancel") { print("Cancel action") }
}.present(on: self)

Action sheet example:

ActionSheet {
    Title("Action Sheet title")
    Message("Action Sheet Message")
    Action(title: "Ok") { print("Ok action") }
    Action(title: "Destructive-1", style: .destructive) { print("Destructive-1 action") }
    Action.destructive(title: "Destructive-2") { print("Destructive-2 action") }
    Action.cancel(title: "Cancel") { print("Cancel action") }
}.present(on: self)

For interactive example look at the AlertDSL-Example project.

GitHub

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

Release Notes

3 years ago

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