Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] 로그인 화면 구현 #3

Merged
merged 4 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions roome/roome.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -25,10 +26,11 @@
921694FB2BF2202A006DC44A /* URLBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLBuilder.swift; sourceTree = "<group>"; };
921694FD2BF2207A006DC44A /* APIProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIProvider.swift; sourceTree = "<group>"; };
921695002BF220A6006DC44A /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = "<group>"; };
921695032BF22DCD006DC44A /* UIImage+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+.swift"; sourceTree = "<group>"; };
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 = "<group>"; };
92DBDA042BCFCF5900E299E2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
92DBDA062BCFCF5900E299E2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
92DBDA062BCFCF5900E299E2 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = "<group>"; };
92DBDA0B2BCFCF5B00E299E2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
92DBDA0E2BCFCF5B00E299E2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
92DBDA102BCFCF5B00E299E2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand All @@ -48,7 +50,7 @@
921694E92BF1BA74006DC44A /* View */ = {
isa = PBXGroup;
children = (
92DBDA062BCFCF5900E299E2 /* ViewController.swift */,
92DBDA062BCFCF5900E299E2 /* LoginViewController.swift */,
);
path = View;
sourceTree = "<group>";
Expand All @@ -72,6 +74,7 @@
921694ED2BF1BB8B006DC44A /* Presentation */ = {
isa = PBXGroup;
children = (
921695022BF22DB4006DC44A /* Extension */,
921694E92BF1BA74006DC44A /* View */,
921694EC2BF1BA8E006DC44A /* ViewModel */,
);
Expand Down Expand Up @@ -128,6 +131,14 @@
path = Error;
sourceTree = "<group>";
};
921695022BF22DB4006DC44A /* Extension */ = {
isa = PBXGroup;
children = (
921695032BF22DCD006DC44A /* UIImage+.swift */,
);
path = Extension;
sourceTree = "<group>";
};
92DBD9F62BCFCF5900E299E2 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -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 */,
);
Expand Down
2 changes: 1 addition & 1 deletion roome/roome/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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
}
}
6 changes: 6 additions & 0 deletions roome/roome/Assets.xcassets/Login/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions roome/roome/Presentation/Extension/UIImage+.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
71 changes: 71 additions & 0 deletions roome/roome/Presentation/View/LoginViewController.swift
Original file line number Diff line number Diff line change
@@ -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() {

}
}
19 changes: 0 additions & 19 deletions roome/roome/Presentation/View/ViewController.swift

This file was deleted.