LeadKit/TISwiftUICore
Ivan Smolin 18cd001ab9 feat: Base classes for encryption and decryption user token with pin code or biometry
Pin code validators
2022-12-19 16:32:44 +03:00
..
Sources docs: code review notes 2022-07-27 17:37:34 +03:00
README.md docs: code review notes 2022-07-27 17:37:34 +03:00
TISwiftUICore.podspec feat: Base classes for encryption and decryption user token with pin code or biometry 2022-12-19 16:32:44 +03:00

README.md

TISwiftUICore

Core UI elements: protocols, views and helpers.

SwiftUI alerts

SwiftUI views should conform to protocol SwiftUIAlertContext to present alerts.

This means that the view must implement the presentingViewController property. This controller is a context from which the alert will be shown.

// View that can present alerts.
struct ContentView: View, SwiftUIAlerContext {
    var presentingViewController: UIViewController

    var body: some View {
        // View realization.
    }
}

Alerts usage example

struct ContentView: View, SwiftUIAlertContext {

    private let factory = AlertFactory()

    @State private var alertDescription: AlertDescriptor
    @State private var isAlertPresented = false
    
    var presentingViewController: UIViewController

    var body: some View {
        Button("Show custom alert with binding property") {
                alertDescription = factory.okAlert(title: "Title", message: "Message")
                isAlertPresented = true
            }
        }
        .alert(isPresented: $isAlertPresented, on: self, alert: alertDescription)
    }
}

Installation via SPM

You can install this framework as a target of LeadKit.