-
Notifications
You must be signed in to change notification settings - Fork 0
[Work 46] 로그인 화면을 추가합니다. #17
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
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
WhereAreYou/WhereAreYou/Presentation/Login/AppleLoginButton.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // | ||
| // AppleLoginButton.swift | ||
| // WhereAreYou | ||
| // | ||
| // Created by 김성훈 on 8/21/26. | ||
| // | ||
|
|
||
| import UIKit | ||
| import AuthenticationServices | ||
|
|
||
| /// Apple 로그인 버튼 — HIG 표준 컴포넌트를 감싸는 얇은 래퍼 | ||
| final class AppleLoginButton: UIView { | ||
|
|
||
| var onTap: (() -> Void)? | ||
|
|
||
| private lazy var button: ASAuthorizationAppleIDButton = { | ||
| let button = ASAuthorizationAppleIDButton(type: .signIn, style: .black) | ||
| button.cornerRadius = 12 | ||
| button.translatesAutoresizingMaskIntoConstraints = false | ||
| button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside) | ||
| return button | ||
| }() | ||
|
|
||
| init() { | ||
| super.init(frame: .zero) | ||
| translatesAutoresizingMaskIntoConstraints = false | ||
| setUpLayout() | ||
| } | ||
|
|
||
| required init?(coder: NSCoder) { | ||
| fatalError("init(coder:) has not been implemented") | ||
| } | ||
|
|
||
| private func setUpLayout() { | ||
| addSubview(button) | ||
| NSLayoutConstraint.activate([ | ||
| button.topAnchor.constraint(equalTo: topAnchor), | ||
| button.leadingAnchor.constraint(equalTo: leadingAnchor), | ||
| button.trailingAnchor.constraint(equalTo: trailingAnchor), | ||
| button.bottomAnchor.constraint(equalTo: bottomAnchor) | ||
| ]) | ||
| } | ||
|
|
||
| @objc private func buttonTapped() { | ||
| onTap?() | ||
| } | ||
|
|
||
| } | ||
112 changes: 112 additions & 0 deletions
112
WhereAreYou/WhereAreYou/Presentation/Login/LoginViewController.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| // | ||
| // LoginViewController.swift | ||
| // WhereAreYou | ||
| // | ||
| // Created by 김성훈 on 8/21/26. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| /// 로그인 화면 — 앱 진입 시 최초로 표시되는 화면 | ||
| final class LoginViewController: UIViewController { | ||
|
|
||
| // MARK: - Properties | ||
|
|
||
| var onAppleLoginTap: (() -> Void)? | ||
|
|
||
| // MARK: - UI | ||
|
|
||
| private let backgroundImageView: UIImageView = { | ||
| let imageView = UIImageView(image: .loginBackground) | ||
| imageView.contentMode = .scaleAspectFill | ||
| imageView.clipsToBounds = true | ||
| imageView.translatesAutoresizingMaskIntoConstraints = false | ||
| return imageView | ||
| }() | ||
|
|
||
| private let logoImageView: UIImageView = { | ||
| let imageView = UIImageView(image: .logo) | ||
| imageView.contentMode = .scaleAspectFit | ||
| imageView.translatesAutoresizingMaskIntoConstraints = false | ||
| return imageView | ||
| }() | ||
|
|
||
| private let titleLabel: UILabel = { | ||
| let label = UILabel() | ||
| label.text = "어딘데" | ||
| label.font = .boldPreferredFont(forTextStyle: .title1) | ||
| label.textColor = .blue1 | ||
| label.textAlignment = .center | ||
| label.adjustsFontForContentSizeCategory = true | ||
| label.translatesAutoresizingMaskIntoConstraints = false | ||
| return label | ||
| }() | ||
|
|
||
| private let subtitleLabel: UILabel = { | ||
| let label = UILabel() | ||
| label.text = "약속 장소로 가는 길, 함께 확인해요" | ||
| label.font = .preferredFont(forTextStyle: .subheadline) | ||
| label.textColor = .secondaryLabel | ||
| label.textAlignment = .center | ||
| label.translatesAutoresizingMaskIntoConstraints = false | ||
| return label | ||
| }() | ||
|
|
||
| private let appleLoginButton: AppleLoginButton = AppleLoginButton() | ||
|
|
||
| // MARK: - Life Cycle | ||
|
|
||
| override func viewDidLoad() { | ||
| super.viewDidLoad() | ||
| setUpView() | ||
| setUpLayout() | ||
| setUpActions() | ||
| } | ||
|
|
||
| // MARK: - Set Up | ||
|
|
||
| private func setUpView() { | ||
| view.backgroundColor = .pointBackground | ||
| } | ||
|
|
||
| private func setUpLayout() { | ||
| view.addSubview(backgroundImageView) | ||
| view.addSubview(logoImageView) | ||
| view.addSubview(titleLabel) | ||
| view.addSubview(subtitleLabel) | ||
| view.addSubview(appleLoginButton) | ||
|
|
||
| NSLayoutConstraint.activate([ | ||
| backgroundImageView.topAnchor.constraint(equalTo: view.topAnchor), | ||
| backgroundImageView.leadingAnchor.constraint(equalTo: view.leadingAnchor), | ||
| backgroundImageView.trailingAnchor.constraint(equalTo: view.trailingAnchor), | ||
| backgroundImageView.bottomAnchor.constraint(equalTo: view.bottomAnchor), | ||
|
|
||
| logoImageView.centerXAnchor.constraint(equalTo: view.centerXAnchor), | ||
| logoImageView.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: -240), | ||
| logoImageView.widthAnchor.constraint(equalToConstant: 119), | ||
| logoImageView.heightAnchor.constraint(equalToConstant: 74), | ||
|
|
||
| titleLabel.topAnchor.constraint(equalTo: logoImageView.bottomAnchor, constant: 16), | ||
| titleLabel.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 24), | ||
| titleLabel.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -24), | ||
|
|
||
| subtitleLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 8), | ||
| subtitleLabel.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 24), | ||
| subtitleLabel.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -24), | ||
|
|
||
| appleLoginButton.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 24), | ||
| appleLoginButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -24), | ||
| appleLoginButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -40), | ||
| appleLoginButton.heightAnchor.constraint(equalToConstant: 50) | ||
| ]) | ||
| } | ||
|
|
||
| private func setUpActions() { | ||
| appleLoginButton.onTap = { [weak self] in | ||
| // TODO: Apple 로그인 인증 로직 연결 필요 | ||
| self?.onAppleLoginTap?() | ||
| } | ||
| } | ||
|
|
||
| } |
21 changes: 21 additions & 0 deletions
21
WhereAreYou/WhereAreYou/Resource/Assets.xcassets/LoginBackground.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "filename" : "loginBack.png", | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
Binary file added
BIN
+1.02 MB
...You/WhereAreYou/Resource/Assets.xcassets/LoginBackground.imageset/loginBack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.