-
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
Feat/#6 #7
Conversation
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.
PERFECT
์ ๋ ์์ ๋ ๋ฆฌ๋ทฐ ๋จ๊ฒจ๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค.
๋ค๋ฅธ ๋ฉ์ง ๋ถ๋ค์ด ๋ ์ฝ๋ฉํธ๋ฅผ ๋จ๊ธธํ
๋๊น์..
์ญ์๋ ์ํ์ญ๋๋ค โจ
func addLeftPadding() { | ||
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 15, height: self.frame.size.height)) | ||
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 14, height: self.frame.size.height)) | ||
self.leftView = paddingView | ||
self.leftViewMode = .always | ||
} | ||
|
||
func addRightPadding() { | ||
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 15, height: self.frame.size.height)) | ||
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 14, height: self.frame.size.height)) | ||
self.rightView = paddingView | ||
self.rightViewMode = .always | ||
} |
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.
์ง๊ธ์ width์ ๊ณ ์ ์ ์ธ ๊ฐ์ ์ฌ์ฉํ๊ณ ์๋๋ฐ, ํ๋ผ๋ฏธํฐ๋ก ์์น๋ฅผ ๋๊ฒจ์ค์ ์ฌ์ฉํ๋ฉด ์กฐ๊ธ ๋ ์ฌ์ฉ์ฑ์์ด์ง์ง ์์๊น ์๊ฐํฉ๋๋ค :-)
func addLeftPadding(_ padding: CGFloat) { ... }
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.
์์ค ๊ทธ๊ฒ๋ ์ ์ฉ!!ํ ๊ฒ์๐
import UIKit | ||
|
||
extension UILabel { | ||
func addSpacing(kernValue: Double, paragraphValue: CGFloat) { |
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.
ํ๋ผ๋ฏธํฐ์ ์๋ฏธ๊ฐ ๊ถ๊ธํฉ๋๋ค. ๐
์๊ทธ๋๋ ๋ผ๋ฒจ์์ ํ ๊ฐ๊ฒฉ์ ์ด๋ป๊ฒ ์กฐ์ ํ ์ง ๊ณ ๋ฏผํ๊ณ ์์๋๋ฐ, ์๊ฒ์ ์ฌ์ฉํ๋ฉด ๋๊ฒ ๊ตฐ์!?
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.
@Taehyeon-Kim ์๊ฐ, ํ๊ฐ ๊ด๋ จ ์ต์คํ ์ ์ธ๋ฐ ์ฌ์ค.. ์ ๋ ๊ณ ๊ฒ๊ณผ ๊ด๋ จํด์ ํน์ด ๋ฐ๋ ์ฐฐ๋์.. ์บ์น๋ฏธ ์ต์คํ ์ ์.. ์ ์ฉํด๋ฒ๋ ธ์ต๋๋ค...;;๐ฅฒ
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.
kernValue๋ ParagraphValue ๊ฐ์๊ฑด ์๋ง ์ฑ๋ด์์ ์คํ์ผ์ด 2,3๊ฐ๊ฑฐ๋ 1๊ฐ๋ก ํต์ผ๋์ด์์ํ ๋ฐ - ํ๋ผ๋ฏธํฐ ์์ฒด์ ๊ธฐ๋ณธ๊ฐ์ ์ค๋ ๊ด์ฐฎ์๊ฑฐ๊ฐ์์!!
func addSpacing(kernValue : Double = -0.05, paragraphValue : CGFloat = (๊ธฐ๋ณธ๊ฐ) { โฆ}
sampleLabel.addSpacing()
์๋๋ฉด ์ฐ๋ฆฌ๊ฐ Letter Spacing -0.5%, Line Spacing 1.1.. ๋ช์ด๋ค ๋ช์ด๋ค ์ผ์ผ์ด ํ์ธํ๊ณ ์ธ์ฐ๊ธฐ๋ ๊ท์ฐฎ์ผ๋๊น์... (ํด๋จผ์๋ฌ๋ก ํ๋ฆด์๋ ์๊ณ !)
๋์ค์ ์ค์ ํ๋ก์ ํธ ๊ฐ์๋ ๋ฌธ๋งฅ๋ง๋ค Headline / Subtitle/ Body/ ๋ฑ๋ฑ ํฌ๊ฒ ๋ช๊ฐ์ง๋ก๋ง ๋๋ ํ ๋ฐ ๊ฑฐ๊ธฐ ๊ฐ๋ค์ ๋ฏธ๋ฆฌ ์ ์ฅํด์ ๋น ๋ฅด๊ฒ ๋ผ๋ฒจ ์ธํ ํ๋๊ฒ๋ ์ข์๊ฑฐ๊ฐ์์!
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.
@i-colours-u ์ค ๊ทธ๋ฌ๋ค์ ! ๋ฐ๋ก ์ ์ฉํ ๊ฒ์!!! ๐๐
|
||
import UIKit | ||
|
||
class CustomButton: UIButton { |
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.
CustomButton ํด๋์ค๋ ๋ฐฐ๊ฒฝ์์ด ์๋ ๋ฒํผ์ ํด๋นํ๋ ๋์ธ๋ฐ,, ๊ทธ๋ฅ ๊ธ์๋ง ์๋ ๋ฒํผํํ ์ ์ฉ์ ํ์ง ๋ชปํ๋ค๋...
๊ทธ๋ ๋ค๊ณ ๊ฑ ๊ณ ๋ ํด๋์ค์ ํด๋นํ๋ ์ธ์คํด์ค๋ฅผ ๋งน๊ทธ๋ฌ์ฃผ์ํ๋... ์ฝ๋ ๊ธธ์ด๋ ๊ฑฐ๊ธฐ์ ๊ฑฐ๊ธฐ์ธ์ง๋ผ...
์ฐ์ ์ด๊ฒ์ด ์ ๋ต์ ์๋๋ ์ฐธ๊ณ ๋ง ํด์ฃผ์๊ธฐ ๋ฐ๋๋๋ค. ์ข ๋ ์ฌ์ฌ์ฉ์ฑ์ ๋์ด๊ณ ์ถ๋ค๋ฉด, ์๋ฅผ ๋ค์ด ๋ฐฐ๊ฒฝ์์ด ์๊ณ ์๊ณ ๋ฅผ ์กฐ์ ํ๊ณ ๊ทธ ๋ฐ์ ์ค์ ์ ์ธ๋ถ์์ ์กฐ์ ํ๊ณ ์ถ๋ค๋ฉด ์ด ์ปค์คํ ํด๋์ค(CustomButton)์ ํ๋กํผํฐ๋ฅผ ๋ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
var backgroundColor: UIColor? = .clear {
didSet {
updateUI()
}
}
private func updateUI() {
self.backgroundColor = backgroundColor
}
์ด๋ฐ ๋๋์ผ๋ก didSet ํ๋กํผํฐ์ ๊ฐ์ด ์ฌ์ฉํ๋ฉด backgroundColor์ ๊ฐ์ ๋ณ๊ฒฝํ์ ๋ ์์์ด ์ ๋ฐ์ดํธ ๋๊ฒ ์ฃ ?
์ถ๊ฐ์ ์ผ๋ก ์ด๋์ ๋ผ์ด์ ๋ฅผ ์ด์ฉํด์ ์ธ๋ถ์์ ์ธ์คํด์ค๋ฅผ ์์ฑํ ๋ ์์ background ์์์ ์ง์ ํด์ค ์๋ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
convenience init(backgroundColor: UIColor) {
self.backgroundColor = backgroundColor
}
๋ค์์ ๊ฒ๋ค์ ์ด์ฉํด์ ์กฐ๊ธ ๋ ์์ ๋ ๋์ ์ฝ๋๋ฅผ ์์ฑํ ์ ์์ ๊ฒ ๊ฐ์์ :-)
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.
์ ๋ฐฐ๋ ์์ผ๋ก ๋ฐ๋ค์ด ๋ชจ์๊ฒ ์ต๋๋ค. ๊ทธ๋ฌ๋ ์์ฃผ ์์ ์ฝ๋ฆฌ๋ฅผ ๋ฌ์์ฃผ์๊ธธ.
private let completeButton = CustomButton().then { | ||
$0.setTitle("ํ์ธ", for: .normal) | ||
$0.setTitleColor(.white, for: .normal) | ||
$0.titleLabel?.font = .boldSystemFont(ofSize: 18) | ||
$0.backgroundColor = .mainBlue | ||
$0.layer.cornerRadius = 10 | ||
$0.isUserInteractionEnabled = true | ||
$0.addTarget(self, action: #selector(touchupCompleteButton(_:)), for: .touchUpInside) | ||
} |
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.
์ ์๋ฐ ๋๋ ๋๋ฌธ์ ๊ทธ๋ฐ๊ฑฐ๊ตฐ์..
ํ ๊ฐ์ง ๋ฐฉ๋ฒ์ด ๋ ์๊ฐ๋ฌ๋๋ฐ, ๋ฒํผ์ ๋ฐฐ๊ฒฝ์ ์๋ ๋ฒํผ๊ณผ ๋ฐฐ๊ฒฝ์ ์๋ ๋ฒํผ์ผ๋ก ์ฌ์ฉํ๋ค๊ณ ์น๋ฉด
์๋์ ๊ฐ์ด ์ด๊ฑฐํ์ ๋ง๋ค์ด์ฃผ๊ณ ๋ถ๊ธฐ ์ฒ๋ฆฌํด์ ์ค์ ์ ๋ค๋ฅด๊ฒ setํด์ค๋ ๊ด์ฐฎ์ ๋ณด์
๋๋ค.
// CustomButton.swift
enum ButtonType {
case Base
case Google
}
...
private func setupUI(_ type: ButtonType) {
if type == .Base {
// write code
} else if type == .Google {
// write code
}
}
// ์ด๋ ๊ฒ๋ ์ฌ์ฉ์ด ๊ฐ๋ฅํ์ง ์์๊น ์ถ๋ค์..?
private let completeButton = CustomButton().then {
$0.setupUI(.Base)
}
private func setNavigationController(title: String, | ||
unselectedImage: UIImage, | ||
selectedImage: UIImage, | ||
rootViewController: UIViewController) -> UINavigationController { | ||
let nav = UINavigationController(rootViewController: rootViewController) | ||
nav.tabBarItem.title = title | ||
nav.tabBarItem.image = unselectedImage | ||
nav.tabBarItem.selectedImage = selectedImage | ||
nav.navigationBar.isHidden = true | ||
return nav | ||
} | ||
} |
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.
์๋ ๊ฒ ํจ์๋ก ์ฒ๋ฆฌํ๋ ๊ฒ ์ข๋ค์ ๐
๋ฐ๋ณต์ฝ๋ ์ค์ด๊ธฐ ํผํํธโญ๏ธ
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.
์ ๋ ํ ๋ฒ์ ์ฒ๋ฆฌํ๋ ๋ฒ ์์๊ฐ์! ์งฑ์งฑ๐๐ป๐๐ป
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.
์ฝ๋ ๊น๋ํ๋ค์๐
import UIKit | ||
|
||
extension UILabel { | ||
func addSpacing(kernValue: Double, paragraphValue: CGFloat) { |
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.
kernValue๋ ParagraphValue ๊ฐ์๊ฑด ์๋ง ์ฑ๋ด์์ ์คํ์ผ์ด 2,3๊ฐ๊ฑฐ๋ 1๊ฐ๋ก ํต์ผ๋์ด์์ํ ๋ฐ - ํ๋ผ๋ฏธํฐ ์์ฒด์ ๊ธฐ๋ณธ๊ฐ์ ์ค๋ ๊ด์ฐฎ์๊ฑฐ๊ฐ์์!!
func addSpacing(kernValue : Double = -0.05, paragraphValue : CGFloat = (๊ธฐ๋ณธ๊ฐ) { โฆ}
sampleLabel.addSpacing()
์๋๋ฉด ์ฐ๋ฆฌ๊ฐ Letter Spacing -0.5%, Line Spacing 1.1.. ๋ช์ด๋ค ๋ช์ด๋ค ์ผ์ผ์ด ํ์ธํ๊ณ ์ธ์ฐ๊ธฐ๋ ๊ท์ฐฎ์ผ๋๊น์... (ํด๋จผ์๋ฌ๋ก ํ๋ฆด์๋ ์๊ณ !)
๋์ค์ ์ค์ ํ๋ก์ ํธ ๊ฐ์๋ ๋ฌธ๋งฅ๋ง๋ค Headline / Subtitle/ Body/ ๋ฑ๋ฑ ํฌ๊ฒ ๋ช๊ฐ์ง๋ก๋ง ๋๋ ํ ๋ฐ ๊ฑฐ๊ธฐ ๊ฐ๋ค์ ๋ฏธ๋ฆฌ ์ ์ฅํด์ ๋น ๋ฅด๊ฒ ๋ผ๋ฒจ ์ธํ ํ๋๊ฒ๋ ์ข์๊ฑฐ๊ฐ์์!
@@ -167,7 +159,7 @@ class SignUpVC: UIViewController { | |||
|
|||
FirebaseAuth.Auth.auth().createUser(withEmail: email, password: pw) { [self] (result, error) in |
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.
์ ๋ ์๊ฑด ์ข
์ข
๋นผ๋จน๋ ๋ถ๋ถ์ธ๋ฐ ใ
ใ
;;
strong reference cycle ๋ฐฉ์งํ๊ธฐ ์ํด์ ํด๋ก์ ์์๋
[self]
๋ง๊ณ [weak self]
๋ก ๋ฐ๊ฟ ์ฐ๋๊ฑธ ์ต๊ดํํ๋๊ฒ ์ข์๊ฑฐ๊ฐ์์!!
์๋๋ฉด ๋์ค์ SwiftLint๋ก ๊ฐ์ ์ฒ๋ฆฌํด๋ ์ข๊ตฌ์?!
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.
@i-colours-u ์ง๋ฌธ์ด ์๋๋ฐ ๊ทธ๋ฌ๋ฉด weak self๋ฅผ ์ฐ๊ณ
๋ด๋ถ์
guard let self = self else { return }
๋ฅผ ์จ์ค์ผ ํ๋์?
์๋ํ๋ฉด weak self๋ฅผ ์จ์ฃผ๋ ์๊ฐ ์ต์
๋ ์ฒ๋ฆฌ๋ฅผ ํด์ฃผ๋ผ๊ณ ์ค๋ฅ ๋ฉ์์ง๊ฐ ๋ด๊ฑฐ๋ ์.
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.
weak ์ฌ์ฉํ๊ฒ ๋๋ค๋ฉด guard let ์ผ๋ก ์ต์ ๋ ๋ฐ์ธ๋ฉ ์ฒ๋ฆฌํด์ ์งํํ๋ ํธ์ด ๊ถ์ฅ๋ ๊ฑฐ์์!!
@@ -167,7 +159,7 @@ class SignUpVC: UIViewController { | |||
|
|||
FirebaseAuth.Auth.auth().createUser(withEmail: email, password: pw) { [self] (result, error) in |
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.
์ฌ๊ธฐ ์ฝ๋๋ง ์๋๋ผ ๋์ค์ ๋น๋๊ธฐ์ฒ๋ฆฌ,ํต์ ์์
ํ ๋
(result,error) in ๊ณผ ๊ฐ์ ํํ๋ก ๋ง์ด ์์ฑํ๊ฒ ๋ ํ
๋ฐ์ฌ
- result error : true,false,
- result error : true, true
- result error : false, true
- result error : false , false
์๋ ๊ฒ ๋ด๋ ค์ค๋ result/error์ ๋ํด ์ผ์ด์ค๊ฐ ์ด 4๊ฐ๊ฐ๋ฐ์ ํ ์ ์๊ฒ ๋ฉ๋๋ค
์ฌ์ค ์ฐ๋ฆฌ๊ฐ ๋งค๋ฒ ๊ณ ๋ คํ๋๊ฑด ์ฑ๊ณต์ด๋, ์คํจ๋๋ฅผ ๊ตฌ๋ถํ๊ธฐ ๋๋ฌธ์ 1,3๋ฒ ์ผ์ด์ค์ ๋๋ง ๊ณ ๋ คํ๊ฒ ์ง๋ง -
2๋ฒ 4๋ฒ๊ณผ ๊ฐ์ด ์ ๋งคํ ์ํ๊ฐ ๋๋ ๊ฒ(์๋ฌ๊ฐ ๋ฐ์ํ๋ฉด์ ๋ฐ์ดํฐ๊ฐ ๋์ด์ด, ์๋ฌ๊ฐ ๋ฐ์ํ์ง๋ ์๊ณ , ๋ฐ์ดํฐ๋ ์๊ณ )๋ ์๋๋ ๊ณ ๋ ค๋ฅผ ํด์ผํ๋ ์ํฉ์ด ์์๊ฑฐ์์
๊ทธ๋์ ์ผ์ผ์ด ๋ค ๋ถ๊ธฐ์ฒ๋ฆฌ ํ๊ธฐ๋ณด๋ค๋
Swift5 ์์ ๊ธฐ๋ณธ์ ์ผ๋ก ์ ๊ณตํ๋
Result<Value,Error>๋ฌธ๋ฒ์ ํ์ฉํ๋ฉด ๋ ๊น๋ํ๊ฒ ์์ฑ์ด ๊ฐ๋ฅํ ๊ฒ ๊ฐ์์!!
func auth(then handler: @escaping (Result<Data?,Error>) -> Void) {
// ํ์ํ ๋ถ๋ถ์ handler ์ ๋ด์์ escaping์ผ๋ก ๋๊ฒจ์ฃผ๊ธฐ
}
auth { [weak self] result in
result.success { data in
// ์ฑ๊ณตํ์ ๋ ~~ ์ฒ๋ฆฌ
}.catch { error in
// ์๋ฌ ๋ฐ์ํ์๋ ~~ ์ฒ๋ฆฌ, ํ์์ ๋ฐ๋ผ ์๋ฌ ๋ถ๊ธฐ์ฒ๋ฆฌํ๊ธฐ
}
}
extension Result {
@discardableResult
func success(_ successHandler: (Success) -> Void) -> Result<Success, Failure> {
if case .success(let value) = self {
successHandler(value)
}
return self
}
@discardableResult
func `catch`(_ failureHandler: (Failure) -> Void) -> Result<Success, Failure> {
if case .failure(let error) = self {
failureHandler(error)
}
return self
}
}
(์๊ฑฐ๋ ์์ Result ๊ฒฐ๊ณผ๋ฅผ success, catch ํํ๋ก ๊ฐ๊ฒฐํ๊ฒ ์ฒ๋ฆฌํ๊ธฐ ์ํด ์ฌ์ฉํ๋ Extension ์ ๋๋ค!!)
์ฌ์ค ์ง๊ธ๊ฐ์ด ๊ฐ๋จํ ํต์ ์ผ๋๋ ํฌ๊ฒ ์๊ด์๊ฒ ์ง๋ง, ์ดํ์ ๊ณ์ ํด๋น ์ฝ๋๋ฅผ ์์ฑํ ๋ ๋ค์๊ณผ ๊ฐ์ด Result ๋ฌธ์ ํ์ฉํ๋ฉด ์ฑ๊ณต/์คํจ์ ๋ํด์๋ง ๊ณ ๋ คํ ์ ์๊ธฐ ๋๋ฌธ์ ๋ ์์ ํ๊ฒ,์ง๊ด์ ์ผ๋ก ์์ฑ์ด ๊ฐ๋ฅํ ๊ฒ ๊ฐ์์!!!
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.
์จ๋ฐฐ์ผ ๊ณ ์ํ์ค ์ฝ๋๊ตฌ์ฐ์ฐ์ฐ์
static let Description = "YouTube๋ ์ด๋ํ๋ฉฐ ๊ณ์ํ์ธ์. ์ฑ ๋ฐ Safari์์๋ Google ์๋น์ค์ ๋ก๊ทธ์ธ๋ฉ๋๋ค." | ||
static let Description = "YouTube๋ ์ด๋ํ๋ฉฐ ๊ณ์ํ์ธ์.\n์ฑ ๋ฐ Safari์์๋ Google ์๋น์ค์ ๋ก๊ทธ์ธ๋ฉ๋๋ค." | ||
} | ||
|
||
struct Image { | ||
static let check = UIImage(systemName: "checkmark.square.fill") | ||
static let uncheck = UIImage(systemName: "square") | ||
static let logo = UIImage(named: "logo") | ||
static let homeFill = UIImage(named: "homeIconFill") | ||
static let home = UIImage(named: "homeIcon") | ||
static let shortsFill = UIImage(named: "shortsIconFill") | ||
static let shorts = UIImage(named: "shortsIcon") | ||
static let plueCircle = UIImage(named: "plueCircleIcon") | ||
static let subscribeFill = UIImage(named: "subscriptionsIconFill") | ||
static let subscribe = UIImage(named: "subscriptionsIcon") | ||
static let libraryFill = UIImage(named: "LibraryIconFill") | ||
static let library = UIImage(named: "LibraryIcon") |
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.
ํผ๊ฐ์~๐งก
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.
๊ทธ.... ์ ๋ง...๊ถ๊ธํด์ ์ง๋ฌธํฉ๋๋ค...!
์์ด์ฝ๋ค์ ๋ฐ๋ก ํ์ผ์ ๋ง๋ค์ด์ ๊ตฌ์กฐ์ฒด์ ๋ฃ์ด์ ์ฐ๋ฉด ์ธ์ ์ด๋ป๊ฒ ์ข์์ง ๊ถ๊ธํฉ๋๋ค.....!
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.
@hellozo0 ์ ๋ณต์กํ ์์ด์ฝ ํ์ผ๋ช
์ ๋งค๋ฒ ์ฐ์ง ์์๋ ๋๊ณ ๋ณต๋ถํด์ ๊ฐ์ ธ๋ค ์ฐ๋ ๊ฒฝ์ฐ ๊ฐํน๊ฐ๋ค๊ฐ ์คํ๊ฐ ๋๋ ๊ฒฝ์ฐ๋ ์์ด์.
๊ทธ๋ด ๊ฒฝ์ฐ ์ฑ์ด ํฌ๋์๊ฐ ๋๋๋ฐ ์๋ก ๋ฌธ์ ๋ค์ ๋ฐฉ์งํ ์ ์์ด์ ์๋๋ค!
๋ ๋ง์ฝ checkmark ์ด๋ฏธ์ง ์์
์ ์ด๋ฆ์ด ๋ฐ๋์๋ค๊ณ ํ๋ฉด ๋ชจ๋ ํ์ผ์ ๋ค์ด๊ฐ์ ํ๋ํ๋ ๋ฐ๊ฟ์ผ ํ๋ ๋ฒ๊ฑฐ๋ก์์ด ์๋๋ฐ
Constants๋ก ๋ง๋ค์ด๋๋ฉด ํ ๋ฒ๋ง ๋ฐ๊ฟ ๋๊ฒ ์ ธ? ๊ณ ๋ฐ ์ฅ์ ...์ฐ..?
์ฌ์ค ์ ๋ ์ด์ ๋ง ์ฐ๊ธฐ ์์ํ์ด์!!
func addColor(font: UIFont, range: String) { | ||
if let labelText = text, labelText.count > 0 { | ||
let attributedStr = NSMutableAttributedString(string: labelText) | ||
attributedStr.addAttribute(.font, | ||
value: font, | ||
range: (labelText as NSString).range(of: range)) | ||
attributedText = attributedStr | ||
} |
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.
์ฝ์ฅ..ํด๊ฐ๋๋ค ><
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.
์๊ฒ ์ด๋ค ์ญํ ์ ํ๋ ํจ์์ธ์ง ์ดํด๊ฐ ์๊ฐ์,, ์ค๋ช ํ๋ฒ๋ง ํด์ฃผ์ธ์ฌ,,,
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.
@jane1choi ์ ๋ ์ฝ๋ ๋ณด๋๊น ์ ํจ์๋ฅผ ์ฐ์ง ์์์ ์ ๋ฃ์ด์คฌ๋์ง ์ ๋ ์๋ฌธ์ด์ง๋ง..;;
๊ฒ๋ค๊ฐ ํจ์ ์ด๋ฆ๋ ์๋ชป ์จ๋จ๋ค์;; ์ง์ง ์ ์จ์คซ์ง..??? ๋นผ์ผ๊ฒ๋น...
NSMutableAttributedString
์ ํ
์คํธ์ ํน์ ๋ถ๋ถ์ ์์ด๋ ๊ธ์ ํฌ๊ธฐ, ํฐํธ ๋ฑ์ ํน์ฑ์ ๋ฐ๊ฟ์ค ๋ ์ฌ์ฉํ๋ ๋ฉ์๋์์.
//๋ด๊ฐ ์ ์ฉํ๊ณ ์ถ์ ํฐํธ ์ฌ์ด์ฆ
let fontSize = UIFont.boldSystemFont(ofSize: 30)
//label์ ์๋ Text๋ฅผ NSMutableAttributedString์ผ๋ก ๋ง๋ค์ด์ค๋ค.
let attributedStr = NSMutableAttributedString(string: myLabel.text)
//์์์ ๋ง๋ attributedStr์ addAttribute๋ฉ์๋๋ฅผ ํตํด Attribute๋ฅผ ์ ์ฉ. kCTFontAttributeName์ value๋ก ํฐํธํฌ๊ธฐ์ ํฐํธ๋ฅผ ๋ฐ์ ์ ์์.
attributedStr.addAttribute(.foregroundColor, value: UIColor.blue, range: (text as NSString).range(of: "Zedd"))
//์ต์ข
์ ์ผ๋ก ๋ด label์ ์์ฑ์ ์ ์ฉ
myLabel.attributedText = attributedStr
์๋ ์ฌ์ง์ฒ๋ผ ๋์ค๊ฒ ๋ฉ๋๋น.!
์ถ์ฒ: https://zeddios.tistory.com/300 [ZeddiOS]
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.
ํ๋ฆ์จ๋ฐฐ ๋ฉ์์๋...?
static let Description = "YouTube๋ ์ด๋ํ๋ฉฐ ๊ณ์ํ์ธ์. ์ฑ ๋ฐ Safari์์๋ Google ์๋น์ค์ ๋ก๊ทธ์ธ๋ฉ๋๋ค." | ||
static let Description = "YouTube๋ ์ด๋ํ๋ฉฐ ๊ณ์ํ์ธ์.\n์ฑ ๋ฐ Safari์์๋ Google ์๋น์ค์ ๋ก๊ทธ์ธ๋ฉ๋๋ค." | ||
} | ||
|
||
struct Image { | ||
static let check = UIImage(systemName: "checkmark.square.fill") | ||
static let uncheck = UIImage(systemName: "square") | ||
static let logo = UIImage(named: "logo") | ||
static let homeFill = UIImage(named: "homeIconFill") | ||
static let home = UIImage(named: "homeIcon") | ||
static let shortsFill = UIImage(named: "shortsIconFill") | ||
static let shorts = UIImage(named: "shortsIcon") | ||
static let plueCircle = UIImage(named: "plueCircleIcon") | ||
static let subscribeFill = UIImage(named: "subscriptionsIconFill") | ||
static let subscribe = UIImage(named: "subscriptionsIcon") | ||
static let libraryFill = UIImage(named: "LibraryIconFill") | ||
static let library = UIImage(named: "LibraryIcon") |
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.
๊ทธ.... ์ ๋ง...๊ถ๊ธํด์ ์ง๋ฌธํฉ๋๋ค...!
์์ด์ฝ๋ค์ ๋ฐ๋ก ํ์ผ์ ๋ง๋ค์ด์ ๊ตฌ์กฐ์ฒด์ ๋ฃ์ด์ ์ฐ๋ฉด ์ธ์ ์ด๋ป๊ฒ ์ข์์ง ๊ถ๊ธํฉ๋๋ค.....!
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.
์ฝ๋๋ฆฌ๋ทฐ ๋ ๋ฆ๊ฒ ๋จ๊ฒจ์ ์ฃ์กํด์ฌ..
์ด๋ฒ ์ฃผ๋ ์๋ฐฐ ์ฝ๋๋ณด๊ณ ๋ฐ๋ณต๋๋ ์ฝ๋ ์ค์ด๋ ๋ฐฉ๋ฒ๊ณผ ์ข์ ๋ค์ด๋ฐ์ ๋ํด ๋๋ ๋ฐฐ์๊ฐ๋๋ค
๊ณ ์๋ง์ผ์
จ์ด์๐๐
func addColor(font: UIFont, range: String) { | ||
if let labelText = text, labelText.count > 0 { | ||
let attributedStr = NSMutableAttributedString(string: labelText) | ||
attributedStr.addAttribute(.font, | ||
value: font, | ||
range: (labelText as NSString).range(of: range)) | ||
attributedText = attributedStr | ||
} |
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.
์๊ฒ ์ด๋ค ์ญํ ์ ํ๋ ํจ์์ธ์ง ์ดํด๊ฐ ์๊ฐ์,, ์ค๋ช ํ๋ฒ๋ง ํด์ฃผ์ธ์ฌ,,,
} | ||
|
||
@objc func touchupLogoutButton(_ sender: UIButton) { | ||
do { // ๋ก๊ทธ์์ | ||
@objc func touchupAnotherAccountButton(_ sender: UIButton) { |
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.
๋ค์ด๋ฐ ๋ฐฐ์๊ฐ๋๋ค..๐๐ป
private func setNavigationController(title: String, | ||
unselectedImage: UIImage, | ||
selectedImage: UIImage, | ||
rootViewController: UIViewController) -> UINavigationController { | ||
let nav = UINavigationController(rootViewController: rootViewController) | ||
nav.tabBarItem.title = title | ||
nav.tabBarItem.image = unselectedImage | ||
nav.tabBarItem.selectedImage = selectedImage | ||
nav.navigationBar.isHidden = true | ||
return nav | ||
} | ||
} |
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.
์ ๋ ํ ๋ฒ์ ์ฒ๋ฆฌํ๋ ๋ฒ ์์๊ฐ์! ์งฑ์งฑ๐๐ป๐๐ป
@@ -46,7 +44,7 @@ class SignUpVC: UIViewController { | |||
$0.setTextField(placeholder: "๋น๋ฐ๋ฒํธ ์ ๋ ฅ", secure: true) | |||
} | |||
|
|||
lazy var showButton = UIButton().then { | |||
private lazy var showButton = UIButton().then { |
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.
lazy ํค์๋๋ ์ธ์ ์ฐ๋ ๊ฒ์ธ์ง..๐ค ์ค๋ช ํด์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค ์จ๋ฐฐ..
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.
์ฌ์ค ์ ๋ lazy var์ ์์ฃผ ์ฌ์ด๊ฐ ์นํ ๊ฒ์ด ์๋๋ผ ์ฌ๊ธฐ์ ๊ธฐ์ ๊ฐ๊ฒจ๋ณด๋ฉฐ ํผ์ ์นํ ์ฒ ์ข ํ๋ ์ค์ด๊ธด ํ๋ฐ...
๊ทธ๋๋ ๊ฐ๊ฒจ๋ณด์๋ฉด...
lazy var
๋ ๋ชจ๋ ๋ทฐ๊ฐ ๋ค ์์ฑ(์ด๊ธฐํ)๋๊ณ ๋์ ๋ถ๋ฆฌ๋ ๋ณ์์ฌ์.
๊ทธ๋ฌ๋๊น ๋น์ฅ ํ์ํ์ง ์์ผ๋ฉด ์์ฑ๋์ง ์๊ณ ํธ์ถ์ ํด์ค์ผ๋ง ์์ฑ์ด ๋๊ธฐ ๋๋ฌธ์ ์ฃผ๋ก ๊ฐ์ฅ
์ ๊ธฐ showButton, fieldStackView ์๋ ๊ตณ์ด ์ธ ํ์ ์๋๋ฐ ์จ ๋ณธ ๊ฒ์ด๊ตฌ
์ธ์ ์ฌ์ฉํ๋๋ฉด
https://www.notion.so/huree-can-do-it/1-4697482733f246c98b2b7711d2e71859#7af5fe5b971d4bc5b46e054b35e42e5c
์๊ธฐ ์ฐธ๊ณ ํด๋ณด์ผ๋ผ~^^
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.
Extension์ ์ฌ์ ๋ฃจํฌ์ธ๋ ์ฝ๋ ์ ๋ณด๊ณ ๊ฐ์ฅ๐ ๋๋ ์ธ์ ๊ฐ ์ต์คํ ์ ์ ์ฐ๊ฒ๋๋ ๋ ์ด ์ค๊ธธใ ใ ใ
@nonobjc class var mainBlue: UIColor { | ||
return UIColor(red: 66/255.0, green: 133/255.0, blue: 244/255.0, alpha: 1.0) | ||
} | ||
|
||
@nonobjc class var lineGray: UIColor { | ||
return UIColor(white: 234.0 / 255.0, alpha: 1.0) | ||
} |
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.
non์ ๋ถ์ฌ์ผํ๋์ฉ,.? objc๋ ์๋๋๊ฑด๊ฐ์ ๊ถ๊ธํฉ๋๋ค!
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.
์ ๋ ๊ถ๊ธํด์ ์ฐพ์๋ดค๋๋ฐ
@nonobjc
๋ ๋ช
์์ ์ผ๋ก ์ปดํ์ผ๋ฌ๊ฐ ํด๋น ์ฝ๋๋ฅผ Objective-C๋ก ๋ณํํ๋๊ฑธ ๋ง๊ณ ,
@objc
๋ ๋ช
์์ ์ผ๋ก ์ปดํ์ผ๋ฌ๊ฐ ํด๋น ์ฝ๋๋ฅผ Objective-C๋ก ๋ณํํ๋๋ก ํด์ค๋์.
๋ณดํต ์ ์๋ฅผ ์ฌ์ฉํ๋ ์ด์ ๋ swift์์๋ง ์ก์ธ์คํ ์ ์๊ฒ ํ ๋ ๋ผ๋๋ฐ
๊ตณ์ด @nonobjc
๋ @objc
๋ฅผ ์ ๋ถ์ฌ๋ ๋ ๊ฑฐ ๊ฐ๋ค๋ ์๊ฐ์ด ๋๋ค์... ๋์ ์ public
์ ๋ถ์ฌ๋ ์ข์ ๊ฒ ๊ฐ์์.
๊ทธ๋ฌ๋ฉด ์ ๋ถ์๋?!!!
๊ทธ๊ฑด...๊ทธ๋์ ์ ํ๋ฆฐ์์ ์ฝ์ฅ ์์ ์ถ์ถํ๋ฉด ์ ๋ ๊ฒ ๋ณดํต ์ฝ๋๊ฐ์ด ๋์์ ๊ธ์ด์๋ ๋ฒ๋ฆ์ด ์์ด์..
@objc func touchupLogoutButton(_ sender: UIButton) { | ||
do { // ๋ก๊ทธ์์ | ||
@objc func touchupAnotherAccountButton(_ sender: UIButton) { | ||
do { | ||
try FirebaseAuth.Auth.auth().signOut() | ||
guard let pvc = presentingViewController as? UINavigationController else { return } | ||
self.dismiss(animated: true) { |
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.
๋ก๊ทธ์์ ํจ์ ๋ณด๊ณ ๋ฐฐ์๊ฐ๋๋น..!
@@ -18,31 +18,28 @@ class LoginVC: UIViewController { | |||
// MARK: - Properties | |||
fileprivate var currentNonce: String? |
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.
์ด๊ฑด ์ด๋ค๊ฑด๊ฐ์ฉ?
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.
์ ์๊ฑฐ๋ ๋ฐ๋ก ์คํฐ๋ํ๋ฉด์ ํ์ด์ด๋ฒ ์ด์ค๋ก ์ ํ๋ก๊ทธ์ธ์ ๊ตฌํํด์ฃผ๋ ค๊ณ ์ ์ธํด์ค ๊ฑด๋ฐ
nonce ๋ผ๋ ๊ฒ ์์๋ก ์์ฑ๋๋ ์ํธํ ํ ํฐ์ผ๋ก ์ฌ์ ๊ณต๊ฒฉ์ ๋ฐฉ์งํ๋ ๋ฐ ์ฌ์ฉํ๋๋ฐ
๋งค๋ฒ ์ ํ๋ก๊ทธ์ธ ์์ฒญ ์์ nonce๋ฅผ ์์ฑํด์ ๋ณด์์ ํด์ค๋ค๊ณ ํด์.
์ด currentNonce
๋ฅผ ๊ทธ ์ญํ ์ ํ๊ฒ ํด์ฃผ๋ ค๊ณ ๋ง๋ค์์ต๋๋ค. ์ฌ์ค ํ๋ฒ ๋ํ๋จผํธ์์ ๊ทธ๋ ๊ฒ ํ๋ผ๊ณ ํ๊ธธ๋ ๊ธ์ด์์ด์ฌ..ใ
ใ
private func setNavigationController(title: String, | ||
unselectedImage: UIImage, | ||
selectedImage: UIImage, | ||
rootViewController: UIViewController) -> UINavigationController { | ||
let nav = UINavigationController(rootViewController: rootViewController) | ||
nav.tabBarItem.title = title | ||
nav.tabBarItem.image = unselectedImage | ||
nav.tabBarItem.selectedImage = selectedImage | ||
nav.navigationBar.isHidden = true | ||
return nav | ||
} | ||
} |
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.
์ฝ๋ ๊น๋ํ๋ค์๐
๐ ๊ด๋ จ ์ด์
close #6
๐ ๋ณ๊ฒฝ ์ฌํญ ๋ฐ ์ด์
2์ฐจ ์ธ๋ฏธ๋ ๊ณผ์ ์๋ฃ์ ๋๋ค~!
๐ PR Point
CustomButton์ ์ปดํฌ๋ํธ๋ก ๋ฐ๋ก ๋นผ์ ๋ง๋ค์ด ์ค ๊ฑธ ๋ง์ด ๋ด์ ํ ๋ฒ ๋ฐ๋ผ์ ๊ตฌํํ๋ ค๊ณ ํด๋ดค๋๋ฐ ์๊ฐ๋ณด๋ค ์ ์ฉํ๊ฒ ์ด ๊ฒ ๊ฐ์ง ์์์ ๊ณ ๋ถ๋ถ ์ค์ ์ ์ผ๋ก ๋ด์ฃผ์๋ฉด ์ข๊ฒ ์ต๋๋ค!
CustomButton ํด๋์ค๋ ๋ฐฐ๊ฒฝ์์ด ์๋ ๋ฒํผ์ ํด๋นํ๋ ๋์ธ๋ฐ,, ๊ทธ๋ฅ ๊ธ์๋ง ์๋ ๋ฒํผํํ ์ ์ฉ์ ํ์ง ๋ชปํ๋ค๋...
๊ทธ๋ ๋ค๊ณ ๊ฑ ๊ณ ๋ ํด๋์ค์ ํด๋นํ๋ ์ธ์คํด์ค๋ฅผ ๋งน๊ทธ๋ฌ์ฃผ์ํ๋... ์ฝ๋ ๊ธธ์ด๋ ๊ฑฐ๊ธฐ์ ๊ฑฐ๊ธฐ์ธ์ง๋ผ...
์ ๋ฒ์ private ๊ด๋ จ ์ง๋ฌธ์ ๋ํ ๋ต๋ณ์ ํ ๋๋ก ์ ๊ทผ์ ํ์?๋ฅผ ์ ์จ์ฃผ๋ ค๊ณ ํ๋๋ฐ ์ด๋ค์ง...
์ง๊ธ ํ์ฌ ์ด ์ฝ๋์์ ์ด๋ป๊ฒ ํด์ผ ๋ ์ํ๋ค๊ณ ์๋๋ค ์๋ค์ค์ด๋ ์๋ฐฐ๋คํํ ๊น์ง ์๋ฌธ์ด ๋ ์ ์์๊น??? ๋น๋ฒ ์ ์ ๋ถํ ๋ฐ๋..^^๐ค ๐ฌ
์! ๋๋ ์ฝ๋ ๋ ์์ง๊ณ ์ถ๋ค!!!!!!!!
๐ ์ฐธ๊ณ ์ฌํญ
๐๐์ง๋ฌธ ๋ฐ ์ง์ ๋ํ์๐๐