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 6469345c..6fea5974 100644 --- a/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/ContentView.swift +++ b/project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/ContentView.swift @@ -7,23 +7,6 @@ import SwiftUI -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 - ) - } -} - struct ContentView: View { enum TabItem { @@ -70,7 +53,6 @@ struct ContentView: View { } } .tint(Color(hex: hexColor)) // 메인컬러로 변경 - .navigationBarItems(leading: leadingBarItem) } } 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 + ) + } +}