From 7d05d94b62cf49161d0625ea7fc2609642a9df00 Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Wed, 10 Jul 2024 18:42:23 +0900 Subject: [PATCH 1/8] =?UTF-8?q?=ED=99=88=20=EB=B7=B0=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PophoryPractice.xcodeproj/project.pbxproj | 28 +++++++++++++++++++ .../PophoryPractice/PophoryPracticeApp.swift | 2 +- .../Yunseo/View/HomeView.swift | 28 +++++++++++++++++++ .../Yunseo/View/SelectAlbumCoverView.swift | 18 ++++++++++++ .../PophoryPractice/Yunseo/albumModel.swift | 13 +++++++++ .../PophoryPractice/YunseoView.swift | 8 +++++- 6 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 PophoryPractice/PophoryPractice/Yunseo/View/HomeView.swift create mode 100644 PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift create mode 100644 PophoryPractice/PophoryPractice/Yunseo/albumModel.swift diff --git a/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj b/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj index 607499b..af58030 100644 --- a/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj +++ b/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj @@ -7,6 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 3BA899812C3E735A002C4213 /* albumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899802C3E735A002C4213 /* albumModel.swift */; }; + 3BA899842C3E7AF7002C4213 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899832C3E7AF7002C4213 /* HomeView.swift */; }; + 3BA899862C3E7BB8002C4213 /* SelectAlbumCoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */; }; 3BC648FD2C2C53CD000BDAFA /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3BC648FC2C2C53CD000BDAFA /* Colors.xcassets */; }; 3BFF3CF32C2C4F04001460A7 /* PophoryPracticeApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFF3CF22C2C4F04001460A7 /* PophoryPracticeApp.swift */; }; 3BFF3CF52C2C4F04001460A7 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFF3CF42C2C4F04001460A7 /* ContentView.swift */; }; @@ -37,6 +40,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 3BA899802C3E735A002C4213 /* albumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = albumModel.swift; sourceTree = ""; }; + 3BA899832C3E7AF7002C4213 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = ""; }; + 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectAlbumCoverView.swift; sourceTree = ""; }; 3BC648FC2C2C53CD000BDAFA /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; 3BFF3CEF2C2C4F04001460A7 /* PophoryPractice.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PophoryPractice.app; sourceTree = BUILT_PRODUCTS_DIR; }; 3BFF3CF22C2C4F04001460A7 /* PophoryPracticeApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PophoryPracticeApp.swift; sourceTree = ""; }; @@ -77,6 +83,24 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3BA8997F2C3E734E002C4213 /* Yunseo */ = { + isa = PBXGroup; + children = ( + 3BA899822C3E7AEE002C4213 /* View */, + 3BA899802C3E735A002C4213 /* albumModel.swift */, + ); + path = Yunseo; + sourceTree = ""; + }; + 3BA899822C3E7AEE002C4213 /* View */ = { + isa = PBXGroup; + children = ( + 3BA899832C3E7AF7002C4213 /* HomeView.swift */, + 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */, + ); + path = View; + sourceTree = ""; + }; 3BFF3CE62C2C4F04001460A7 = { isa = PBXGroup; children = ( @@ -100,6 +124,7 @@ 3BFF3CF12C2C4F04001460A7 /* PophoryPractice */ = { isa = PBXGroup; children = ( + 3BA8997F2C3E734E002C4213 /* Yunseo */, 3BFF3CF22C2C4F04001460A7 /* PophoryPracticeApp.swift */, 3BFF3CF42C2C4F04001460A7 /* ContentView.swift */, 3BFF3CF62C2C4F05001460A7 /* Assets.xcassets */, @@ -270,6 +295,9 @@ 3BFF3CF52C2C4F04001460A7 /* ContentView.swift in Sources */, 3BFF3D1F2C2C501A001460A7 /* YunseoView.swift in Sources */, 3BFF3D1D2C2C5012001460A7 /* JoonView.swift in Sources */, + 3BA899842C3E7AF7002C4213 /* HomeView.swift in Sources */, + 3BA899812C3E735A002C4213 /* albumModel.swift in Sources */, + 3BA899862C3E7BB8002C4213 /* SelectAlbumCoverView.swift in Sources */, 3BFF3CF32C2C4F04001460A7 /* PophoryPracticeApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/PophoryPractice/PophoryPractice/PophoryPracticeApp.swift b/PophoryPractice/PophoryPractice/PophoryPracticeApp.swift index 16ed5e8..7737c5c 100644 --- a/PophoryPractice/PophoryPractice/PophoryPracticeApp.swift +++ b/PophoryPractice/PophoryPractice/PophoryPracticeApp.swift @@ -11,7 +11,7 @@ import SwiftUI struct PophoryPracticeApp: App { var body: some Scene { WindowGroup { - ContentView() + YunseoView() } } } diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/HomeView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/HomeView.swift new file mode 100644 index 0000000..01359a0 --- /dev/null +++ b/PophoryPractice/PophoryPractice/Yunseo/View/HomeView.swift @@ -0,0 +1,28 @@ +// +// HomeView.swift +// PophoryPractice +// +// Created by 강윤서 on 7/10/24. +// + +import SwiftUI + +struct HomeView: View { + var body: some View { + Image(.icAlbumCoverFamily1) + .resizable() + .frame(width: 280, height: 380) + .clipShape( + .rect( + topLeadingRadius: 4, + bottomLeadingRadius: 4, + bottomTrailingRadius: 26, + topTrailingRadius: 26, + style: .circular) + ) + } +} + +#Preview { + HomeView() +} diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift new file mode 100644 index 0000000..525559e --- /dev/null +++ b/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift @@ -0,0 +1,18 @@ +// +// SelectAlbumCoverView.swift +// PophoryPractice +// +// Created by 강윤서 on 7/10/24. +// + +import SwiftUI + +struct SelectAlbumCoverView: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +#Preview { + SelectAlbumCoverView() +} diff --git a/PophoryPractice/PophoryPractice/Yunseo/albumModel.swift b/PophoryPractice/PophoryPractice/Yunseo/albumModel.swift new file mode 100644 index 0000000..51d0286 --- /dev/null +++ b/PophoryPractice/PophoryPractice/Yunseo/albumModel.swift @@ -0,0 +1,13 @@ +// +// listModel.swift +// PophoryPractice +// +// Created by 강윤서 on 7/10/24. +// + +import SwiftUI + +struct albumCoverModel { + let id = UUID() + let coverImage: Image +} diff --git a/PophoryPractice/PophoryPractice/YunseoView.swift b/PophoryPractice/PophoryPractice/YunseoView.swift index 97dc054..ba0d386 100644 --- a/PophoryPractice/PophoryPractice/YunseoView.swift +++ b/PophoryPractice/PophoryPractice/YunseoView.swift @@ -9,7 +9,13 @@ import SwiftUI struct YunseoView: View { var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + NavigationStack { + NavigationLink(destination: SelectAlbumCoverView()) { + HomeView() + } + .navigationTitle("Pophory") + .navigationBarTitleDisplayMode(.automatic) + } } } From 23cda91942547279416ad8e2b9c815464c3719f3 Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Wed, 10 Jul 2024 18:42:36 +0900 Subject: [PATCH 2/8] =?UTF-8?q?=EC=95=A8=EB=B2=94=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EB=B7=B0=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yunseo/View/SelectAlbumCoverView.swift | 42 +++++++++++++++++- .../PophoryPractice/Yunseo/albumModel.swift | 43 ++++++++++++++++++- 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift index 525559e..7b3a263 100644 --- a/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift +++ b/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift @@ -8,8 +8,48 @@ import SwiftUI struct SelectAlbumCoverView: View { + @State private var selectedIcon: AlbumIconModel? + let rows = [GridItem(.flexible())] + var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + VStack { + Spacer() + + LazyHGrid(rows: rows, spacing: 18) { + ForEach(AlbumIconModel.albumIcons, id: \.id) { element in + element.iconImage + .onTapGesture { + selectedIcon = element + } + } + } + .frame(width: .infinity, height: 50) + .background(Color.gray) + + Spacer() + + ScrollView(.horizontal) { + LazyHGrid(rows: rows, spacing: 16, content: { + ForEach(AlbumCoverModel.albumCovers, id: \.id) { element in + element.coverImage + .resizable() + .clipShape( + .rect(topLeadingRadius: 4, + bottomLeadingRadius: 4, + bottomTrailingRadius: 26, + topTrailingRadius: 26, + style: .circular) + ) + .frame(width: 280, height: 380) + + } + }) + } + .frame(width: .infinity, height: 380) + .background(Color.red) + + Spacer() + } } } diff --git a/PophoryPractice/PophoryPractice/Yunseo/albumModel.swift b/PophoryPractice/PophoryPractice/Yunseo/albumModel.swift index 51d0286..b476d45 100644 --- a/PophoryPractice/PophoryPractice/Yunseo/albumModel.swift +++ b/PophoryPractice/PophoryPractice/Yunseo/albumModel.swift @@ -7,7 +7,48 @@ import SwiftUI -struct albumCoverModel { +struct AlbumCoverModel: Identifiable { let id = UUID() let coverImage: Image } + +struct AlbumIconModel: Identifiable { + let id = UUID() + let iconImage: Image +} + +struct AlbumSelectIconModel: Identifiable { + let id = UUID() + let iconImage: Image +} + +extension AlbumCoverModel { + static var albumCovers: [AlbumCoverModel] = [ + AlbumCoverModel(coverImage: Image(.icAlbumCoverFamily1)), + AlbumCoverModel(coverImage: Image(.icAlbumCoverFamily2)), + AlbumCoverModel(coverImage: Image(.icAlbumCoverLove1)), + AlbumCoverModel(coverImage: Image(.icAlbumCoverLove2)), + AlbumCoverModel(coverImage: Image(.icAlbumCoverFriends1)), + AlbumCoverModel(coverImage: Image(.icAlbumCoverFriends2)), + AlbumCoverModel(coverImage: Image(.icAlbumCoverMe1)), + AlbumCoverModel(coverImage: Image(.icAlbumCoverMe2)), + ] +} + +extension AlbumIconModel { + static var albumIcons: [AlbumIconModel] = [ + AlbumIconModel(iconImage: Image(.albumCover1)), + AlbumIconModel(iconImage: Image(.albumCover2)), + AlbumIconModel(iconImage: Image(.albumCover3)), + AlbumIconModel(iconImage: Image(.albumCover4)) + ] +} + +extension AlbumSelectIconModel { + static var albumSelectIcons: [AlbumSelectIconModel] = [ + AlbumSelectIconModel(iconImage: Image(.albumCoverProfile1)), + AlbumSelectIconModel(iconImage: Image(.albumCoverProfile2)), + AlbumSelectIconModel(iconImage: Image(.albumCoverProfile3)), + AlbumSelectIconModel(iconImage: Image(.albumCoverProfile4)) + ] +} From 7c17493e503ee34a58686cf5d97eee1ae7a0b839 Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Wed, 10 Jul 2024 19:42:19 +0900 Subject: [PATCH 3/8] Fix: selectedItem binding --- .../PophoryPractice.xcodeproj/project.pbxproj | 4 ++++ .../Yunseo/View/AlbumIconView.swift | 24 +++++++++++++++++++ .../Yunseo/View/SelectAlbumCoverView.swift | 6 ++--- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 PophoryPractice/PophoryPractice/Yunseo/View/AlbumIconView.swift diff --git a/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj b/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj index af58030..64d5210 100644 --- a/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj +++ b/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 3BA899812C3E735A002C4213 /* albumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899802C3E735A002C4213 /* albumModel.swift */; }; 3BA899842C3E7AF7002C4213 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899832C3E7AF7002C4213 /* HomeView.swift */; }; 3BA899862C3E7BB8002C4213 /* SelectAlbumCoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */; }; + 3BA899882C3E8F46002C4213 /* AlbumIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899872C3E8F46002C4213 /* AlbumIconView.swift */; }; 3BC648FD2C2C53CD000BDAFA /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3BC648FC2C2C53CD000BDAFA /* Colors.xcassets */; }; 3BFF3CF32C2C4F04001460A7 /* PophoryPracticeApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFF3CF22C2C4F04001460A7 /* PophoryPracticeApp.swift */; }; 3BFF3CF52C2C4F04001460A7 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFF3CF42C2C4F04001460A7 /* ContentView.swift */; }; @@ -43,6 +44,7 @@ 3BA899802C3E735A002C4213 /* albumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = albumModel.swift; sourceTree = ""; }; 3BA899832C3E7AF7002C4213 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = ""; }; 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectAlbumCoverView.swift; sourceTree = ""; }; + 3BA899872C3E8F46002C4213 /* AlbumIconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumIconView.swift; sourceTree = ""; }; 3BC648FC2C2C53CD000BDAFA /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; 3BFF3CEF2C2C4F04001460A7 /* PophoryPractice.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PophoryPractice.app; sourceTree = BUILT_PRODUCTS_DIR; }; 3BFF3CF22C2C4F04001460A7 /* PophoryPracticeApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PophoryPracticeApp.swift; sourceTree = ""; }; @@ -97,6 +99,7 @@ children = ( 3BA899832C3E7AF7002C4213 /* HomeView.swift */, 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */, + 3BA899872C3E8F46002C4213 /* AlbumIconView.swift */, ); path = View; sourceTree = ""; @@ -295,6 +298,7 @@ 3BFF3CF52C2C4F04001460A7 /* ContentView.swift in Sources */, 3BFF3D1F2C2C501A001460A7 /* YunseoView.swift in Sources */, 3BFF3D1D2C2C5012001460A7 /* JoonView.swift in Sources */, + 3BA899882C3E8F46002C4213 /* AlbumIconView.swift in Sources */, 3BA899842C3E7AF7002C4213 /* HomeView.swift in Sources */, 3BA899812C3E735A002C4213 /* albumModel.swift in Sources */, 3BA899862C3E7BB8002C4213 /* SelectAlbumCoverView.swift in Sources */, diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/AlbumIconView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/AlbumIconView.swift new file mode 100644 index 0000000..d0eca73 --- /dev/null +++ b/PophoryPractice/PophoryPractice/Yunseo/View/AlbumIconView.swift @@ -0,0 +1,24 @@ +// +// AlbumIconView.swift +// PophoryPractice +// +// Created by 강윤서 on 7/10/24. +// + +import SwiftUI + +struct AlbumIconView: View { + @Binding var isSelectedIcon: UUID + let element: AlbumIconModel + + var body: some View { + return (element.id == isSelectedIcon ? selectIcon(for: isSelectedIcon): element.iconImage) + } + + private func selectIcon(for id: UUID) -> Image { + if let index = AlbumIconModel.albumIcons.firstIndex(where: {$0.id == id}) { + return AlbumSelectIconModel.albumSelectIcons[index].iconImage + } + return Image(systemName: "circle") + } +} diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift index 7b3a263..70fe5db 100644 --- a/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift +++ b/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift @@ -8,7 +8,7 @@ import SwiftUI struct SelectAlbumCoverView: View { - @State private var selectedIcon: AlbumIconModel? + @State private var selectedIcon: UUID = AlbumIconModel.albumIcons.first!.id let rows = [GridItem(.flexible())] var body: some View { @@ -17,9 +17,9 @@ struct SelectAlbumCoverView: View { LazyHGrid(rows: rows, spacing: 18) { ForEach(AlbumIconModel.albumIcons, id: \.id) { element in - element.iconImage + AlbumIconView(isSelectedIcon: $selectedIcon, element: element) .onTapGesture { - selectedIcon = element + selectedIcon = element.id } } } From e0b82e2c49f5de34273bd211eeacba828fd98c67 Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Tue, 30 Jul 2024 18:34:32 +0900 Subject: [PATCH 4/8] =?UTF-8?q?=EB=B2=84=ED=8A=BC=EC=97=90=20padding?= =?UTF-8?q?=EA=B3=BC=20frame=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yunseo/View/AlbumDetailView.swift | 18 +++++++++++++++ .../Yunseo/View/MyPageView.swift | 18 +++++++++++++++ .../Yunseo/View/SelectAlbumCoverView.swift | 16 +++++++++++--- .../Yunseo/View/pophoryButton.swift | 22 +++++++++++++++++++ 4 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 PophoryPractice/PophoryPractice/Yunseo/View/AlbumDetailView.swift create mode 100644 PophoryPractice/PophoryPractice/Yunseo/View/MyPageView.swift create mode 100644 PophoryPractice/PophoryPractice/Yunseo/View/pophoryButton.swift diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/AlbumDetailView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/AlbumDetailView.swift new file mode 100644 index 0000000..94dd872 --- /dev/null +++ b/PophoryPractice/PophoryPractice/Yunseo/View/AlbumDetailView.swift @@ -0,0 +1,18 @@ +// +// AlbumDetailView.swift +// PophoryPractice +// +// Created by 강윤서 on 7/29/24. +// + +import SwiftUI + +struct AlbumDetailView: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +#Preview { + AlbumDetailView() +} diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/MyPageView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/MyPageView.swift new file mode 100644 index 0000000..14f8d71 --- /dev/null +++ b/PophoryPractice/PophoryPractice/Yunseo/View/MyPageView.swift @@ -0,0 +1,18 @@ +// +// MyPageView.swift +// PophoryPractice +// +// Created by 강윤서 on 7/29/24. +// + +import SwiftUI + +struct MyPageView: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +#Preview { + MyPageView() +} diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift index 70fe5db..c8a9550 100644 --- a/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift +++ b/PophoryPractice/PophoryPractice/Yunseo/View/SelectAlbumCoverView.swift @@ -9,6 +9,7 @@ import SwiftUI struct SelectAlbumCoverView: View { @State private var selectedIcon: UUID = AlbumIconModel.albumIcons.first!.id + @Environment(\.dismiss) private var dismiss let rows = [GridItem(.flexible())] var body: some View { @@ -24,7 +25,6 @@ struct SelectAlbumCoverView: View { } } .frame(width: .infinity, height: 50) - .background(Color.gray) Spacer() @@ -41,12 +41,22 @@ struct SelectAlbumCoverView: View { style: .circular) ) .frame(width: 280, height: 380) - } }) + .padding([.leading, .trailing], 48) } + .scrollIndicators(.hidden, axes: .horizontal) .frame(width: .infinity, height: 380) - .background(Color.red) + + Spacer() + + Button(action: { + dismiss() + }, label: { + Text("수정하기") + }) + .buttonStyle(PophoryButton()) + .frame(width: 335) Spacer() } diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/pophoryButton.swift b/PophoryPractice/PophoryPractice/Yunseo/View/pophoryButton.swift new file mode 100644 index 0000000..78faa79 --- /dev/null +++ b/PophoryPractice/PophoryPractice/Yunseo/View/pophoryButton.swift @@ -0,0 +1,22 @@ +// +// pophoryButton.swift +// PophoryPractice +// +// Created by 강윤서 on 7/18/24. +// + +import SwiftUI + +struct PophoryButton: ButtonStyle { + var height: CGFloat = 60 + + func makeBody(configuration: Configuration) -> some View { + configuration.label + .frame(maxWidth: .infinity, maxHeight: height) + .padding([.leading, .trailing]) + .background(.black) + .foregroundStyle(.white) + .clipShape(Capsule()) + .fontWeight(.heavy) + } +} From 547555621e0b7a5e3e22a65c86b44af7778cbe31 Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Tue, 30 Jul 2024 18:34:49 +0900 Subject: [PATCH 5/8] =?UTF-8?q?NavigationStack=20+=20TabBar=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PophoryPractice.xcodeproj/project.pbxproj | 12 ++++ .../PophoryPractice/ContentView.swift | 8 +-- .../Yunseo/View/AlbumDetailView.swift | 2 +- .../Yunseo/View/HomeView.swift | 67 +++++++++++++++---- .../Yunseo/View/MyPageView.swift | 2 +- .../PophoryPractice/YunseoView.swift | 21 ++++-- 6 files changed, 84 insertions(+), 28 deletions(-) diff --git a/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj b/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj index 64d5210..5a1293f 100644 --- a/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj +++ b/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj @@ -7,11 +7,14 @@ objects = { /* Begin PBXBuildFile section */ + 3B2842F42C4944D500873964 /* pophoryButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B2842F32C4944D500873964 /* pophoryButton.swift */; }; 3BA899812C3E735A002C4213 /* albumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899802C3E735A002C4213 /* albumModel.swift */; }; 3BA899842C3E7AF7002C4213 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899832C3E7AF7002C4213 /* HomeView.swift */; }; 3BA899862C3E7BB8002C4213 /* SelectAlbumCoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */; }; 3BA899882C3E8F46002C4213 /* AlbumIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899872C3E8F46002C4213 /* AlbumIconView.swift */; }; 3BC648FD2C2C53CD000BDAFA /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3BC648FC2C2C53CD000BDAFA /* Colors.xcassets */; }; + 3BEA3C532C57E49C00F55311 /* MyPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BEA3C522C57E49C00F55311 /* MyPageView.swift */; }; + 3BEA3C552C57E5CC00F55311 /* AlbumDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BEA3C542C57E5CC00F55311 /* AlbumDetailView.swift */; }; 3BFF3CF32C2C4F04001460A7 /* PophoryPracticeApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFF3CF22C2C4F04001460A7 /* PophoryPracticeApp.swift */; }; 3BFF3CF52C2C4F04001460A7 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFF3CF42C2C4F04001460A7 /* ContentView.swift */; }; 3BFF3CF72C2C4F05001460A7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3BFF3CF62C2C4F05001460A7 /* Assets.xcassets */; }; @@ -41,11 +44,14 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 3B2842F32C4944D500873964 /* pophoryButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = pophoryButton.swift; sourceTree = ""; }; 3BA899802C3E735A002C4213 /* albumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = albumModel.swift; sourceTree = ""; }; 3BA899832C3E7AF7002C4213 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = ""; }; 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectAlbumCoverView.swift; sourceTree = ""; }; 3BA899872C3E8F46002C4213 /* AlbumIconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumIconView.swift; sourceTree = ""; }; 3BC648FC2C2C53CD000BDAFA /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; + 3BEA3C522C57E49C00F55311 /* MyPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageView.swift; sourceTree = ""; }; + 3BEA3C542C57E5CC00F55311 /* AlbumDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumDetailView.swift; sourceTree = ""; }; 3BFF3CEF2C2C4F04001460A7 /* PophoryPractice.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PophoryPractice.app; sourceTree = BUILT_PRODUCTS_DIR; }; 3BFF3CF22C2C4F04001460A7 /* PophoryPracticeApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PophoryPracticeApp.swift; sourceTree = ""; }; 3BFF3CF42C2C4F04001460A7 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -100,6 +106,9 @@ 3BA899832C3E7AF7002C4213 /* HomeView.swift */, 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */, 3BA899872C3E8F46002C4213 /* AlbumIconView.swift */, + 3B2842F32C4944D500873964 /* pophoryButton.swift */, + 3BEA3C522C57E49C00F55311 /* MyPageView.swift */, + 3BEA3C542C57E5CC00F55311 /* AlbumDetailView.swift */, ); path = View; sourceTree = ""; @@ -302,7 +311,10 @@ 3BA899842C3E7AF7002C4213 /* HomeView.swift in Sources */, 3BA899812C3E735A002C4213 /* albumModel.swift in Sources */, 3BA899862C3E7BB8002C4213 /* SelectAlbumCoverView.swift in Sources */, + 3BEA3C532C57E49C00F55311 /* MyPageView.swift in Sources */, + 3BEA3C552C57E5CC00F55311 /* AlbumDetailView.swift in Sources */, 3BFF3CF32C2C4F04001460A7 /* PophoryPracticeApp.swift in Sources */, + 3B2842F42C4944D500873964 /* pophoryButton.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/PophoryPractice/PophoryPractice/ContentView.swift b/PophoryPractice/PophoryPractice/ContentView.swift index 58a111e..e802b66 100644 --- a/PophoryPractice/PophoryPractice/ContentView.swift +++ b/PophoryPractice/PophoryPractice/ContentView.swift @@ -9,13 +9,7 @@ import SwiftUI struct ContentView: View { var body: some View { - VStack { - Image(systemName: "globe") - .imageScale(.large) - .foregroundStyle(.tint) - Text("Hello, world!") - } - .padding() + YunseoView() } } diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/AlbumDetailView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/AlbumDetailView.swift index 94dd872..0efe2bf 100644 --- a/PophoryPractice/PophoryPractice/Yunseo/View/AlbumDetailView.swift +++ b/PophoryPractice/PophoryPractice/Yunseo/View/AlbumDetailView.swift @@ -9,7 +9,7 @@ import SwiftUI struct AlbumDetailView: View { var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + Text("Album Detail View") } } diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/HomeView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/HomeView.swift index 01359a0..9932448 100644 --- a/PophoryPractice/PophoryPractice/Yunseo/View/HomeView.swift +++ b/PophoryPractice/PophoryPractice/Yunseo/View/HomeView.swift @@ -9,18 +9,61 @@ import SwiftUI struct HomeView: View { var body: some View { - Image(.icAlbumCoverFamily1) - .resizable() - .frame(width: 280, height: 380) - .clipShape( - .rect( - topLeadingRadius: 4, - bottomLeadingRadius: 4, - bottomTrailingRadius: 26, - topTrailingRadius: 26, - style: .circular) - ) - } + NavigationStack { + VStack { + HStack { + Text("Pophory") + .font(.system(size: 40)) + .fontWeight(.heavy) + .padding(.init(top: 26, leading: 20, bottom: 0, trailing: 0)) + + Spacer() + } + + HStack { + Text("포포리 앨범에\n소중한 추억을 보관해봐!") + .padding(.leading, 20) + .font(.system(size: 24)) + .fontWeight(.semibold) + + Spacer() + + NavigationLink { + SelectAlbumCoverView() + .toolbar(.hidden, for: .tabBar) + .navigationTitle("앨범 테마") + } label: { + Image(uiImage: .add) + .padding(.top, 34) + } + + Spacer() + } + .padding(.top, 25) + + NavigationLink { + AlbumDetailView() + .toolbar(.hidden, for: .tabBar) + .navigationTitle("앨범") + } label: { + Image(.icAlbumCoverFamily1) + .resizable() + .frame(width: 280, height: 380) + .clipShape( + .rect( + topLeadingRadius: 4, + bottomLeadingRadius: 4, + bottomTrailingRadius: 26, + topTrailingRadius: 26, + style: .circular) + ) + + } + .padding(.top, 36) + Spacer() + } + } + } } #Preview { diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/MyPageView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/MyPageView.swift index 14f8d71..be4ec74 100644 --- a/PophoryPractice/PophoryPractice/Yunseo/View/MyPageView.swift +++ b/PophoryPractice/PophoryPractice/Yunseo/View/MyPageView.swift @@ -9,7 +9,7 @@ import SwiftUI struct MyPageView: View { var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + Text("My Page View") } } diff --git a/PophoryPractice/PophoryPractice/YunseoView.swift b/PophoryPractice/PophoryPractice/YunseoView.swift index ba0d386..92da1ce 100644 --- a/PophoryPractice/PophoryPractice/YunseoView.swift +++ b/PophoryPractice/PophoryPractice/YunseoView.swift @@ -9,13 +9,20 @@ import SwiftUI struct YunseoView: View { var body: some View { - NavigationStack { - NavigationLink(destination: SelectAlbumCoverView()) { - HomeView() - } - .navigationTitle("Pophory") - .navigationBarTitleDisplayMode(.automatic) - } + TabView { + HomeView() + .tabItem { + Image(uiImage: .checkmark) + Text("내 서랍") + } + + MyPageView() + .tabItem { + Image(uiImage: .strokedCheckmark) + Text("마이") + } + } + .tint(.purple) } } From b485ef1770b1f177c535240e5f96f88ecbb08ee2 Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Wed, 31 Jul 2024 20:22:28 +0900 Subject: [PATCH 6/8] onboardingUI(carousel) --- .../PophoryPractice.xcodeproj/project.pbxproj | 12 ++++ .../View/Onboarding/OnboardingView.swift | 58 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 PophoryPractice/PophoryPractice/Yunseo/View/Onboarding/OnboardingView.swift diff --git a/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj b/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj index 5a1293f..e8f686b 100644 --- a/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj +++ b/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 3B2842F42C4944D500873964 /* pophoryButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B2842F32C4944D500873964 /* pophoryButton.swift */; }; + 3B33A4FA2C58EC0200CE376C /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B33A4F92C58EC0200CE376C /* OnboardingView.swift */; }; 3BA899812C3E735A002C4213 /* albumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899802C3E735A002C4213 /* albumModel.swift */; }; 3BA899842C3E7AF7002C4213 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899832C3E7AF7002C4213 /* HomeView.swift */; }; 3BA899862C3E7BB8002C4213 /* SelectAlbumCoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */; }; @@ -45,6 +46,7 @@ /* Begin PBXFileReference section */ 3B2842F32C4944D500873964 /* pophoryButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = pophoryButton.swift; sourceTree = ""; }; + 3B33A4F92C58EC0200CE376C /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = ""; }; 3BA899802C3E735A002C4213 /* albumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = albumModel.swift; sourceTree = ""; }; 3BA899832C3E7AF7002C4213 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = ""; }; 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectAlbumCoverView.swift; sourceTree = ""; }; @@ -91,6 +93,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3B33A4F82C58EB5400CE376C /* Onboarding */ = { + isa = PBXGroup; + children = ( + 3B33A4F92C58EC0200CE376C /* OnboardingView.swift */, + ); + path = Onboarding; + sourceTree = ""; + }; 3BA8997F2C3E734E002C4213 /* Yunseo */ = { isa = PBXGroup; children = ( @@ -103,6 +113,7 @@ 3BA899822C3E7AEE002C4213 /* View */ = { isa = PBXGroup; children = ( + 3B33A4F82C58EB5400CE376C /* Onboarding */, 3BA899832C3E7AF7002C4213 /* HomeView.swift */, 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */, 3BA899872C3E8F46002C4213 /* AlbumIconView.swift */, @@ -313,6 +324,7 @@ 3BA899862C3E7BB8002C4213 /* SelectAlbumCoverView.swift in Sources */, 3BEA3C532C57E49C00F55311 /* MyPageView.swift in Sources */, 3BEA3C552C57E5CC00F55311 /* AlbumDetailView.swift in Sources */, + 3B33A4FA2C58EC0200CE376C /* OnboardingView.swift in Sources */, 3BFF3CF32C2C4F04001460A7 /* PophoryPracticeApp.swift in Sources */, 3B2842F42C4944D500873964 /* pophoryButton.swift in Sources */, ); diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/Onboarding/OnboardingView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/Onboarding/OnboardingView.swift new file mode 100644 index 0000000..46b9c55 --- /dev/null +++ b/PophoryPractice/PophoryPractice/Yunseo/View/Onboarding/OnboardingView.swift @@ -0,0 +1,58 @@ +// +// OnboardingView.swift +// PophoryPractice +// +// Created by 강윤서 on 7/30/24. +// + +import SwiftUI + +struct OnboardingView: View { + var image: [Image] = [ + Image(.imgOnboarding01), + Image(.imgOnboarding02), + Image(.imgOnboarding03), + Image(.imgOnboarding04), + ] + @State private var selectedIndex = 0 + @GestureState private var dragAmount = CGSize.zero + + var body: some View { + VStack { + TabView(selection: $selectedIndex) { + ForEach(0..<4, id: \.self) { index in + image[index] + .resizable() + .scaledToFit() + .tag(index) + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + } + .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never)) + + HStack { + ForEach(0..<4) { index in + Circle() + .fill(index == selectedIndex ? .gray500 : .gray400) + .frame(width: 9, height: 9) + } + } + + Text("SNS로 간편가입하기!") + .foregroundStyle(.gray500) + .font(.system(size: 16)) + .padding(.top, 42) + + Button("AppleID로 시작하기") { + print("로그인 로직") + } + .buttonStyle(PophoryButton()) + .padding([.leading, .trailing], 20) + .padding(.top, 14) + } + } +} + +#Preview { + OnboardingView() +} From bb7af2f22a507bd28a6e3e0e6d291c4ac0352e5a Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Wed, 31 Jul 2024 20:54:47 +0900 Subject: [PATCH 7/8] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=EC=83=81?= =?UTF-8?q?=ED=83=9C=EB=A5=BC=20=EA=B4=80=EB=A6=AC=ED=95=98=EB=8A=94=20mod?= =?UTF-8?q?el=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yunseo/View/Model/LoggedStateModel.swift | 12 +++++++++++ .../Yunseo/View/TabView/PophoryTabView.swift | 21 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 PophoryPractice/PophoryPractice/Yunseo/View/Model/LoggedStateModel.swift create mode 100644 PophoryPractice/PophoryPractice/Yunseo/View/TabView/PophoryTabView.swift diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/Model/LoggedStateModel.swift b/PophoryPractice/PophoryPractice/Yunseo/View/Model/LoggedStateModel.swift new file mode 100644 index 0000000..9a1b249 --- /dev/null +++ b/PophoryPractice/PophoryPractice/Yunseo/View/Model/LoggedStateModel.swift @@ -0,0 +1,12 @@ +// +// LoggedStateModel.swift +// PophoryPractice +// +// Created by 강윤서 on 7/31/24. +// + +import SwiftUI + +class AppState: ObservableObject { + @Published var isLoggedIn: Bool = false +} diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/TabView/PophoryTabView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/TabView/PophoryTabView.swift new file mode 100644 index 0000000..3d9df98 --- /dev/null +++ b/PophoryPractice/PophoryPractice/Yunseo/View/TabView/PophoryTabView.swift @@ -0,0 +1,21 @@ +// +// TabView.swift +// PophoryPractice +// +// Created by 강윤서 on 7/31/24. +// + +import SwiftUI + +struct TabView: View { + var body: some View { + TabView { + HomeView() + MyPageView() + } + } +} + +#Preview { + TabView() +} From 067710a9d63934ea1ce02081c128dd4a689bc96b Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Wed, 31 Jul 2024 20:55:09 +0900 Subject: [PATCH 8/8] =?UTF-8?q?@EnvironmentObject=EB=A5=BC=20=ED=99=9C?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EC=97=AC=20=EB=A3=A8=ED=8A=B8=EB=B7=B0=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PophoryPractice.xcodeproj/project.pbxproj | 24 +++++++++++++++++++ .../PophoryPractice/ContentView.swift | 3 +++ .../PophoryPractice/PophoryPracticeApp.swift | 3 +++ .../View/Onboarding/OnboardingView.swift | 5 ++-- .../Yunseo/View/TabView/PophoryTabView.swift | 14 +++++++++-- .../PophoryPractice/YunseoView.swift | 22 +++++++---------- 6 files changed, 54 insertions(+), 17 deletions(-) diff --git a/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj b/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj index e8f686b..9be0273 100644 --- a/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj +++ b/PophoryPractice/PophoryPractice.xcodeproj/project.pbxproj @@ -9,6 +9,8 @@ /* Begin PBXBuildFile section */ 3B2842F42C4944D500873964 /* pophoryButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B2842F32C4944D500873964 /* pophoryButton.swift */; }; 3B33A4FA2C58EC0200CE376C /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B33A4F92C58EC0200CE376C /* OnboardingView.swift */; }; + 3B9417432C5A5727002DAE37 /* PophoryTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B9417422C5A5727002DAE37 /* PophoryTabView.swift */; }; + 3B9417462C5A5B75002DAE37 /* LoggedStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B9417452C5A5B75002DAE37 /* LoggedStateModel.swift */; }; 3BA899812C3E735A002C4213 /* albumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899802C3E735A002C4213 /* albumModel.swift */; }; 3BA899842C3E7AF7002C4213 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899832C3E7AF7002C4213 /* HomeView.swift */; }; 3BA899862C3E7BB8002C4213 /* SelectAlbumCoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */; }; @@ -47,6 +49,8 @@ /* Begin PBXFileReference section */ 3B2842F32C4944D500873964 /* pophoryButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = pophoryButton.swift; sourceTree = ""; }; 3B33A4F92C58EC0200CE376C /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = ""; }; + 3B9417422C5A5727002DAE37 /* PophoryTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PophoryTabView.swift; sourceTree = ""; }; + 3B9417452C5A5B75002DAE37 /* LoggedStateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggedStateModel.swift; sourceTree = ""; }; 3BA899802C3E735A002C4213 /* albumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = albumModel.swift; sourceTree = ""; }; 3BA899832C3E7AF7002C4213 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = ""; }; 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectAlbumCoverView.swift; sourceTree = ""; }; @@ -101,6 +105,22 @@ path = Onboarding; sourceTree = ""; }; + 3B9417412C5A571C002DAE37 /* TabView */ = { + isa = PBXGroup; + children = ( + 3B9417422C5A5727002DAE37 /* PophoryTabView.swift */, + ); + path = TabView; + sourceTree = ""; + }; + 3B9417442C5A5B66002DAE37 /* Model */ = { + isa = PBXGroup; + children = ( + 3B9417452C5A5B75002DAE37 /* LoggedStateModel.swift */, + ); + path = Model; + sourceTree = ""; + }; 3BA8997F2C3E734E002C4213 /* Yunseo */ = { isa = PBXGroup; children = ( @@ -113,6 +133,8 @@ 3BA899822C3E7AEE002C4213 /* View */ = { isa = PBXGroup; children = ( + 3B9417442C5A5B66002DAE37 /* Model */, + 3B9417412C5A571C002DAE37 /* TabView */, 3B33A4F82C58EB5400CE376C /* Onboarding */, 3BA899832C3E7AF7002C4213 /* HomeView.swift */, 3BA899852C3E7BB8002C4213 /* SelectAlbumCoverView.swift */, @@ -317,6 +339,7 @@ files = ( 3BFF3CF52C2C4F04001460A7 /* ContentView.swift in Sources */, 3BFF3D1F2C2C501A001460A7 /* YunseoView.swift in Sources */, + 3B9417432C5A5727002DAE37 /* PophoryTabView.swift in Sources */, 3BFF3D1D2C2C5012001460A7 /* JoonView.swift in Sources */, 3BA899882C3E8F46002C4213 /* AlbumIconView.swift in Sources */, 3BA899842C3E7AF7002C4213 /* HomeView.swift in Sources */, @@ -325,6 +348,7 @@ 3BEA3C532C57E49C00F55311 /* MyPageView.swift in Sources */, 3BEA3C552C57E5CC00F55311 /* AlbumDetailView.swift in Sources */, 3B33A4FA2C58EC0200CE376C /* OnboardingView.swift in Sources */, + 3B9417462C5A5B75002DAE37 /* LoggedStateModel.swift in Sources */, 3BFF3CF32C2C4F04001460A7 /* PophoryPracticeApp.swift in Sources */, 3B2842F42C4944D500873964 /* pophoryButton.swift in Sources */, ); diff --git a/PophoryPractice/PophoryPractice/ContentView.swift b/PophoryPractice/PophoryPractice/ContentView.swift index e802b66..7214910 100644 --- a/PophoryPractice/PophoryPractice/ContentView.swift +++ b/PophoryPractice/PophoryPractice/ContentView.swift @@ -8,6 +8,8 @@ import SwiftUI struct ContentView: View { + @EnvironmentObject private var appState: AppState + var body: some View { YunseoView() } @@ -15,4 +17,5 @@ struct ContentView: View { #Preview { ContentView() + .environmentObject(AppState()) } diff --git a/PophoryPractice/PophoryPractice/PophoryPracticeApp.swift b/PophoryPractice/PophoryPractice/PophoryPracticeApp.swift index 7737c5c..1d63fc2 100644 --- a/PophoryPractice/PophoryPractice/PophoryPracticeApp.swift +++ b/PophoryPractice/PophoryPractice/PophoryPracticeApp.swift @@ -9,9 +9,12 @@ import SwiftUI @main struct PophoryPracticeApp: App { + @StateObject private var appState = AppState() + var body: some Scene { WindowGroup { YunseoView() + .environmentObject(appState) } } } diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/Onboarding/OnboardingView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/Onboarding/OnboardingView.swift index 46b9c55..b7f6e62 100644 --- a/PophoryPractice/PophoryPractice/Yunseo/View/Onboarding/OnboardingView.swift +++ b/PophoryPractice/PophoryPractice/Yunseo/View/Onboarding/OnboardingView.swift @@ -15,6 +15,7 @@ struct OnboardingView: View { Image(.imgOnboarding04), ] @State private var selectedIndex = 0 + @EnvironmentObject private var appState: AppState @GestureState private var dragAmount = CGSize.zero var body: some View { @@ -37,14 +38,14 @@ struct OnboardingView: View { .frame(width: 9, height: 9) } } - + Text("SNS로 간편가입하기!") .foregroundStyle(.gray500) .font(.system(size: 16)) .padding(.top, 42) Button("AppleID로 시작하기") { - print("로그인 로직") + appState.isLoggedIn = true } .buttonStyle(PophoryButton()) .padding([.leading, .trailing], 20) diff --git a/PophoryPractice/PophoryPractice/Yunseo/View/TabView/PophoryTabView.swift b/PophoryPractice/PophoryPractice/Yunseo/View/TabView/PophoryTabView.swift index 3d9df98..17cc245 100644 --- a/PophoryPractice/PophoryPractice/Yunseo/View/TabView/PophoryTabView.swift +++ b/PophoryPractice/PophoryPractice/Yunseo/View/TabView/PophoryTabView.swift @@ -7,15 +7,25 @@ import SwiftUI -struct TabView: View { +struct PophoryTabView: View { var body: some View { TabView { HomeView() + .tabItem { + Image(uiImage: .checkmark) + Text("내 서랍") + } + MyPageView() + .tabItem { + Image(uiImage: .strokedCheckmark) + Text("마이") + } } + .tint(.purple) } } #Preview { - TabView() + PophoryTabView() } diff --git a/PophoryPractice/PophoryPractice/YunseoView.swift b/PophoryPractice/PophoryPractice/YunseoView.swift index 92da1ce..22b9af7 100644 --- a/PophoryPractice/PophoryPractice/YunseoView.swift +++ b/PophoryPractice/PophoryPractice/YunseoView.swift @@ -8,24 +8,20 @@ import SwiftUI struct YunseoView: View { + @EnvironmentObject var appState: AppState + var body: some View { - TabView { - HomeView() - .tabItem { - Image(uiImage: .checkmark) - Text("내 서랍") - } - - MyPageView() - .tabItem { - Image(uiImage: .strokedCheckmark) - Text("마이") - } + Group { + if appState.isLoggedIn { + PophoryTabView() + } else { + OnboardingView() + } } - .tint(.purple) } } #Preview { YunseoView() + .environmentObject(AppState()) }