Skip to content

Commit

Permalink
[Fix] #241- 취소버튼 네비게이션 관련 이슈
Browse files Browse the repository at this point in the history
  • Loading branch information
joonBaek12 committed Dec 12, 2024
1 parent 9ffc1be commit 0158198
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 6 additions & 1 deletion Smeem-iOS/Smeem-iOS/Global/Extensions/SwiftUI/View+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ extension View {
)

alert.addAction(UIAlertAction(title: firstActionTitle, style: .cancel) { _ in
firstActionHandler?()
// 현재 presenting view controller를 찾아서 dismiss
if let presentedViewController = UIApplication.shared.windows.first?.rootViewController?.presentedViewController {
presentedViewController.dismiss(animated: true) {
firstActionHandler?()
}
}
})

alert.addAction(UIAlertAction(title: secondActionTitle, style: .default) { _ in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ struct DetailDiaryCoachedView: View {
message: "수정시 모든 코칭 내용이 사라집니다. 그래도 수정하시겠습니까?",
firstActionTitle: "취소",
secondActionTitle: "확인",
firstActionHandler: {
dismiss()
},
firstActionHandler: { },
secondActionHandler: {
navigateToEditDiary()
}
Expand Down

0 comments on commit 0158198

Please sign in to comment.