diff --git a/SwiftUIDev/SwiftUIDev.xcodeproj/project.pbxproj b/SwiftUIDev/SwiftUIDev.xcodeproj/project.pbxproj index 473b4e1..b818ca4 100644 --- a/SwiftUIDev/SwiftUIDev.xcodeproj/project.pbxproj +++ b/SwiftUIDev/SwiftUIDev.xcodeproj/project.pbxproj @@ -7,18 +7,31 @@ objects = { /* Begin PBXBuildFile section */ + 3805A7A9289EFD30009A34A3 /* Gotham-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 3805A7A8289EFD30009A34A3 /* Gotham-Bold.otf */; }; + 3805A7AB289EFD3E009A34A3 /* Gotham-Black.otf in Resources */ = {isa = PBXBuildFile; fileRef = 3805A7AA289EFD3E009A34A3 /* Gotham-Black.otf */; }; 3861D1A8289EE5CE0001C187 /* SwiftUIDevApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3861D1A7289EE5CE0001C187 /* SwiftUIDevApp.swift */; }; 3861D1AA289EE5CE0001C187 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3861D1A9289EE5CE0001C187 /* ContentView.swift */; }; 3861D1AC289EE5CE0001C187 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3861D1AB289EE5CE0001C187 /* Assets.xcassets */; }; 3861D1AF289EE5CE0001C187 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3861D1AE289EE5CE0001C187 /* Preview Assets.xcassets */; }; + 3861D1B6289EE6900001C187 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3861D1B5289EE6900001C187 /* Model.swift */; }; + 3861D1B9289EE6A70001C187 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3861D1B8289EE6A70001C187 /* LoginView.swift */; }; + 38E88C6028A480B200B6634E /* SignupButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E88C5F28A480B200B6634E /* SignupButton.swift */; }; + 38E88C6328A4826200B6634E /* Text+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E88C6228A4826200B6634E /* Text+.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 3805A7A8289EFD30009A34A3 /* Gotham-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Gotham-Bold.otf"; sourceTree = ""; }; + 3805A7AA289EFD3E009A34A3 /* Gotham-Black.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Gotham-Black.otf"; sourceTree = ""; }; + 3805A7AC289EFDD2009A34A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 3861D1A4289EE5CE0001C187 /* SwiftUIDev.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftUIDev.app; sourceTree = BUILT_PRODUCTS_DIR; }; 3861D1A7289EE5CE0001C187 /* SwiftUIDevApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIDevApp.swift; sourceTree = ""; }; 3861D1A9289EE5CE0001C187 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 3861D1AB289EE5CE0001C187 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 3861D1AE289EE5CE0001C187 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 3861D1B5289EE6900001C187 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = ""; }; + 3861D1B8289EE6A70001C187 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = ""; }; + 38E88C5F28A480B200B6634E /* SignupButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignupButton.swift; sourceTree = ""; }; + 38E88C6228A4826200B6634E /* Text+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Text+.swift"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -32,6 +45,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3805A7AD289EFE00009A34A3 /* Fonts */ = { + isa = PBXGroup; + children = ( + 3805A7A8289EFD30009A34A3 /* Gotham-Bold.otf */, + 3805A7AA289EFD3E009A34A3 /* Gotham-Black.otf */, + ); + path = Fonts; + sourceTree = ""; + }; 3861D19B289EE5CE0001C187 = { isa = PBXGroup; children = ( @@ -51,6 +73,8 @@ 3861D1A6289EE5CE0001C187 /* SwiftUIDev */ = { isa = PBXGroup; children = ( + 3805A7AC289EFDD2009A34A3 /* Info.plist */, + 3861D1B7289EE6970001C187 /* Spotify */, 3861D1A7289EE5CE0001C187 /* SwiftUIDevApp.swift */, 3861D1A9289EE5CE0001C187 /* ContentView.swift */, 3861D1AB289EE5CE0001C187 /* Assets.xcassets */, @@ -67,6 +91,58 @@ path = "Preview Content"; sourceTree = ""; }; + 3861D1B7289EE6970001C187 /* Spotify */ = { + isa = PBXGroup; + children = ( + 38E88C6528A48A9B00B6634E /* Screens */, + 38E88C6428A48A9200B6634E /* Global */, + ); + path = Spotify; + sourceTree = ""; + }; + 38E88C5E28A4809200B6634E /* UIComponents */ = { + isa = PBXGroup; + children = ( + 38E88C5F28A480B200B6634E /* SignupButton.swift */, + ); + path = UIComponents; + sourceTree = ""; + }; + 38E88C6128A4823600B6634E /* Extensions */ = { + isa = PBXGroup; + children = ( + 38E88C6228A4826200B6634E /* Text+.swift */, + ); + path = Extensions; + sourceTree = ""; + }; + 38E88C6428A48A9200B6634E /* Global */ = { + isa = PBXGroup; + children = ( + 38E88C6728A48ACD00B6634E /* Resources */, + 38E88C5E28A4809200B6634E /* UIComponents */, + 38E88C6128A4823600B6634E /* Extensions */, + ); + path = Global; + sourceTree = ""; + }; + 38E88C6528A48A9B00B6634E /* Screens */ = { + isa = PBXGroup; + children = ( + 3861D1B8289EE6A70001C187 /* LoginView.swift */, + ); + path = Screens; + sourceTree = ""; + }; + 38E88C6728A48ACD00B6634E /* Resources */ = { + isa = PBXGroup; + children = ( + 3861D1B5289EE6900001C187 /* Model.swift */, + 3805A7AD289EFE00009A34A3 /* Fonts */, + ); + path = Resources; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -125,6 +201,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3805A7A9289EFD30009A34A3 /* Gotham-Bold.otf in Resources */, + 3805A7AB289EFD3E009A34A3 /* Gotham-Black.otf in Resources */, 3861D1AF289EE5CE0001C187 /* Preview Assets.xcassets in Resources */, 3861D1AC289EE5CE0001C187 /* Assets.xcassets in Resources */, ); @@ -137,7 +215,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3861D1B6289EE6900001C187 /* Model.swift in Sources */, 3861D1AA289EE5CE0001C187 /* ContentView.swift in Sources */, + 38E88C6028A480B200B6634E /* SignupButton.swift in Sources */, + 3861D1B9289EE6A70001C187 /* LoginView.swift in Sources */, + 38E88C6328A4826200B6634E /* Text+.swift in Sources */, 3861D1A8289EE5CE0001C187 /* SwiftUIDevApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -270,6 +352,7 @@ DEVELOPMENT_TEAM = 82DRSFKFS9; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = SwiftUIDev/Info.plist; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; @@ -299,6 +382,7 @@ DEVELOPMENT_TEAM = 82DRSFKFS9; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = SwiftUIDev/Info.plist; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/AppIcon.appiconset/Contents.json b/SwiftUIDev/SwiftUIDev/Assets.xcassets/AppIcon.appiconset/Contents.json index 5a3257a..9221b9b 100644 --- a/SwiftUIDev/SwiftUIDev/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/SwiftUIDev/SwiftUIDev/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -70,6 +70,11 @@ "scale" : "2x", "size" : "40x40" }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, { "idiom" : "ipad", "scale" : "2x", diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/apple.imageset/Contents.json b/SwiftUIDev/SwiftUIDev/Assets.xcassets/apple.imageset/Contents.json new file mode 100644 index 0000000..0fcd2b1 --- /dev/null +++ b/SwiftUIDev/SwiftUIDev/Assets.xcassets/apple.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "apple.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/apple.imageset/apple.png b/SwiftUIDev/SwiftUIDev/Assets.xcassets/apple.imageset/apple.png new file mode 100644 index 0000000..76b9ef2 Binary files /dev/null and b/SwiftUIDev/SwiftUIDev/Assets.xcassets/apple.imageset/apple.png differ diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/facebook.imageset/Contents.json b/SwiftUIDev/SwiftUIDev/Assets.xcassets/facebook.imageset/Contents.json new file mode 100644 index 0000000..1f24589 --- /dev/null +++ b/SwiftUIDev/SwiftUIDev/Assets.xcassets/facebook.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "facebook.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/facebook.imageset/facebook.png b/SwiftUIDev/SwiftUIDev/Assets.xcassets/facebook.imageset/facebook.png new file mode 100644 index 0000000..1eb64d2 Binary files /dev/null and b/SwiftUIDev/SwiftUIDev/Assets.xcassets/facebook.imageset/facebook.png differ diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/google.imageset/Contents.json b/SwiftUIDev/SwiftUIDev/Assets.xcassets/google.imageset/Contents.json new file mode 100644 index 0000000..8ff8a35 --- /dev/null +++ b/SwiftUIDev/SwiftUIDev/Assets.xcassets/google.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "google.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/google.imageset/google.png b/SwiftUIDev/SwiftUIDev/Assets.xcassets/google.imageset/google.png new file mode 100644 index 0000000..001e1a2 Binary files /dev/null and b/SwiftUIDev/SwiftUIDev/Assets.xcassets/google.imageset/google.png differ diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify.imageset/Contents.json b/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify.imageset/Contents.json new file mode 100644 index 0000000..ee40c84 --- /dev/null +++ b/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "spotify.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify.imageset/spotify.png b/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify.imageset/spotify.png new file mode 100644 index 0000000..a0afd25 Binary files /dev/null and b/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify.imageset/spotify.png differ diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify_login_image.imageset/Contents.json b/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify_login_image.imageset/Contents.json new file mode 100644 index 0000000..d631016 --- /dev/null +++ b/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify_login_image.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "spotify_login_image.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify_login_image.imageset/spotify_login_image.png b/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify_login_image.imageset/spotify_login_image.png new file mode 100644 index 0000000..779ab4e Binary files /dev/null and b/SwiftUIDev/SwiftUIDev/Assets.xcassets/spotify_login_image.imageset/spotify_login_image.png differ diff --git a/SwiftUIDev/SwiftUIDev/Info.plist b/SwiftUIDev/SwiftUIDev/Info.plist new file mode 100644 index 0000000..dc3ba2b --- /dev/null +++ b/SwiftUIDev/SwiftUIDev/Info.plist @@ -0,0 +1,11 @@ + + + + + UIAppFonts + + Gotham-Bold.otf + Gotham-Black.otf + + + diff --git a/SwiftUIDev/SwiftUIDev/Spotify/Global/Extensions/Text+.swift b/SwiftUIDev/SwiftUIDev/Spotify/Global/Extensions/Text+.swift new file mode 100644 index 0000000..0b684d1 --- /dev/null +++ b/SwiftUIDev/SwiftUIDev/Spotify/Global/Extensions/Text+.swift @@ -0,0 +1,30 @@ +// +// Text+.swift +// SwiftUIDev +// +// Created by LeeJiSoo on 2022/08/11. +// + +import SwiftUI + +extension Text { + + func signupButtonFontStyle(dynamicStyle: UIFont.TextStyle, type: SignupType) -> Text { + self.font(.custom("Gotham-Bold", size: textSize(dynamicStyle))) + .foregroundColor(type == .signup ? Color.black : Color.white) + } + + func loginFontStyle() -> Text { + self.font(.custom("Gotham-Bold", size: textSize(.title3))) + .foregroundColor(.white) + } + + func titleFontStyle() -> Text { + self.font(.custom("Gotham-Black", size: textSize(.largeTitle))) + .foregroundColor(.white) + } + + private func textSize(_ textStyle: UIFont.TextStyle) -> CGFloat { + return UIFont.preferredFont(forTextStyle: textStyle).pointSize + } +} diff --git a/SwiftUIDev/SwiftUIDev/Spotify/Global/Resources/Fonts/Gotham-Black.otf b/SwiftUIDev/SwiftUIDev/Spotify/Global/Resources/Fonts/Gotham-Black.otf new file mode 100644 index 0000000..da11be7 Binary files /dev/null and b/SwiftUIDev/SwiftUIDev/Spotify/Global/Resources/Fonts/Gotham-Black.otf differ diff --git a/SwiftUIDev/SwiftUIDev/Spotify/Global/Resources/Fonts/Gotham-Bold.otf b/SwiftUIDev/SwiftUIDev/Spotify/Global/Resources/Fonts/Gotham-Bold.otf new file mode 100644 index 0000000..59ae7c2 Binary files /dev/null and b/SwiftUIDev/SwiftUIDev/Spotify/Global/Resources/Fonts/Gotham-Bold.otf differ diff --git a/SwiftUIDev/SwiftUIDev/Spotify/Global/Resources/Model.swift b/SwiftUIDev/SwiftUIDev/Spotify/Global/Resources/Model.swift new file mode 100644 index 0000000..4193c77 --- /dev/null +++ b/SwiftUIDev/SwiftUIDev/Spotify/Global/Resources/Model.swift @@ -0,0 +1,50 @@ +// +// Model.swift +// SwiftUIDev +// +// Created by LeeJiSoo on 2022/08/07. +// + +import SwiftUI + +enum SignupType: CaseIterable { + case signup + case google + case facebook + case apple + + var title: String { + switch self { + case .signup: + return "Sign up" + case .google: + return "Continue with Google" + case .facebook: + return "Continue with Facebook" + case .apple: + return "Continue with Apple" + } + } + + var logoImage: Image? { + switch self { + case .google: + return Image("google") + case .facebook: + return Image("facebook") + case .apple: + return Image("apple") + default: + return nil + } + } + + var color: Color { + switch self { + case .signup: + return .green + default: + return .black + } + } +} diff --git a/SwiftUIDev/SwiftUIDev/Spotify/Global/UIComponents/SignupButton.swift b/SwiftUIDev/SwiftUIDev/Spotify/Global/UIComponents/SignupButton.swift new file mode 100644 index 0000000..3eea360 --- /dev/null +++ b/SwiftUIDev/SwiftUIDev/Spotify/Global/UIComponents/SignupButton.swift @@ -0,0 +1,32 @@ +// +// SignupButton.swift +// SwiftUIDev +// +// Created by LeeJiSoo on 2022/08/11. +// + +import SwiftUI + +struct SignupButton: View { + let type: SignupType + let logoImageSize = 20.0 + + var body: some View { + HStack { + type.logoImage? + .resizable() + .scaledToFit() + .frame(width: logoImageSize) + Spacer() + Text(type.title) + .signupButtonFontStyle(dynamicStyle: .title3, type: type) + .lineLimit(1) + .minimumScaleFactor(0.5) + Spacer() + } + .padding() + .background(type.color) + .clipShape(Capsule()) + .overlay(Capsule().stroke(Color.white, lineWidth: 0.3)) + } +} diff --git a/SwiftUIDev/SwiftUIDev/Spotify/Screens/LoginView.swift b/SwiftUIDev/SwiftUIDev/Spotify/Screens/LoginView.swift new file mode 100644 index 0000000..825e437 --- /dev/null +++ b/SwiftUIDev/SwiftUIDev/Spotify/Screens/LoginView.swift @@ -0,0 +1,67 @@ +// +// LoginView.swift +// SwiftUIDev +// +// Created by LeeJiSoo on 2022/08/07. +// + +import SwiftUI + +struct LoginView: View { + let buttonHorizontalPadding = 32.0 + let mainLogoSize = 44.0 + let signupButtonInterval = 10.0 + let loginButtonPadding = 28.0 + let titleInterval = 28.0 + let titleAndButtonInterval = 40.0 + + var body: some View { + ZStack { + Image("spotify_login_image") + .resizable() + .aspectRatio(contentMode: .fill) + .frame(minWidth: 0, maxWidth: .infinity) + .edgesIgnoringSafeArea(.all) + VStack { + Spacer() + title() + signupButtons() + .padding(.horizontal, buttonHorizontalPadding) + loginButton() + } + } + } + + private func signupButtons() -> some View { + VStack(spacing: signupButtonInterval) { + ForEach(SignupType.allCases, id: \.self) { type in + SignupButton(type: type) + } + } + } + + private func loginButton() -> some View { + Text("Log in") + .loginFontStyle() + .padding(.vertical, loginButtonPadding) + } + + private func title() -> some View { + VStack (spacing: titleInterval){ + Image("spotify") + .resizable() + .scaledToFit() + .frame(width: mainLogoSize) + Text("Discover your next \nfavorite playlist") + .titleFontStyle() + .multilineTextAlignment(.center) + } + .padding(.vertical, titleAndButtonInterval) + } +} + +struct LoginView_Previews: PreviewProvider { + static var previews: some View { + LoginView() + } +} diff --git a/SwiftUIDev/SwiftUIDev/SwiftUIDevApp.swift b/SwiftUIDev/SwiftUIDev/SwiftUIDevApp.swift index c5174e9..b21e3d6 100644 --- a/SwiftUIDev/SwiftUIDev/SwiftUIDevApp.swift +++ b/SwiftUIDev/SwiftUIDev/SwiftUIDevApp.swift @@ -11,7 +11,7 @@ import SwiftUI struct SwiftUIDevApp: App { var body: some Scene { WindowGroup { - ContentView() + LoginView() } } }