From c223a026f26fd02bf124e90d86397777c204928c Mon Sep 17 00:00:00 2001 From: Nikita Semenov Date: Mon, 25 Jul 2022 14:08:01 +0300 Subject: [PATCH] fix: custom alerts configuration for sui + version control changes --- TIUIElements/Sources/Alerts/Helpers/View+Helpers.swift | 5 +++-- TIUIElements/Sources/Alerts/Models/AlertAction.swift | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/TIUIElements/Sources/Alerts/Helpers/View+Helpers.swift b/TIUIElements/Sources/Alerts/Helpers/View+Helpers.swift index b7184e68..2327e244 100644 --- a/TIUIElements/Sources/Alerts/Helpers/View+Helpers.swift +++ b/TIUIElements/Sources/Alerts/Helpers/View+Helpers.swift @@ -40,10 +40,11 @@ public extension View { func alert(isPresented: Binding, on context: PresentationContext, - alertViewFactory: ResultClosure) -> some View { + alertDescriptor descriptor: AlertDescriptor, + alertViewFactory: Closure) -> some View { if isPresented.wrappedValue { - alertViewFactory().present(on: context) { + alertViewFactory(descriptor).present(on: context) { isPresented.wrappedValue = false } } diff --git a/TIUIElements/Sources/Alerts/Models/AlertAction.swift b/TIUIElements/Sources/Alerts/Models/AlertAction.swift index ce2a92a0..229d3f0a 100644 --- a/TIUIElements/Sources/Alerts/Models/AlertAction.swift +++ b/TIUIElements/Sources/Alerts/Models/AlertAction.swift @@ -24,7 +24,7 @@ import TISwiftUtils import UIKit // struct describe alert button information -public struct AlertAction: Identifiable { +public struct AlertAction { public let id = UUID() @@ -52,6 +52,11 @@ extension AlertAction: Equatable { } } +// MARK: - AlertAction + Identifiable + +@available(iOS 13, *) +extension AlertAction: Identifiable { } + // MARK: - AlertAction + Helpers extension AlertAction {