Skip to content

Commit 86b2468

Browse files
committed
✨ :: disappear toast 추가
1 parent 6af8b23 commit 86b2468

2 files changed

Lines changed: 238 additions & 7 deletions

File tree

PiCK_iOS_DesignSystem.xcodeproj/project.pbxproj

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 56;
6+
objectVersion = 55;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -37,7 +37,6 @@
3737
827E749D13F4EF3C7B4AB242 /* PiCKAcceptStudentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D501F5088C9FF549C2DD1C /* PiCKAcceptStudentCell.swift */; };
3838
9CC41982615A34D2279D19F9 /* PiCKErrorToast+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 348FD0EDA18DE92847676F8B /* PiCKErrorToast+Preview.swift */; };
3939
9CEEE4B7C57A6B604EE3D2E2 /* Color.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D8CDC4CA69F1C02E7235E821 /* Color.xcassets */; };
40-
9FF67F8302CBC29A3CE8BAC6 /* SinglePickerBottomSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F800712A74F421BBA33138 /* SinglePickerBottomSheet.swift */; };
4140
A1E743C2F99CC19D97A19ABF /* PiCKMainNavigationBar+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F6741B659A5276D9D07086 /* PiCKMainNavigationBar+Preview.swift */; };
4241
A2BDA76D03B8ED93E0F9651D /* DualPickerBottomSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B87171DC2D1E895084524C3 /* DualPickerBottomSheet.swift */; };
4342
AB7A88D14E2D3D1C0196D580 /* Pretendard-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 24DACE845FA1F776B2244928 /* Pretendard-SemiBold.ttf */; };
@@ -46,10 +45,12 @@
4645
C0585190182B702E48966F26 /* PiCKUnderlineButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D4DFEF0DD910FF025770D7 /* PiCKUnderlineButton.swift */; };
4746
C6BE8B62F57505C36C39EC38 /* PiCKPopUpType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E89E34D12038683DEE6F2C3 /* PiCKPopUpType.swift */; };
4847
C7B8B9A7935752CD68E5D36A /* UIColorToColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77556DAFB97006109A5B7C26 /* UIColorToColor.swift */; };
48+
D3DBAD66E1BE95E05CAAB72F /* PiCKDisappearToast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5901745C5CCA5F44C2B557ED /* PiCKDisappearToast.swift */; };
4949
E4FA20A311423305E9610294 /* PiCKClassroomMoveCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF198448491F4ACB5FC4A7F9 /* PiCKClassroomMoveCell.swift */; };
5050
E9D2DB942793A0A226861A1A /* Image.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FC6AE0123CB72CDBDC9D2BBD /* Image.xcassets */; };
5151
F2E948E45DB898A5BC61FBC0 /* PiCKCalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D34F529E801A82F6B0D9A8 /* PiCKCalendarView.swift */; };
5252
F772977DB97B4B06692529EC /* Gray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEC9909F6D26CEA5327C361 /* Gray.swift */; };
53+
F784CAF4C445A305D0AF3BAD /* SinglePickerBottomSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0481DA8931E1BD22B059DCAC /* SinglePickerBottomSheet.swift */; };
5354
F79F9AFF4900DCFA03561359 /* Primary.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBE4FC96965FC627E121355F /* Primary.swift */; };
5455
/* End PBXBuildFile section */
5556

@@ -87,6 +88,7 @@
8788
/* End PBXCopyFilesBuildPhase section */
8889

8990
/* Begin PBXFileReference section */
91+
0481DA8931E1BD22B059DCAC /* SinglePickerBottomSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SinglePickerBottomSheet.swift; sourceTree = "<group>"; };
9092
0CC98A3EDB4DC537684DC45F /* PiCK_iOS_DesignSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiCK_iOS_DesignSystem.swift; sourceTree = "<group>"; };
9193
0D2A851258A6AFE596A3DE67 /* PiCKTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiCKTextField.swift; sourceTree = "<group>"; };
9294
1751CEC8F8560B3D9DC669A6 /* ColorPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPreview.swift; sourceTree = "<group>"; };
@@ -102,12 +104,12 @@
102104
3965469248AAED0FC9297BCC /* BackGround.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackGround.swift; sourceTree = "<group>"; };
103105
3EEC9909F6D26CEA5327C361 /* Gray.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Gray.swift; sourceTree = "<group>"; };
104106
52BA8B10810A90A7A52E0B01 /* PiCKFontType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiCKFontType.swift; sourceTree = "<group>"; };
107+
5901745C5CCA5F44C2B557ED /* PiCKDisappearToast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiCKDisappearToast.swift; sourceTree = "<group>"; };
105108
597D9BAAB6950B7986DB9E3B /* PiCKUnderlineButton+Preview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PiCKUnderlineButton+Preview.swift"; sourceTree = "<group>"; };
106109
5B87171DC2D1E895084524C3 /* DualPickerBottomSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DualPickerBottomSheet.swift; sourceTree = "<group>"; };
107110
5E4D77599BF10E2EE23C8007 /* whiteLottie.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = whiteLottie.json; sourceTree = "<group>"; };
108111
646B665074856865A3026E0A /* PiCKTextPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiCKTextPreview.swift; sourceTree = "<group>"; };
109112
7224757AF16734C973938741 /* Pretendard-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Regular.ttf"; sourceTree = "<group>"; };
110-
74F800712A74F421BBA33138 /* SinglePickerBottomSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SinglePickerBottomSheet.swift; sourceTree = "<group>"; };
111113
77556DAFB97006109A5B7C26 /* UIColorToColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColorToColor.swift; sourceTree = "<group>"; };
112114
78C91BFEEE480B525BD396F3 /* PiCKTextField+Preview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PiCKTextField+Preview.swift"; sourceTree = "<group>"; };
113115
816E88F5E8BA403D9F18A646 /* PiCKConfirmPopUp+Preview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PiCKConfirmPopUp+Preview.swift"; sourceTree = "<group>"; };
@@ -226,6 +228,14 @@
226228
path = TextField;
227229
sourceTree = "<group>";
228230
};
231+
483C4538160D48FF01186063 /* Disappear */ = {
232+
isa = PBXGroup;
233+
children = (
234+
5901745C5CCA5F44C2B557ED /* PiCKDisappearToast.swift */,
235+
);
236+
path = Disappear;
237+
sourceTree = "<group>";
238+
};
229239
48A967BDAF55663F4FC852A3 /* Underline */ = {
230240
isa = PBXGroup;
231241
children = (
@@ -343,7 +353,7 @@
343353
isa = PBXGroup;
344354
children = (
345355
F5B3D9C28830655F6CA558EA /* Preview */,
346-
74F800712A74F421BBA33138 /* SinglePickerBottomSheet.swift */,
356+
0481DA8931E1BD22B059DCAC /* SinglePickerBottomSheet.swift */,
347357
);
348358
path = Apply;
349359
sourceTree = "<group>";
@@ -429,6 +439,7 @@
429439
B0283F358BD667E3A7DBC2BE /* Toast */ = {
430440
isa = PBXGroup;
431441
children = (
442+
483C4538160D48FF01186063 /* Disappear */,
432443
7AF6C226DF02BCBFDE7B5192 /* Error */,
433444
);
434445
path = Toast;
@@ -595,6 +606,8 @@
595606
isa = PBXProject;
596607
attributes = {
597608
BuildIndependentTargetsInParallel = YES;
609+
TargetAttributes = {
610+
};
598611
};
599612
buildConfigurationList = 0A875DE57D3C1282D99989CE /* Build configuration list for PBXProject "PiCK_iOS_DesignSystem" */;
600613
compatibilityVersion = "Xcode 14.0";
@@ -647,8 +660,8 @@
647660
files = (
648661
1C26A1FE416D2FC1FA2785ED /* TuistBundle+PiCKIOSDesignSystem.swift in Sources */,
649662
35F000A03F72D11C40AF3A69 /* PiCK_iOS_DesignSystem.swift in Sources */,
650-
9FF67F8302CBC29A3CE8BAC6 /* SinglePickerBottomSheet.swift in Sources */,
651663
4F8645107A0CDBB5585B9AD2 /* ApplyBottomSheet+Preview.swift in Sources */,
664+
F784CAF4C445A305D0AF3BAD /* SinglePickerBottomSheet.swift in Sources */,
652665
A2BDA76D03B8ED93E0F9651D /* DualPickerBottomSheet.swift in Sources */,
653666
6CD9D399D42C0C7FBA6806A6 /* DualPickerBottomSheet+Preview.swift in Sources */,
654667
2CA9BB2F0B8B5AD5C3027178 /* PiCKButton.swift in Sources */,
@@ -676,6 +689,7 @@
676689
0C459461DE9178F0C3FB338E /* PiCKTextField.swift in Sources */,
677690
39E0A0FE1A241D6D83AA0147 /* LoginView_Preview.swift in Sources */,
678691
4565020158941124CA12390F /* PiCKTextField+Preview.swift in Sources */,
692+
D3DBAD66E1BE95E05CAAB72F /* PiCKDisappearToast.swift in Sources */,
679693
76C0BEC457591C408334E79B /* PiCKErrorToast.swift in Sources */,
680694
9CC41982615A34D2279D19F9 /* PiCKErrorToast+Preview.swift in Sources */,
681695
7A4EB7FE1803A1AC9EAAD873 /* PiCKFontType.swift in Sources */,
@@ -797,7 +811,10 @@
797811
SUPPORTS_MACCATALYST = YES;
798812
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
799813
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
800-
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
814+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = (
815+
"$(inherited)",
816+
DEBUG,
817+
);
801818
SWIFT_COMPILATION_MODE = singlefile;
802819
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
803820
SWIFT_VERSION = 5.0;
@@ -968,7 +985,10 @@
968985
SUPPORTS_MACCATALYST = YES;
969986
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
970987
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
971-
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE DEBUG";
988+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = (
989+
"$(inherited) SWIFT_PACKAGE",
990+
DEBUG,
991+
);
972992
SWIFT_COMPILATION_MODE = singlefile;
973993
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
974994
SWIFT_SUPPRESS_WARNINGS = YES;
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
import SwiftUI
2+
3+
4+
public struct PiCKDisappearAlert: View {
5+
@Environment(\.dismiss) private var dismiss
6+
@State private var isVisible = false
7+
8+
private let successType: SuccessType
9+
private let message: String
10+
11+
public init(
12+
successType: SuccessType,
13+
message: String
14+
) {
15+
self.successType = successType
16+
self.message = message
17+
}
18+
19+
public var body: some View {
20+
VStack {
21+
Spacer()
22+
23+
HStack(spacing: 12) {
24+
imageView
25+
.foregroundColor(imageColor)
26+
27+
Text(message)
28+
.pickText(type: .body1, textColor: .Normal.black)
29+
}
30+
.padding(.horizontal, 16)
31+
.frame(height: 48)
32+
.background(Color.Gray.gray50)
33+
.cornerRadius(24)
34+
.padding(.bottom, 86)
35+
.opacity(isVisible ? 1 : 0)
36+
.transition(.opacity)
37+
}
38+
.frame(maxWidth: .infinity, maxHeight: .infinity)
39+
.background(Color.clear)
40+
.onAppear {
41+
withAnimation(.easeOut(duration: 0.3)) {
42+
isVisible = true
43+
}
44+
45+
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
46+
withAnimation(.easeIn(duration: 0.3)) {
47+
isVisible = false
48+
}
49+
50+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
51+
dismiss()
52+
}
53+
}
54+
}
55+
}
56+
57+
private var imageView: Image {
58+
switch successType {
59+
case .success, .already:
60+
return PiCKImage.check
61+
case .fail:
62+
return PiCKImage.fail
63+
}
64+
}
65+
66+
private var imageColor: Color {
67+
switch successType {
68+
case .success, .already:
69+
return .Primary.primary500
70+
case .fail:
71+
return .Error.error
72+
}
73+
}
74+
}
75+
76+
public enum SuccessType {
77+
case success
78+
case fail
79+
case already
80+
}
81+
82+
#Preview("Interactive Test") {
83+
TestDisappearAlertPreview()
84+
}
85+
86+
struct TestDisappearAlertPreview: View {
87+
@State private var show = false
88+
89+
var body: some View {
90+
ZStack {
91+
Color.white.ignoresSafeArea()
92+
93+
Button("토스트 띄우기") {
94+
show = true
95+
}
96+
.padding()
97+
.background(Color.blue.opacity(0.8))
98+
.foregroundColor(.white)
99+
.cornerRadius(12)
100+
}
101+
.fullScreenCover(isPresented: $show) {
102+
PiCKDisappearAlert(
103+
successType: .success,
104+
message: "테스트 토스트입니다!"
105+
)
106+
.background(BackgroundClearView())
107+
}
108+
}
109+
}
110+
111+
struct InteractivePreview: View {
112+
@State private var showAlert = false
113+
@State private var selectedType: SuccessType = .success
114+
@State private var selectedMessage = "외출 신청 수락이 완료되었습니다!"
115+
116+
var body: some View {
117+
ZStack {
118+
Color.white.ignoresSafeArea()
119+
120+
VStack(spacing: 30) {
121+
Text("PiCK Disappear Alert")
122+
.font(.title)
123+
.bold()
124+
125+
// Type Picker
126+
VStack(alignment: .leading, spacing: 10) {
127+
Text("Success Type")
128+
.font(.headline)
129+
130+
Picker("Type", selection: $selectedType) {
131+
Text("Success").tag(SuccessType.success)
132+
Text("Fail").tag(SuccessType.fail)
133+
Text("Already").tag(SuccessType.already)
134+
}
135+
.pickerStyle(.segmented)
136+
}
137+
.padding(.horizontal)
138+
139+
// Message Picker
140+
VStack(alignment: .leading, spacing: 10) {
141+
Text("Message")
142+
.font(.headline)
143+
144+
Menu {
145+
Button("외출 신청 수락이 완료되었습니다!") {
146+
selectedMessage = "외출 신청 수락이 완료되었습니다!"
147+
}
148+
Button("교실 이동 거절이 완료되었습니다!") {
149+
selectedMessage = "교실 이동 거절이 완료되었습니다!"
150+
}
151+
Button("복귀가 완료되었습니다!") {
152+
selectedMessage = "복귀가 완료되었습니다!"
153+
}
154+
Button("1-1의 출석 상태가 저장되었습니다.") {
155+
selectedMessage = "1-1의 출석 상태가 저장되었습니다."
156+
}
157+
Button("버그 제보를 실패했습니다.") {
158+
selectedMessage = "버그 제보를 실패했습니다."
159+
}
160+
} label: {
161+
HStack {
162+
Text(selectedMessage)
163+
.lineLimit(1)
164+
Spacer()
165+
Image(systemName: "chevron.down")
166+
}
167+
.padding()
168+
.background(Color.gray.opacity(0.1))
169+
.cornerRadius(8)
170+
}
171+
}
172+
.padding(.horizontal)
173+
174+
Button(action: {
175+
showAlert = true
176+
}) {
177+
Text("Show Alert")
178+
.font(.headline)
179+
.foregroundColor(.white)
180+
.frame(maxWidth: .infinity)
181+
.padding()
182+
.background(Color.blue)
183+
.cornerRadius(12)
184+
}
185+
.padding(.horizontal)
186+
187+
Spacer()
188+
}
189+
.padding(.top, 50)
190+
}
191+
.fullScreenCover(isPresented: $showAlert) {
192+
PiCKDisappearAlert(
193+
successType: selectedType,
194+
message: selectedMessage
195+
)
196+
.background(BackgroundClearView())
197+
}
198+
}
199+
}
200+
201+
struct BackgroundClearView: UIViewRepresentable {
202+
func makeUIView(context: Context) -> UIView {
203+
let view = UIView()
204+
DispatchQueue.main.async {
205+
view.superview?.superview?.backgroundColor = .clear
206+
}
207+
return view
208+
}
209+
210+
func updateUIView(_ uiView: UIView, context: Context) {}
211+
}

0 commit comments

Comments
 (0)