-
Notifications
You must be signed in to change notification settings - Fork 0
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
Login view, viewmodel, usecase #55
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a358697
[style] ํ์ํ์ผ ์ถ๊ฐ
jinwoong16 d2019cf
[feat] login logout ๋์์ ์ํํ usecase์ ํ๋กํ ์ฝ ์ ์
jinwoong16 c5cfa27
[feat] DefaultAuthUseCase ์ถ๊ฐ
jinwoong16 8a378f1
[style] AuthViewController ์ญ์
jinwoong16 156318f
[feat] AuthViewModel ์์ฑ
jinwoong16 9b1cd82
[style] #54 loginviewcontroller ํ์ผ ์ถ๊ฐ
jinwoong16 76b7f52
[feat] Navigate Field์ ๋ค๋น๊ฒ์ดํ
ํ์
์ถ๊ฐ
jinwoong16 f5ea3d6
[feat] Login๊ณผ ๊ด๋ จ๋ field์ด๋ฉด showloginflow ์ด๋ฒคํธ๋ฅผ ๋ฐฉ์ถ
jinwoong16 2349102
[feat] Coordinator์์ login flow๋ฅผ ์คํ
jinwoong16 e55fc42
[feat] ํ
์คํธํ๋๋ฅผ ์ค๋ฒ๋ผ์ด๋ ํ์ฌ ์ฌ๊ตฌ์ฑ
jinwoong16 070c67c
[feat] LoginViewController ๊ตฌํ
jinwoong16 39ceded
[feat] background color ์ถ๊ฐ
jinwoong16 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 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
38 changes: 38 additions & 0 deletions
38
DailyQuest/DailyQuest/Domain/UseCases/Home/DefaultAuthUseCase.swift
This file contains 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,38 @@ | ||
// | ||
// DefaultAuthUseCase.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/11/28. | ||
// | ||
|
||
import Foundation | ||
|
||
import RxSwift | ||
|
||
final class DefaultAuthUseCase { | ||
private let authRepository: AuthRepository | ||
|
||
init(authRepository: AuthRepository) { | ||
self.authRepository = authRepository | ||
} | ||
} | ||
|
||
extension DefaultAuthUseCase: AuthUseCase { | ||
func signIn(email: String, password: String) -> Observable<Bool> { | ||
return authRepository | ||
.signIn(email: email, password: password) | ||
.catch { _ in | ||
return .just(false) | ||
} | ||
.asObservable() | ||
} | ||
|
||
func signOut() -> Observable<Bool> { | ||
return authRepository | ||
.signOut() | ||
.catch { _ in | ||
return .just(false) | ||
} | ||
.asObservable() | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
DailyQuest/DailyQuest/Domain/UseCases/Home/Protocols/AuthUseCase.swift
This file contains 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,15 @@ | ||
// | ||
// AuthUseCase.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/11/28. | ||
// | ||
|
||
import Foundation | ||
|
||
import RxSwift | ||
|
||
protocol AuthUseCase { | ||
func signIn(email: String, password: String) -> Observable<Bool> | ||
func signOut() -> Observable<Bool> | ||
} |
35 changes: 35 additions & 0 deletions
35
DailyQuest/DailyQuest/Presentation/Common/TextFieldForm.swift
This file contains 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,35 @@ | ||
// | ||
// TextFieldForm.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/11/28. | ||
// | ||
|
||
import UIKit | ||
|
||
final class TextFieldForm: UITextField { | ||
var textPadding = UIEdgeInsets(top: 10, left: 20, bottom: 10, right: 20) | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
layer.borderWidth = 1 | ||
layer.borderColor = UIColor.maxYellow.cgColor | ||
layer.cornerRadius = 5 | ||
backgroundColor = UIColor(named: "White") | ||
textColor = .maxViolet | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
override func textRect(forBounds bounds: CGRect) -> CGRect { | ||
let rect = super.textRect(forBounds: bounds) | ||
return rect.inset(by: textPadding) | ||
} | ||
|
||
override func editingRect(forBounds bounds: CGRect) -> CGRect { | ||
let rect = super.editingRect(forBounds: bounds) | ||
return rect.inset(by: textPadding) | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
77 changes: 77 additions & 0 deletions
77
DailyQuest/DailyQuest/Presentation/Settings/ViewController/LoginViewController.swift
This file contains 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,77 @@ | ||
// | ||
// LoginViewController.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/11/28. | ||
// | ||
|
||
import UIKit | ||
|
||
import RxSwift | ||
import RxCocoa | ||
import SnapKit | ||
|
||
final class LoginViewController: UIViewController { | ||
|
||
private lazy var container: UIStackView = { | ||
let container = UIStackView() | ||
container.axis = .vertical | ||
container.spacing = 10 | ||
|
||
return container | ||
}() | ||
|
||
private lazy var emailField: TextFieldForm = { | ||
let emailField = TextFieldForm() | ||
emailField.placeholder = "email" | ||
|
||
return emailField | ||
}() | ||
|
||
private lazy var passwordField: TextFieldForm = { | ||
let passwordField = TextFieldForm() | ||
passwordField.placeholder = "password" | ||
|
||
return passwordField | ||
}() | ||
|
||
private lazy var submitButton: UIButton = { | ||
var config = UIButton.Configuration.filled() | ||
config.baseBackgroundColor = .maxYellow | ||
config.title = "๋ก๊ทธ์ธ" | ||
|
||
return UIButton(configuration: config) | ||
}() | ||
|
||
// MARK: Life Cycle | ||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
configureUI() | ||
} | ||
|
||
private func configureUI() { | ||
view.backgroundColor = .white | ||
|
||
container.addArrangedSubview(emailField) | ||
container.addArrangedSubview(passwordField) | ||
container.addArrangedSubview(submitButton) | ||
|
||
view.addSubview(container) | ||
|
||
container.snp.makeConstraints { make in | ||
make.center.equalToSuperview() | ||
make.width.equalToSuperview().multipliedBy(0.8) | ||
} | ||
} | ||
} | ||
|
||
#if canImport(SwiftUI) && DEBUG | ||
import SwiftUI | ||
|
||
struct ViewController_Preview: PreviewProvider { | ||
static var previews: some View { | ||
LoginViewController().showPreview(.iPhone14) | ||
} | ||
} | ||
#endif |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ทธ ์ด์ฐจํผ ๊ณ ์ ์ ์ธ ํ๋๋ค์ด๋ enum์ผ๋ก ๊ด๋ฆฌํด๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์ต๋๋ค.