diff --git a/roome/roome.xcodeproj/project.pbxproj b/roome/roome.xcodeproj/project.pbxproj index 4bc6fe3..5966c9e 100644 --- a/roome/roome.xcodeproj/project.pbxproj +++ b/roome/roome.xcodeproj/project.pbxproj @@ -12,9 +12,10 @@ 921694FC2BF2202A006DC44A /* URLBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 921694FB2BF2202A006DC44A /* URLBuilder.swift */; }; 921694FE2BF2207A006DC44A /* APIProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 921694FD2BF2207A006DC44A /* APIProvider.swift */; }; 921695012BF220A6006DC44A /* NetworkError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 921695002BF220A6006DC44A /* NetworkError.swift */; }; + 921695042BF22DCD006DC44A /* UIImage+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 921695032BF22DCD006DC44A /* UIImage+.swift */; }; 92DBDA032BCFCF5900E299E2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92DBDA022BCFCF5900E299E2 /* AppDelegate.swift */; }; 92DBDA052BCFCF5900E299E2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92DBDA042BCFCF5900E299E2 /* SceneDelegate.swift */; }; - 92DBDA072BCFCF5900E299E2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92DBDA062BCFCF5900E299E2 /* ViewController.swift */; }; + 92DBDA072BCFCF5900E299E2 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92DBDA062BCFCF5900E299E2 /* LoginViewController.swift */; }; 92DBDA0C2BCFCF5B00E299E2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92DBDA0B2BCFCF5B00E299E2 /* Assets.xcassets */; }; 92DBDA0F2BCFCF5B00E299E2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 92DBDA0D2BCFCF5B00E299E2 /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ @@ -25,10 +26,11 @@ 921694FB2BF2202A006DC44A /* URLBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLBuilder.swift; sourceTree = ""; }; 921694FD2BF2207A006DC44A /* APIProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIProvider.swift; sourceTree = ""; }; 921695002BF220A6006DC44A /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = ""; }; + 921695032BF22DCD006DC44A /* UIImage+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+.swift"; sourceTree = ""; }; 92DBD9FF2BCFCF5900E299E2 /* roome.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = roome.app; sourceTree = BUILT_PRODUCTS_DIR; }; 92DBDA022BCFCF5900E299E2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 92DBDA042BCFCF5900E299E2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; - 92DBDA062BCFCF5900E299E2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 92DBDA062BCFCF5900E299E2 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; 92DBDA0B2BCFCF5B00E299E2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 92DBDA0E2BCFCF5B00E299E2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 92DBDA102BCFCF5B00E299E2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -48,7 +50,7 @@ 921694E92BF1BA74006DC44A /* View */ = { isa = PBXGroup; children = ( - 92DBDA062BCFCF5900E299E2 /* ViewController.swift */, + 92DBDA062BCFCF5900E299E2 /* LoginViewController.swift */, ); path = View; sourceTree = ""; @@ -72,6 +74,7 @@ 921694ED2BF1BB8B006DC44A /* Presentation */ = { isa = PBXGroup; children = ( + 921695022BF22DB4006DC44A /* Extension */, 921694E92BF1BA74006DC44A /* View */, 921694EC2BF1BA8E006DC44A /* ViewModel */, ); @@ -128,6 +131,14 @@ path = Error; sourceTree = ""; }; + 921695022BF22DB4006DC44A /* Extension */ = { + isa = PBXGroup; + children = ( + 921695032BF22DCD006DC44A /* UIImage+.swift */, + ); + path = Extension; + sourceTree = ""; + }; 92DBD9F62BCFCF5900E299E2 = { isa = PBXGroup; children = ( @@ -231,10 +242,11 @@ files = ( 921694FA2BF21F07006DC44A /* RequestBuilder.swift in Sources */, 921695012BF220A6006DC44A /* NetworkError.swift in Sources */, - 92DBDA072BCFCF5900E299E2 /* ViewController.swift in Sources */, + 92DBDA072BCFCF5900E299E2 /* LoginViewController.swift in Sources */, 921694FE2BF2207A006DC44A /* APIProvider.swift in Sources */, 921694F82BF21E70006DC44A /* HTTP.swift in Sources */, 92DBDA032BCFCF5900E299E2 /* AppDelegate.swift in Sources */, + 921695042BF22DCD006DC44A /* UIImage+.swift in Sources */, 92DBDA052BCFCF5900E299E2 /* SceneDelegate.swift in Sources */, 921694FC2BF2202A006DC44A /* URLBuilder.swift in Sources */, ); diff --git a/roome/roome/Application/SceneDelegate.swift b/roome/roome/Application/SceneDelegate.swift index 233bb94..632e9e0 100644 --- a/roome/roome/Application/SceneDelegate.swift +++ b/roome/roome/Application/SceneDelegate.swift @@ -19,7 +19,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(windowScene: windowScene) - window?.rootViewController = ViewController() + window?.rootViewController = LoginViewController() window?.makeKeyAndVisible() } diff --git a/roome/roome/Assets.xcassets/Login/AppleLoginButtonImage.imageset/AppleLoginButtonImage.png b/roome/roome/Assets.xcassets/Login/AppleLoginButtonImage.imageset/AppleLoginButtonImage.png new file mode 100644 index 0000000..db09d7f Binary files /dev/null and b/roome/roome/Assets.xcassets/Login/AppleLoginButtonImage.imageset/AppleLoginButtonImage.png differ diff --git a/roome/roome/Assets.xcassets/Login/AppleLoginButtonImage.imageset/Contents.json b/roome/roome/Assets.xcassets/Login/AppleLoginButtonImage.imageset/Contents.json new file mode 100644 index 0000000..8bd9960 --- /dev/null +++ b/roome/roome/Assets.xcassets/Login/AppleLoginButtonImage.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "AppleLoginButtonImage.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/roome/roome/Assets.xcassets/Login/Contents.json b/roome/roome/Assets.xcassets/Login/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/roome/roome/Assets.xcassets/Login/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/roome/roome/Assets.xcassets/Login/kakaoLoginButtonImage.imageset/Contents.json b/roome/roome/Assets.xcassets/Login/kakaoLoginButtonImage.imageset/Contents.json new file mode 100644 index 0000000..9dcea80 --- /dev/null +++ b/roome/roome/Assets.xcassets/Login/kakaoLoginButtonImage.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "kakaoLoginButtonImage.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/roome/roome/Assets.xcassets/Login/kakaoLoginButtonImage.imageset/kakaoLoginButtonImage.png b/roome/roome/Assets.xcassets/Login/kakaoLoginButtonImage.imageset/kakaoLoginButtonImage.png new file mode 100644 index 0000000..bf67b71 Binary files /dev/null and b/roome/roome/Assets.xcassets/Login/kakaoLoginButtonImage.imageset/kakaoLoginButtonImage.png differ diff --git a/roome/roome/Presentation/Extension/UIImage+.swift b/roome/roome/Presentation/Extension/UIImage+.swift new file mode 100644 index 0000000..b463857 --- /dev/null +++ b/roome/roome/Presentation/Extension/UIImage+.swift @@ -0,0 +1,23 @@ +// +// UIImage+.swift +// roome +// +// Created by minsong kim on 5/13/24. +// + +import UIKit + +extension UIImage { + func resize(newWidth: CGFloat) -> UIImage { + let scale = newWidth / self.size.width + let newHeight = self.size.height * scale + + let size = CGSize(width: newWidth, height: newHeight) + let render = UIGraphicsImageRenderer(size: size) + let renderImage = render.image { context in + self.draw(in: CGRect(origin: .zero, size: size)) + } + + return renderImage + } +} diff --git a/roome/roome/Presentation/View/LoginViewController.swift b/roome/roome/Presentation/View/LoginViewController.swift new file mode 100644 index 0000000..0d8bfb9 --- /dev/null +++ b/roome/roome/Presentation/View/LoginViewController.swift @@ -0,0 +1,71 @@ +// +// ViewController.swift +// roome +// +// Created by minsong kim on 4/17/24. +// + +import UIKit + +class LoginViewController: UIViewController { + let stackView: UIStackView = { + let stack = UIStackView() + stack.translatesAutoresizingMaskIntoConstraints = false + stack.axis = .vertical + stack.distribution = .equalCentering + stack.spacing = 4 + + return stack + }() + //로그인 버튼 + lazy var kakaoLoginButton: UIButton = { + let button = UIButton() + button.addTarget(self, action: #selector(pushedKakaoLoginButton), for: .touchUpInside) + + var buttonConfiguration = UIButton.Configuration.plain() + buttonConfiguration.image = UIImage(resource: .kakaoLoginButton).resize(newWidth: view.frame.width * 0.9) + + button.configuration = buttonConfiguration + + return button + }() + + lazy var appleLoginButton: UIButton = { + let button = UIButton(type: .custom) + button.addTarget(self, action: #selector(pushedAppleLoginButton), for: .touchUpInside) + + var buttonConfiguration = UIButton.Configuration.plain() + buttonConfiguration.image = UIImage(resource: .appleLoginButton).resize(newWidth: view.frame.width * 0.9) + + button.configuration = buttonConfiguration + + return button + }() + + override func viewDidLoad() { + super.viewDidLoad() + configureUI() + } + + private func configureUI() { + view.addSubview(stackView) + stackView.addArrangedSubview(kakaoLoginButton) + stackView.addArrangedSubview(appleLoginButton) + + NSLayoutConstraint.activate([ + stackView.centerYAnchor.constraint(equalTo: view.centerYAnchor), + stackView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), + stackView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor) + ]) + } + + @objc + private func pushedKakaoLoginButton() { + + } + + @objc + private func pushedAppleLoginButton() { + + } +} diff --git a/roome/roome/Presentation/View/ViewController.swift b/roome/roome/Presentation/View/ViewController.swift deleted file mode 100644 index ad2acef..0000000 --- a/roome/roome/Presentation/View/ViewController.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// ViewController.swift -// roome -// -// Created by minsong kim on 4/17/24. -// - -import UIKit - -class ViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - // Do any additional setup after loading the view. - } - - -} -