This is an alert/sheet library for iOS and macOS, which internally use the native APIs as follows:
- iOS:
UIAlertController
of UIKit - macOS:
NSAlert
of AppKit
This wrapper supports async
/await
so you can write a sequential flow easier.
let selectedAction = await Confirmation.show(
title: "Title",
description: "Description",
actions: [
.default(title: "Default"),
.default(title: "Default (Preferred)", isPreferred: true),
.destructive(title: "Destructive"),
.cancel()
],
style: .alert()) // .alert() can also take UIViewController or NSWindow
switch selectedAction {
case .cancel:
print("Canceled")
case .destructive(title: let title, _):
print("\"\(title)\" has been selected.")
case .default(title: let title, _):
print("\"\(title)\" has been selected.")
case .none:
break
}
Open Example/
in Xcode for more details.