Skip to content

Commit de7c8a1

Browse files
committed
Правка для Xcode 15
1 parent 4d888ae commit de7c8a1

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

SwiftUI-WorkoutApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@
879879
CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES;
880880
CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES;
881881
CODE_SIGN_STYLE = Automatic;
882-
CURRENT_PROJECT_VERSION = 6;
882+
CURRENT_PROJECT_VERSION = 7;
883883
DEVELOPMENT_ASSET_PATHS = "SwiftUI-WorkoutApp/Preview\\ Content/PreviewContent.swift SwiftUI-WorkoutApp/Preview\\ Content";
884884
DEVELOPMENT_TEAM = CR68PP2Z3F;
885885
ENABLE_PREVIEWS = YES;
@@ -932,7 +932,7 @@
932932
CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES;
933933
CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES;
934934
CODE_SIGN_STYLE = Automatic;
935-
CURRENT_PROJECT_VERSION = 6;
935+
CURRENT_PROJECT_VERSION = 7;
936936
DEVELOPMENT_ASSET_PATHS = "SwiftUI-WorkoutApp/Preview\\ Content/PreviewContent.swift SwiftUI-WorkoutApp/Preview\\ Content";
937937
DEVELOPMENT_TEAM = CR68PP2Z3F;
938938
ENABLE_PREVIEWS = YES;

SwiftUI-WorkoutApp/Libraries/SWUtils/Sources/SWUtils/SWAlert.swift

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import SwiftUI
22
import UIKit
33

4-
@MainActor
54
public final class SWAlert {
65
public static let shared = SWAlert()
76
private var currentAlert: UIViewController?
@@ -13,25 +12,27 @@ public final class SWAlert {
1312
/// - message: Текст сообщения
1413
/// - closeButtonTitle: Заголовок кнопки для закрытия алерта
1514
/// - closeButtonStyle: Стиль кнопки для закрытия алерта
16-
public func presentDefaultUIKit(
15+
public nonisolated func presentDefaultUIKit(
1716
title: String? = "",
1817
message: String,
1918
closeButtonTitle: String = "Ok",
2019
closeButtonStyle: UIAlertAction.Style = .default
2120
) {
22-
guard currentAlert == nil, let topMostViewController else { return }
23-
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
24-
alert.addAction(
25-
.init(
26-
title: closeButtonTitle,
27-
style: closeButtonStyle,
28-
handler: { [weak self] _ in
29-
self?.dismiss()
30-
}
21+
Task { @MainActor in
22+
guard currentAlert == nil, let topMostViewController else { return }
23+
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
24+
alert.addAction(
25+
.init(
26+
title: closeButtonTitle,
27+
style: closeButtonStyle,
28+
handler: { [weak self] _ in
29+
self?.dismiss()
30+
}
31+
)
3132
)
32-
)
33-
currentAlert = alert
34-
topMostViewController.present(alert, animated: true)
33+
currentAlert = alert
34+
topMostViewController.present(alert, animated: true)
35+
}
3536
}
3637

3738
/// Показывает стандартный алерт с сообщение об ошибке
@@ -52,7 +53,7 @@ public final class SWAlert {
5253
/// - Parameter isConnected: Состояние подключения к сети
5354
/// - Returns: `true` - нужно показать алерт (нет сети), `false` - алерт не нужен (сеть есть)
5455
@discardableResult
55-
public func presentNoConnection(_ isConnected: Bool) -> Bool {
56+
public nonisolated func presentNoConnection(_ isConnected: Bool) -> Bool {
5657
let showAlert = !isConnected
5758
if showAlert {
5859
presentDefaultUIKit(

0 commit comments

Comments
 (0)