-
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/#2 #3
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.
๊ณ ์ํ์ ง์ด๋๋ค
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.
์ฝ๋ ์์ฒญ ๊น๋ํ๊ฒ ์ง์ ๊ฒ ๊ฐ๊ณ ๋ณ์๋ช , ํ์ผ๋ช ์ง๋ ๋ฒ์ ๋ํด์๋ ๋ฐฐ์๊ฐ๋๋ค!
make.width.equalTo(80) | ||
make.height.equalTo(50) | ||
} | ||
} |
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.
2์ฃผ์ฐจ์ ์๋ง ์คํ ๋ฆฌ๋ณด๋๋ก ์คํ ๋ ์ด์์ ๊ฐ๊ธฐ๋ ๋ฒ์ ๋ฐฐ์ธ ๊ฒ์
๋๋ค๋ฆ..
์ค๋
ํท์ผ๋ก๋ ํ ์ ์์ง๋ง ์ค๋ณด๋ก๋ ์ถฉ๋ถํ ํ ์ ์๋ค!!
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.
Snapkit ์ฒ์๋ณด๋ ์ฉ์ด์ธ๋ฐ ์คํ ๋ ์ด์์ ์ ์ฉ์ ์ ๋ ๊ฒ ํ ์ ์๊ตฐ์ฉ..์ฝ๋๋ก ์ ์ฉํ๋๊น ์์ ํ๊ธฐ ๋ ํธํด๋ณด์ฌ์!
signInButton.isUserInteractionEnabled = true | ||
signInButton.backgroundColor = .mainBlue | ||
} | ||
} |
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.
trimmingCharacters๋ ๋ญ๊น์?? ์์ฒญ ๊น๋ํ๊ฒ ๊ตฌํ๋๋ค์,,
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.
https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=traeumen927&logNo=221233934563
์ฌ๊ธฐ ์ด ๋งํฌ์ ์ข ์์ธํ๊ฒ ์ค๋ช
์ด ๋์์๋๋ฐ
์ฌ๊ธฐ ์๋ ์ฌ์ง์ ๋์์๋ ๊ฒ์ฒ๋ผ white~ ๋จธ์๊ธฐ๋ ๊ฐ์ด ์ฐ๋ฉด ๋ฌธ์์ด๊ณผ ๊ฐ์ด ์๋ ๊ณต๋ฐฑ์ ์ ๊ฑฐํด์ค์ฉ!!
๊ทธ๋์ ๊ณต๋ฐฑ์ ์
๋ ฅํด๋ ๋ค์ ๋ฒํผ์ด ํ์ฑํ๋์ง ์๊ฒ ํ๋ ค๊ณ ์จ์คฌ์ด์ฌ!
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.
์ ๋ ์ ๋ ฅ๋ง ์๊ฐํ๊ณ ๊ณต๋ฐฑ ์๊ฐ ๋ชปํ๋๋ฐ ๊ณต๋ฐฑ ์๊ฐํ์ ์ ๋๋ฌด ์ข์์. ๋์ณค๋ ์๊ฐ์ธ๋ฐ ์์๊ฐ๋๋ค!
configShow.baseBackgroundColor = .clear | ||
configShow.imagePlacement = .leading | ||
configShow.imagePadding = 10 | ||
} |
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.
์ด๊ฑฐ๋ iOS15์์ ์๋ก ๋์จ ๋ฒํผ๊ณผ ๊ด๋ จ๋ ํจ์์ธ๋ฐ ์์ธํ ๊ฑด https://www.notion.so/SOPT-1-620e04ad885048968aa3b60a81bd5b35#3577ea3858774b5b9fb66939303f3d3f ์ฌ๊ธฐ๋ฅผ ์ฐธ๊ณ ํด์ฃผ์ธ์ด
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.
์์ ConfigurationUpdateHandler ์๊ฑฐ ์์ฐ๋ฉด ์ฆ๋งฌ ์ ์ฉํ ๊ฒ ๊ฐ์์!! ์ ์ฐธ๊ณ ํ๊ฒ ์ต๋๋น ๊ฐ์ฌํด์~!~!
} else { | ||
pwTextField.isSecureTextEntry = 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.
๋๋ชจ ๊น๋ํ๋ค์,,์งฑ์ด์์
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.
ํ๋ฆฅ. ๊ฐ์ฌํฉ๋๋น.. ๐ตโ๐ซโค๏ธ
1 )private์ ์ธ์ ์จ์ฃผ๋ ๊ฑด์ง ์ฌ์ค ์ ๋ชจ๋ฅด๊ฒ ๋ค์. --> ์๊ฑด ํด๋น ํ์ผ๋ด์์ ๋์ํ๋ ๋ฉ์๋๋ ํ๋กํผํฐ๋ผ๋ฉด ์ ๋ถ ๋ค private๋ก ์ฒ๋ฆฌํด์ฃผ๋๊ฒ ๋ง์์!! 2 ) lazy var๋ ์ฌ์ค ์ข ๋ชจ๋ฅด๊ฒ ๋๋ฐ ํญ์ ์๋ฆฌ๊น๋ฆฌํ ๋ถ๋ถ. 3 ) ์ด๋ป๊ฒ ํ๋ฉด ๋ฐ๋ณต๋๋ ์ฝ๋๋ค์ ๊ฐ๊ฒฐํ๊ฒ ์ค์ผ ์ ์์๊น์? |
guard let name = nameTextField.text, | ||
let email = emailTextField.text, | ||
let pw = pwTextField.text else { | ||
return | ||
} |
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.
guard๋ฌธ ํ์ฉํ๊ฑฐ ์ข๋ค์ฌ ๐๐ป
func setTextField(placeholder: String, secure: Bool) { | ||
self.placeholder = placeholder | ||
self.isSecureTextEntry = secure |
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.
isSecureTextEntry๊น์ง ๊ฐ์ด ํด์ฃผ๋ ์ฌ์ธํจ ์ข๋ค์.... ๊ฐ๋๋ฐ์์ต๋๋ค...
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 showButton = UIButton(configuration: configShow, primaryAction: nil).then { | ||
$0.addTarget(self, action: #selector(touchupShowButton(_:)), for: .touchUpInside) | ||
$0.configurationUpdateHandler = { btn in | ||
var config = btn.configuration | ||
config?.image = btn.isSelected ? UIImage(systemName: "checkmark.square.fill") : UIImage(systemName: "square") | ||
btn.configuration = config |
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.
๋ฒํผ์ ๋ํด์ configuration ๊ฐ์ ธ์์ ์ํ์ ๋ฐ๋ผ ์ด๋ฏธ์ง ์ฒ๋ฆฌํ๋๊ฑฐ ์ข๋ค์!!! ๋์ค์ iOS15์ ์ฐฉ๋๋ฉด ์ ๊ทน์ ์ผ๋ก ํ์ ๋ด์์ ํ์ฉํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์ !!!! ๐๐ป๐๐ป๐๐ป
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.
๊ทธ๋๊น์ ์ด๋ฒ์ ์ฒ์ ์จ๋ดค๋๋ฐ ๋๊ฒ ์ข์ ๊ธฐ๋ฅ์ธ ๊ฑฐ ๊ฐ์์ด
๊ธ๋ฐ ๊ฐ๊ธฐ๊ณ ๋ณด๋ ์์ var config = UIButton.configure.plain() ~ ์๋ก ์์ผ๋ก ๋ฃ์ด์ค ์ ์๋๋ผ๊ณ ์..;;ใ
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.
ํ๋ฆ๋ LGTMโค๏ธ
if sender.isSelected { | ||
pwTextField.isSecureTextEntry = false | ||
} else { | ||
pwTextField.isSecureTextEntry = 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.
if sender.isSelected { | |
pwTextField.isSecureTextEntry = false | |
} else { | |
pwTextField.isSecureTextEntry = true | |
pwTextField.isSecureTextEntry = sender.isSelected? false : 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.
๋ฏธ๋ฅด์คํด ์ผํญ์ฐ์ฐ์ ์๊ณ ์๋๋ฐ ํ์ฉ ๋ชปํ๋ ๋ ์ ๋ฒ ๋ฐ์ค๋ฐฅ์ค๋๋ฌด
๊ฐ์์.
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.
๋จ์ Boolean ํํ๋ผ๋ฉด ์๋ ๊ฒ๋ ์์ฑํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
pwTextField.isSecureTextEntry = !sender.isSelected
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 ์ค ๋ฐ๋ก ๊ณ ์ณ์ผ๊ฒ ์ต๋๋ค~!
Sopt29th-Assignment/Podfile
Outdated
pod 'SnapKit', '~> 5.0.0' | ||
pod 'Then' | ||
pod 'lottie-ios' | ||
pod 'Moya', '~> 14.0' | ||
pod 'Kingfisher', '~> 6.0' | ||
pod '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.
๋ญ๊ฐ ๋ง๋ค์...๐คญ
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 UIViewController { | ||
func hideKeyboard() { |
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 ๋๋ฌด ์ข๋ค์ฌ ์ฝ์ฅํด๊ฐ๊ฒ ์ต๋๋ค~๐โโ๏ธ
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.
LGTM ํ๋ฆ ์ ๋ฐฐ โจ
$0.addArrangedSubview(nameTextField) | ||
$0.addArrangedSubview(emailTextField) | ||
$0.addArrangedSubview(pwTextField) |
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.
์ด ๋ถ๋ถ๋ stackview extension์ผ๋ก ๋นผ์ ์ฌ์ฉํ ์ ์๋๋ผ๊ตฌ์. UIView extension ๋ง๋ค์ด์ฃผ์ ๊ฒ์ฒ๋ผ ํ์ ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค๐
extension UIStackView {
public func addArrangedSubviews(_ views: UIView...) {
views.forEach(addArrangedSubview(_:))
}
}
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.. ์ ๋๋คโจโจ
if sender.isSelected { | ||
pwTextField.isSecureTextEntry = false | ||
} else { | ||
pwTextField.isSecureTextEntry = 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.
๋จ์ Boolean ํํ๋ผ๋ฉด ์๋ ๊ฒ๋ ์์ฑํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
pwTextField.isSecureTextEntry = !sender.isSelected
@objc func touchupSignupButton(_ sender: UIButton) { | ||
let vc = CompleteVC() | ||
vc.name = nameTextField.text | ||
vc.modalPresentationStyle = .fullScreen |
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.
์๊ฑด ๊ทธ๋ฅ ์ฌ๋ด์ธ๋ฐ .fullScreen๊ณผ .overFullScreen์๋ ์ฐจ์ด๊ฐ ์๋ค์!
์ฌ์ฉํด์ผ ํ๋ ์๊ฐ์ ์ ์ ํ๊ฒ ์ ํํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
https://stackoverflow.com/questions/58657826/benefit-of-using-fullscreen-presentation-style-in-compare-to-overfullscreen-pr
์น์ฐฌ๋ PR์ ์ ๋น๋์ด ๋จ๊ธฐ์ ์ฝ๋ฉํธ๋ณด๊ณ ํฅ๋ฏธ๋ก์์ ์ฐพ์๋ดค์ต๋๋ค~!
.fullScreen
- ํ๋ ์ ํ ์ด์ ์ด ์๋ฃ๋ ํ ํ๋ ์ ํ ์ด์ ๋ทฐ ์ปจํธ๋กค๋ฌ์ ์ํ ๋ทฐ๊ฐ ์ ๊ฑฐ๋ฉ๋๋ค.
- ๊ฐ๋จํ๊ฒ ๋งํด์ ๋ชจ๋ฌ ๋ฐฉ์์ผ๋ก ํ๋ฉด ์ ํ๋์์ ๋, ์ด์ ๊ณ์ธต์ ๋ทฐ๊ฐ ์์ด์ง๋ค๋ ๊ฒ.
viewDidAppear
๋ฅผ ํธ์ถํ๋ค๋ ๊ฒ.
.overFullScreen
- ํ๋ ์ ํ ์ด์ ์ด ๋๋ ๋ ํ๋ ์ ํ ์ด์ ์๋์ ๋ทฐ๊ฐ ๋ทฐ ๊ณ์ธต ๊ตฌ์กฐ์์ ์ ๊ฑฐ๋์ง ์์ต๋๋ค.
- ๊ฐ๋จํ๊ฒ ๋งํด์ ๋ชจ๋ฌ ๋ฐฉ์์ผ๋ก ํ๋ฉด ์ ํ๋์์ ๋, ์ด์ ๊ณ์ธต์ ๋ทฐ๊ฐ ๋จ์์๋ค๋ ๊ฒ
viewDidAppear
๋ฅผ ํธ์ถํ์ง ์๋๋ค๋ ๊ฒ.- ์๊ฐํด๋ณด๋ฉด ๋ทฐ๋ฅผ ๋ถํฌ๋ช ํ๊ฒ ์ฌ๋ฆฌ์ง ์์์ ๋, ๋ฐ์ ์ฝํ ์ธ ๊ฐ ๋ณด์ด๊ฒ ๋ค์..?
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 ๊ทธ๋ผ ์ง๊ธ ์ ์ํฉ์์๋ ์ด๋ค ๊ฑธ ์จ์ค์ผ ์ ํฉํ๋์?
๋ณดํธ์ ์ผ๋ก ์ฌ์ฉ์๊ฐ ์ฑ์ ๋ก๊ทธ์ธ์ ํ๊ณ ๊ณง๋ฐ๋ก ๊ทธ ์ ์ผ๋ก ๋์๊ฐ๋ ์ํฉ(= dismiss
ํด์ฃผ๋ ์ํฉ)์ ๊ฑฐ์ ์์ผ๋๊น
.fullScreen
์ด ๋ง๋ ๊ฑด๊ฐ์??
๊ทธ๋์ ๋ ์น์ ํ ์ค๋ช .. ๋ํ๋ฒ ๋ฆฌ...๊ฐ์ฌ..
self.layer.borderColor = UIColor.lightGray.cgColor | ||
self.layer.cornerRadius = 7 | ||
self.clipsToBounds = true | ||
self.addLeftPadding() |
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.
๊ถ๊ธํ๋ฐ right padding์ ๋ฐ๋ก ์์ฃผ์๋์..? (์ด๊ฒ ๋ฐ์ง๋ ๊ฑฐ ์๋ ์ฃผ์..๐ฅฒ )
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.
ใ
ใ
ใ
ใ
ใ
ใ
ใ
ใ
F ๋ชจ๋จผํธ
์ธ์ฌ๊ฑธ์ด ์๋์๋ค.. ์ ์ฉํด์ฃผ๊ฒ ์ต๋๋ค..!
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.
์๋ฐฐ์ผ ๋จธ์ฏ๋ค. ๋์ฝํ๋ค ์ฝ๋ ์์ฃผ ๊น๋ํ๋ค LGTMโค๏ธ
if name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || | ||
email.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || | ||
pw.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { | ||
signInButton.isUserInteractionEnabled = false | ||
signInButton.backgroundColor = .lightGray | ||
|
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.
์ฐ์ ์๋ก์ด ๊ฑฐ ๋ฐฐ์๊ฐ๋๋ค~
$0.addTarget(self, action: #selector(touchupShowButton(_:)), for: .touchUpInside) | ||
$0.configurationUpdateHandler = { btn in | ||
var config = btn.configuration | ||
config?.image = btn.isSelected ? UIImage(systemName: "checkmark.square.fill") : UIImage(systemName: "square") |
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.
๊ฐ์ฌํฉ๋๋ค.. ์ง์ง์๋ผ ๊ณผ์ฐฌ์ ๋ง์... ๋ ๋ค.. ๊ณผ์ฐฌ๊ณผ์ฐฌ.. ์ ์ด ์์์ ๋ ๋ช
ํํ
์ฝ๋ฆฌ ๊ฐ๊ธฐ๋ฌ ๊ฐ๊ฒ~
์ด์ฐ ์๋ @hyesuuou ๊ธธ๊ฒ ๋ฌ์์คฌ๋๋ฐ reply ํ ๊ณณ์ด ์์ด์ ์ด๋ ๊ฒ ๋ฌ์๋ณด์.. ๊ธธ๊ฒ ์ค๋ช
ํด์คฌ๋๋ฐ ์ดํด ์ง์. ๋ปฅ ์์น๊ณ ์๋ 100ํผ์ผํธ ์ดํด๋์์ด. ์ง์ฌ.. ์ธ์ private
์จ์ผ ํ๋์ง ๊นจ๋ฌ์์ค!
private ๋ ๋ค๋ฅธ ํด๋์ค์์ ์ ๊ทผํ์ง ์๋๊ฑฐ ์์ ์๋๋ค~ ๊ทธ๋ฆฌ๊ณ ๋ด๊ฐ ๊ทธ๋์ ์ฌ์ค ์ธ๋ถ์์ ์ง์ ์ ๊ทผํ์ง ์๊ฑฐ๋ ๋ณด์์(?) ๊ทธ๋ฌ์ง ์์๋ด ํ๋ ๊ณณ์ private๋ฅผ ์จ์ค์ผํด!! ํ๋ ์์๋ก ๋ด๊ฐ First ํด๋์ค์ index๋ ๋ฌด์กฐ๊ฑด 1-100์ฌ์ด์ ์๋ก ํ๊ธฐ๋ก ํ์ด. ๋ค๋ฅธ ์๊ฐ ๋ค์ด์ค๋ฉด ์ค๋ฅ๊ฐ ๋์ . ๊ทธ๋ฌ๋ฉด ์ธ๋ถ์์ 200์ ๋ฃ์ด์คซ์ ๋ ๋ฐ๋ก ๋ฐ์๋๋ฉด ํฐ ๋ฌธ์ ๊ฐ ์๊ธธ์๋ ์์ํ ๊ทธ๋ด๋ index๋ฅผ private๋ก ์ค์ ํ๊ณ , func setIndex (idx: Int) {
if idx > 100, idx < 0 { return }
else { index = idx }
} First ํด๋์ค์ ์๋ฐ ํจ์๋ฅผ ๋ง๋ค์ด์ค์ ์ธ๋ถ์์ ์๋ฅผ ๋ฃ์ด์ค ๋ (ํฐ์ผ๋ก ๊ฐ๊ฒจ์ ์ปด์ผ๋ก ๋ณด๋ฉด ๋ ์ด์์ ๋ค๊นจ์ง๋๊ฑฐ์๋์ง..) ๊ทธ๋์ ๊ฒฐ๋ก ์โขโข |
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 UIViewController { | ||
func hideKeyboard() { |
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ํ์ผ ๋ฐ๋ก ๋ง๋ค๊ณ extension์ผ๋ก ๋ฃ์ ํจ์๋ค์ด ๋ง์๋ฐ extension ์ฌ์ฉํ ์ด์ ๊ฐ ์์๊น์ฉ?? ์ฅ์ ์ด ํฐ๊ฐ์???
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.
๋ฐ๋ณต๋ ์ฝ๋๋ฅผ ๋ฐฉ์งํด์ฃผ๋ ค๊ณ ์จ์ฃผ๋ ๊ฒ ๊ฐ์์ ์ ๋!
์ง๊ธ ์ด hideKeyboard()
์ ๊ฒฝ์ฐ๋ ๋ณธ๋ ๊ฐ์ ๊ฒฝ์ฐ์๋ ํค๋ณด๋๊ฐ ์ฌ๋ผ์ ธ์ผ ํ๋ 2๊ฐ์ VC์ ๊ตฌํ๋ถ์ ํจ๊ป ๋ค ๋ฃ์ด์ค์ผ ๋๋๋ฐ ์ด๋ ๊ฒ extension์ผ๋ก ๋นผ์ค ๊ฒฝ์ฐ์๋ hideKeyboard()
์ฝ๋ ํ ์ค๋ง VC์ viewDidLoad() ์์ ํธ์ถํด์ฃผ๋ฉด ๋๊ธฐ ๋๋ฌธ์ ์ฝ๋๊ฐ ์งง์์ง๊ฑฐ๋ ์!
make.width.equalTo(80) | ||
make.height.equalTo(50) | ||
} | ||
} |
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.
Snapkit ์ฒ์๋ณด๋ ์ฉ์ด์ธ๋ฐ ์คํ ๋ ์ด์์ ์ ์ฉ์ ์ ๋ ๊ฒ ํ ์ ์๊ตฐ์ฉ..์ฝ๋๋ก ์ ์ฉํ๋๊น ์์ ํ๊ธฐ ๋ ํธํด๋ณด์ฌ์!
let logoLabel = UILabel().then { | ||
$0.font = .boldSystemFont(ofSize: 50) | ||
$0.textColor = .mainBlue | ||
$0.text = "Google" | ||
} | ||
|
||
let loginLabel = UILabel().then { | ||
$0.font = .boldSystemFont(ofSize: 35) | ||
$0.textColor = .black | ||
$0.text = "๋ก๊ทธ์ธ" | ||
} | ||
|
||
let explainLabel = UILabel().then { | ||
$0.font = .boldSystemFont(ofSize: 16) | ||
$0.textColor = .lightGray | ||
$0.numberOfLines = 0 | ||
$0.textAlignment = .center | ||
$0.text = "YouTube๋ ์ด๋ํ๋ฉฐ ๊ณ์ํ์ธ์. ์ฑ ๋ฐ Safari์์๋ Google ์๋น์ค์ ๋ก๊ทธ์ธ๋ฉ๋๋ค." | ||
} | ||
|
||
private lazy var fieldStackView = UIStackView().then { | ||
$0.axis = .vertical | ||
$0.alignment = .fill | ||
$0.distribution = .fillEqually | ||
$0.spacing = 20 | ||
$0.addArrangedSubview(nameTextField) | ||
$0.addArrangedSubview(emailTextField) | ||
$0.addArrangedSubview(pwTextField) | ||
} | ||
|
||
let nameTextField = UITextField().then { | ||
$0.setTextField(placeholder: "์ด๋ฆ์ ์ ๋ ฅํด์ฃผ์ธ์", secure: false) | ||
$0.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged) | ||
} | ||
|
||
let emailTextField = UITextField().then { | ||
$0.setTextField(placeholder: "์ด๋ฉ์ผ ๋๋ ํด๋์ ํ", secure: false) | ||
$0.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged) | ||
} | ||
|
||
let pwTextField = UITextField().then { | ||
$0.setTextField(placeholder: "๋น๋ฐ๋ฒํธ ์ ๋ ฅ", secure: true) | ||
$0.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged) | ||
} | ||
|
||
let signupButton = UIButton().then { | ||
$0.setTitle("๊ณ์ ๋ง๋ค๊ธฐ", for: .normal) | ||
$0.setTitleColor(.mainBlue, for: .normal) | ||
$0.setTitleColor(.white, for: .highlighted) | ||
$0.titleLabel?.font = .boldSystemFont(ofSize: 16) | ||
$0.addTarget(self, action: #selector(touchupSignupButton(_:)), for: .touchUpInside) | ||
} | ||
|
||
let signInButton = UIButton().then { | ||
$0.isUserInteractionEnabled = false | ||
$0.setTitle("๋ค์", for: .normal) | ||
$0.setTitleColor(.white, for: .normal) | ||
$0.titleLabel?.font = .boldSystemFont(ofSize: 18) | ||
$0.backgroundColor = .lightGray | ||
$0.layer.cornerRadius = 10 | ||
$0.addTarget(self, action: #selector(touchupSignInButton(_:)), 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.
Then ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ์ด๋ ๊ฒ ์ ์ฉํ๋๊ฑฐ๊ตฐ์ฉ viewDidload์ ์์ฑ์ ์ํด์ผ ์ ์ฉ๋๋ ์ค ์์๋๋ฐ ์๋ฐ ๋ฐฉ๋ฒ๋ ์๋ค์..
signInButton.isUserInteractionEnabled = true | ||
signInButton.backgroundColor = .mainBlue | ||
} | ||
} |
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 textFieldDidChange(textField: UITextField){ | ||
guard let name = nameTextField.text, | ||
let email = emailTextField.text, | ||
let pw = pwTextField.text else { | ||
return | ||
} | ||
|
||
if name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || | ||
email.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || | ||
pw.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { | ||
signInButton.isUserInteractionEnabled = false | ||
signInButton.backgroundColor = .lightGray | ||
|
||
} else { | ||
signInButton.isUserInteractionEnabled = true | ||
signInButton.backgroundColor = .mainBlue | ||
} | ||
} |
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 showButton = UIButton(configuration: configShow, primaryAction: nil).then { | ||
$0.addTarget(self, action: #selector(touchupShowButton(_:)), for: .touchUpInside) | ||
$0.configurationUpdateHandler = { btn in | ||
var config = btn.configuration | ||
config?.image = btn.isSelected ? UIImage(systemName: "checkmark.square.fill") : UIImage(systemName: "square") | ||
btn.configuration = config |
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 ์ด ๋ถ๋ถ ์ง๋ฌธ์ธ๋ฐ ์์ ๋น์ทํ ํ์์ธ? ๋ถ๋ถ๋ค์ let์ผ๋ก ์ด ๊ฒ ๊ฐ์๋ฐ lazy var ๋ถ๋ถ๋ let์ ์ฌ์ฉํ๋ฉด ์๋๋๊ฑด๊ฐ์ฉ?
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.
let
์ด๋ฉด ์๋๋ ์ด์ : lazy
๋ ํธ์ถ๋๊ธฐ ์ ๊น์ง ์ด๊ธฐํ๋์ง ์์ ๊ฐ์ ์ ์ ์๋๋ฐ
์์์ธ let ๊ฐ์ ๊ฒฝ์ฐ๋ ์ด๊ธฐํ๊ฐ ๋๋๊ธฐ ์ ์ ๊ฐ์ ๊ฐ์ ธ์ผ ํ๊ธฐ ๋๋ฌธ์ ์ฌ์ฉํ๋ฉด ์๋ฉ๋๋น~!
๐ ๊ด๋ จ ์ด์
close #2
๐ ๋ณ๊ฒฝ ์ฌํญ ๋ฐ ์ด์
1์ฐจ ๊ณผ์ ๊ตฌํ ์๋ฃ์ ๋๋น~!
๐ PR Point
ํนํ, textField๋ label ๊ฐ์ ๊ฒ๋ค... ๊ณ์ ๋ฐ๋ณต๋๋๋ฐ ๋ชจ๋ฅด๊ฒ ๋ค.
๐ ์ฐธ๊ณ ์ฌํญ
์ ์ด๋ ๊ฒ ํ๋์ง ๊ถ๊ธํ๋ฉด ๊ทธ๋ฅ ๋ค ๊ฐ๊ฒจ์ฃผ์ธ์.