diff --git a/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer.xcodeproj/project.pbxproj b/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer.xcodeproj/project.pbxproj index f4c7e611..dfa72356 100644 --- a/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer.xcodeproj/project.pbxproj +++ b/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ F485B7512A94574200A2F5FF /* FirebaseFirestoreCombine-Community in Frameworks */ = {isa = PBXBuildFile; productRef = F485B7502A94574200A2F5FF /* FirebaseFirestoreCombine-Community */; }; F485B7532A94574200A2F5FF /* FirebaseFirestoreSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F485B7522A94574200A2F5FF /* FirebaseFirestoreSwift */; }; F485B7552A94584400A2F5FF /* AuthViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F485B7542A94584400A2F5FF /* AuthViewModel.swift */; }; + FAA6FC222A949FF2005E31DC /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA6FC212A949FF2005E31DC /* Extension.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -27,6 +28,7 @@ 9E99CCF42A944A5A00699B6A /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; F485B7492A94570F00A2F5FF /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; F485B7542A94584400A2F5FF /* AuthViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthViewModel.swift; sourceTree = ""; }; + FAA6FC212A949FF2005E31DC /* Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -63,9 +65,9 @@ 9E99CCEC2A944A5700699B6A /* project02-teamB-OUR-consumer */ = { isa = PBXGroup; children = ( - FA2585D82A947E3200CFA8CE /* GoogleService-Info.plist */, 9E99CCED2A944A5700699B6A /* project02_teamB_OUR_consumerApp.swift */, 9E99CCEF2A944A5700699B6A /* ContentView.swift */, + FAA6FC212A949FF2005E31DC /* Extension.swift */, F485B7562A94584800A2F5FF /* ViewModel */, 9E99CCF12A944A5A00699B6A /* Assets.xcassets */, F485B7492A94570F00A2F5FF /* GoogleService-Info.plist */, @@ -173,6 +175,7 @@ 9E99CCF02A944A5700699B6A /* ContentView.swift in Sources */, 9E99CCEE2A944A5700699B6A /* project02_teamB_OUR_consumerApp.swift in Sources */, F485B7552A94584400A2F5FF /* AuthViewModel.swift in Sources */, + FAA6FC222A949FF2005E31DC /* Extension.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/ContentView.swift b/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/ContentView.swift index 10ccf964..6fea5974 100644 --- a/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/ContentView.swift +++ b/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/ContentView.swift @@ -8,46 +8,64 @@ import SwiftUI struct ContentView: View { + + enum TabItem { + case feed, studyFeed, recruitAdd, alarm, myPage + } + + @State private var selectedTab: TabItem = .feed + @State private var mainLogoToggle: Bool = true + + let hexColor: String = "#090580" //메인컬러로 변경 + var body: some View { NavigationStack { - TabView { - //FeedView 팀에서 넣어주시면 됩니다. + TabView(selection: $selectedTab) { + //FeedView Image(systemName: "house.fill") + .tag(TabItem.feed) .tabItem { - Image(systemName: "house.fill") + Label("피드", systemImage: "house.fill") } - //StudyFeedView 팀에서 넣어주시면 됩니다. + //StudyFeedView Image(systemName: "book.fill") + .tag(TabItem.studyFeed) .tabItem { - Image(systemName: "book.fill") + Label("스터디모집", systemImage: "book.fill") } - //RecruitAddView 팀에서 넣어주시면 됩니다. + //RecruitAddView Image(systemName: "plus.app.fill") + .tag(TabItem.recruitAdd) .tabItem { - Image(systemName: "plus.app.fill") + Label("작성하기", systemImage: "plus.app.fill") } - //AlarmView 팀에서 넣어주시면 됩니다. + //AlarmView Image(systemName: "bell.fill") + .tag(TabItem.alarm) .tabItem { - Image(systemName: "bell.fill") + Label("알림", systemImage: "bell.fill") } - //MyPageView 팀에서 넣어주시면 됩니다. + //MyPageView Image(systemName: "person.fill") + .tag(TabItem.myPage) .tabItem { - Image(systemName: "person.fill") + Label("마이페이지", systemImage: "person.fill") } } - .navigationBarItems(leading: Button(action: { - //FeedView로 돌아가기 - }, label: { - Image("OUR_Logo") - .resizable() - .aspectRatio(contentMode: .fit) - })) + .tint(Color(hex: hexColor)) // 메인컬러로 변경 + .navigationBarItems(leading: leadingBarItem) } } -} + @ViewBuilder + var leadingBarItem: some View { + if mainLogoToggle && selectedTab != .alarm && selectedTab != .myPage { + Image("OUR_Logo") + .resizable() + .aspectRatio(contentMode: .fit) + } + } +} struct ContentView_Preview: PreviewProvider { static var previews: some View { diff --git a/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/Extension.swift b/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/Extension.swift new file mode 100644 index 00000000..e51f3f43 --- /dev/null +++ b/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/Extension.swift @@ -0,0 +1,26 @@ +// +// Extension.swift +// project02-teamB-OUR-consumer +// +// Created by 윤해수 on 2023/08/22. +// + +import SwiftUI + +//Color extension확장하여 Hex Color 받아서 바꾸기 +extension Color { + init(hex: String) { + var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines) + hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "") + + var rgb: UInt64 = 0 + + Scanner(string: hexSanitized).scanHexInt64(&rgb) + + self.init( + red: Double((rgb & 0xFF0000) >> 16) / 255.0, + green: Double((rgb & 0x00FF00) >> 8) / 255.0, + blue: Double(rgb & 0x0000FF) / 255.0 + ) + } +}