diff --git a/Nav.xcodeproj/project.pbxproj b/Nav.xcodeproj/project.pbxproj index dcecd29..bffab1b 100644 --- a/Nav.xcodeproj/project.pbxproj +++ b/Nav.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 11756B8F2A1FC5D000FC8C43 /* SettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11756B8E2A1FC5D000FC8C43 /* SettingView.swift */; }; + 11A6F3992A31BFD600E36EBD /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11A6F3982A31BFD600E36EBD /* Common.swift */; }; 262C17BE290CDF6900450E54 /* PinCreationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 262C17BD290CDF6900450E54 /* PinCreationView.swift */; }; 262C17C0290D06F700450E54 /* Color+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 262C17BF290D06F700450E54 /* Color+.swift */; }; 262C17C2290D090C00450E54 /* Font+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 262C17C1290D090C00450E54 /* Font+.swift */; }; @@ -27,6 +29,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 11756B8E2A1FC5D000FC8C43 /* SettingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingView.swift; sourceTree = ""; }; + 11A6F3982A31BFD600E36EBD /* Common.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Common.swift; sourceTree = ""; }; 262C17BD290CDF6900450E54 /* PinCreationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinCreationView.swift; sourceTree = ""; }; 262C17BF290D06F700450E54 /* Color+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+.swift"; sourceTree = ""; }; 262C17C1290D090C00450E54 /* Font+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Font+.swift"; sourceTree = ""; }; @@ -58,6 +62,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 11A6F3972A31BFC300E36EBD /* Common */ = { + isa = PBXGroup; + children = ( + 11A6F3982A31BFD600E36EBD /* Common.swift */, + ); + path = Common; + sourceTree = ""; + }; 26A14FFE29083A1300BC7355 = { isa = PBXGroup; children = ( @@ -79,6 +91,7 @@ children = ( 26A1500A29083A1300BC7355 /* NavApp.swift */, 26A1500C29083A1300BC7355 /* ContentView.swift */, + 11A6F3972A31BFC300E36EBD /* Common */, 26FE54E62949B90100B4E0E9 /* Data */, FD3389112917993300C4AB98 /* Extension */, FD3389102917992800C4AB98 /* Model */, @@ -126,6 +139,7 @@ 262C17BD290CDF6900450E54 /* PinCreationView.swift */, FD3389192917B81E00C4AB98 /* ListView.swift */, DCE7EBD02A172C9000644745 /* SearchBar.swift */, + 11756B8E2A1FC5D000FC8C43 /* SettingView.swift */, ); path = View; sourceTree = ""; @@ -146,14 +160,6 @@ path = Extension; sourceTree = ""; }; - 26FE54E62949B90100B4E0E9 /* Data */ = { - isa = PBXGroup; - children = ( - FDFD7A642928993A001BE945 /* MockData.json */, - ); - path = Data; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -224,11 +230,13 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 11A6F3992A31BFD600E36EBD /* Common.swift in Sources */, CE2D8D3829C59D5F00E5C104 /* ImagePicker.swift in Sources */, 26A1500D29083A1300BC7355 /* ContentView.swift in Sources */, 262C17C2290D090C00450E54 /* Font+.swift in Sources */, 262C17C6290E385E00450E54 /* Text+.swift in Sources */, 262C17C0290D06F700450E54 /* Color+.swift in Sources */, + 11756B8F2A1FC5D000FC8C43 /* SettingView.swift in Sources */, FDFD7A6129289926001BE945 /* Bundle+Ext.swift in Sources */, 262C17CE290E9D4500450E54 /* Image+.swift in Sources */, 26A1501929083B7B00BC7355 /* MapView.swift in Sources */, diff --git a/Nav/Common/Common.swift b/Nav/Common/Common.swift new file mode 100644 index 0000000..143c4f8 --- /dev/null +++ b/Nav/Common/Common.swift @@ -0,0 +1,22 @@ +// +// Common.swift +// Nav +// +// Created by Seulki Lee on 2023/06/08. +// + +import Foundation +import SwiftUI + +class AlertManager: ObservableObject { + + func showAlert(title: String, message: String) -> Alert { + let alert = Alert(title: Text(title), message: Text(message), dismissButton: .default(Text("확인"))) + return alert + } + + func showResetAlert(title: String, message: String, resetAction: @escaping () -> Void) -> Alert { + let alert = Alert(title: Text(title), message: Text(message), primaryButton: .destructive(Text("확인"), action: resetAction), secondaryButton: .cancel(Text("취소"))) + return alert + } +} diff --git a/Nav/ContentView.swift b/Nav/ContentView.swift index e85df69..93aa74c 100644 --- a/Nav/ContentView.swift +++ b/Nav/ContentView.swift @@ -20,9 +20,9 @@ struct ContentView: View { Image(systemName: "list.bullet") } - PinCreationView() + SettingView() .tabItem { - Image(systemName: "plus") + Image(systemName: "gearshape") } } } diff --git a/Nav/View/SettingView.swift b/Nav/View/SettingView.swift new file mode 100644 index 0000000..65f687c --- /dev/null +++ b/Nav/View/SettingView.swift @@ -0,0 +1,66 @@ +// +// Setting.swift +// Nav +// +// Created by Seulki Lee on 2023/04/21. +// + +import SwiftUI + +struct SettingView: View { + @StateObject private var alertManager = AlertManager() + @State private var isApiModalPresented = false + @State private var isVersionAlert = false + @State private var isResetAlert = false + + var body: some View { + NavigationView { + Form{ + Section { + SettingButton(title: "오픈 API") { + self.isApiModalPresented = true + } + .sheet(isPresented: $isApiModalPresented) { + // 오픈 API 모달 뷰 구현 + Text("오픈 API 모달 팝업") + } + + SettingButton(title: "버전 정보") { + self.isVersionAlert = true + } + .alert(isPresented: $isVersionAlert) { + alertManager.showAlert(title: "버전정보", message: "현재 버전: v1.0") + } + + SettingButton(title: "초기화") { + self.isResetAlert = true + } + .alert(isPresented: $isResetAlert) { + alertManager.showResetAlert(title: "초기화", message: "초기화 하시겠습니까?") { + // 초기화 로직 구현 + } + } + } + } + } + } +} + +struct SettingView_Previews: PreviewProvider { + static var previews: some View { + SettingView() + } +} + +struct SettingButton: View { + let title: String + let action: () -> Void + + var body: some View { + Button(action: action) { + Text(title) + } + .font(.subheadline) + .foregroundColor(.black) + } +}