|
|
||
|---|---|---|
| .. | ||
| Sources | ||
| README.md | ||
| TIUIKitCore.podspec | ||
README.md
TIUIKitCore
Core UI elements: protocols, views and helpers.
Protocols
- InitializableView - protocol with methods that should be called in constructor methods of view.
- Animatable - protocol that ensures that specific type support basic animation actions.
- ActivityIndicator - basic activity indicator.
- ActivityIndicatorHolder - placeholder view, containing activity indicator.
- AlertLocalizationProvider - protocol that ensures that localization for alerts will be provided.
- AlertPresentable - protocol indicates that certain object can present alerts.
- AlertPresentationContext - protocol indicates that certain object can present alert on top of itself.
- UIKitAlertContext - helper to provide easy conformance of
UIViewControllertoAlertPresentationContext.
Models
- DefaultAlertLocalizationProvider - default localization provider for alerts.
- AlertAction - representation of alert action
- AlertDescriptor - struct that holds all needed information to present alert
Factories
- AlertsFactory - factory to present alerts.
AlertsFactory
Use to present alerts in a few lines of code. Can be used for UIKit and SwiftUI
You can initialize
AlertsFactorywith your own LocalizationProvider or useDefaultAlertLocalizationProvider
Your view or view controller must implement PresentationContext protocol
There are UIKitAlertContext protocol that are designed to make it easier to work with AlertPresentationContext protocol. By default, no changes need to be made for UIKit view controllers to make them conform to UIKitAlertContext.
Custom alerts
// Presents alert
func presentAlert() {
factory
.alert(title: "Alert's title",
message: "Alert's message",
tint: .systemBlue,
actions: [
AlertAction(title: "Ok", style: .default, action: nil),
AlertAction(title: "Cancel", style: .cancel, action: nil)
])
.present(on: self)
}
// Presents sheet alert
func presentSheetAlert() {
factory
.sheetAlert(title: "Alert's title",
message: "Alert's message",
tint: .systemBlue,
actions: [
AlertAction(title: "Ok", style: .default, action: nil),
AlertAction(title: "Cancel", style: .cancel, action: nil)
])
.present(on: self)
}
Default alerts
// Ok alert
func presentOkAlert() {
factory
.okAlert(title: "Title", message: "Message")
.present(on: self)
}
// Retry alert
func presentRetryAlert() {
factory
.retryAlert(title: "Title", message: "Message") { [weak self] in
self?.presentOkAlert()
}
.present(on: self)
}
// Dialogue alert
func presentDialogueAlert() {
factory
.dialogueAlert(title: "Title", message: "Message")
.present(on: self)
}
Installation via SPM
You can install this framework as a target of LeadKit.