1
1
//
2
- // AlertUtility .swift
2
+ // ESAlertUtility .swift
3
3
// EATSSUKit
4
4
//
5
5
// Created by JIWOONG CHOI on 1/31/25.
8
8
import UIKit
9
9
10
10
/// - Note: 앱 전반에서 재사용할 수 있는 알림창(팝업) 유틸리티 클래스입니다.
11
- public enum AlertUtility {
11
+ public enum ESAlertUtility {
12
12
// MARK: - Common Alert
13
13
14
14
/// - Note: 일반적인 알림 창을 생성하는 함수입니다.
15
- /// - Parameters:
16
- /// - title: 알림 제목
17
- /// - message: 알림 내용
18
- /// - confirmTitle: 확인 버튼 텍스트 (기본값: "확인")
19
- /// - viewController: 알림을 표시할 뷰 컨트롤러
20
15
public static func showAlert(
21
16
title: String ? ,
22
17
message: String ? ,
@@ -32,13 +27,6 @@ public enum AlertUtility {
32
27
// MARK: - Confirm Alert
33
28
34
29
/// - Note: 사용자의 확인이 필요한 알림 창을 생성하는 함수입니다.
35
- /// - Parameters:
36
- /// - title: 알림 제목
37
- /// - message: 알림 내용
38
- /// - confirmTitle: 확인 버튼 텍스트
39
- /// - cancelTitle: 취소 버튼 텍스트
40
- /// - viewController: 알림을 표시할 뷰 컨트롤러
41
- /// - confirmHandler: 확인 버튼을 눌렀을 때 실행할 클로저
42
30
public static func showConfirmAlert(
43
31
title: String ? ,
44
32
message: String ? ,
@@ -58,14 +46,26 @@ public enum AlertUtility {
58
46
viewController. present ( alert, animated: true , completion: nil )
59
47
}
60
48
49
+ /// - Note: 취소 버튼 없이 확인 버튼만 있는 알림 창을 생성하는 함수입니다.
50
+ public static func showConfirmOnlyAlert(
51
+ title: String ? ,
52
+ message: String ? ,
53
+ confirmTitle: String = " 확인 " ,
54
+ in viewController: UIViewController ,
55
+ confirmHandler: ( ( ) -> Void ) ? = nil
56
+ ) {
57
+ let alert = UIAlertController ( title: title, message: message, preferredStyle: . alert)
58
+ let confirmAction = UIAlertAction ( title: confirmTitle, style: . default) { _ in
59
+ confirmHandler ? ( )
60
+ }
61
+
62
+ alert. addAction ( confirmAction)
63
+ viewController. present ( alert, animated: true , completion: nil )
64
+ }
65
+
61
66
// MARK: - Action Sheet
62
67
63
68
/// - Note: 사용자에게 여러 선택지를 제공하는 액션 시트를 생성하는 함수입니다.
64
- /// - Parameters:
65
- /// - title: 액션 시트 제목
66
- /// - message: 설명 메시지
67
- /// - actions: 각 액션 시트 버튼의 제목과 핸들러를 배열로 전달
68
- /// - viewController: 액션 시트를 표시할 뷰 컨트롤러
69
69
public static func showActionSheet(
70
70
title: String ? ,
71
71
message: String ? ,
0 commit comments