-
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] #1 - iOS 1차 과제 #2
Changes from 30 commits
9046553
bd07c26
79277f4
ec8a0b3
7d209da
d7a8397
93de607
5c40208
add19cd
4955fd3
add76dd
a045cd0
5835d71
9bbc8b2
01de044
b370825
5c0bf03
4f0ad7f
60fe638
328ac05
29946ef
4474535
3abb9a2
107c9dc
44916ef
aff446f
8394cc9
e74bea1
dff5b67
dd54532
73994e0
18e351c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// AddNameToSignupViewController.swift | ||
// | ||
// Created by 변주현 on 2022/04/07. | ||
// | ||
|
||
import UIKit | ||
|
||
class AddNameToSignupViewController: UIViewController { | ||
|
||
@IBOutlet weak var userIdTextField: UITextField! | ||
@IBOutlet weak var nextButton: UIButton! | ||
var userName: String? | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
setButtonOption() | ||
setTextFieldOption() | ||
addActionToTextField() | ||
} | ||
|
||
private func setButtonOption() { | ||
// 다음 버튼 비활성화 | ||
nextButton.isEnabled = false | ||
Comment on lines
+24
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
private func setTextFieldOption() { | ||
// TextField에 입력하면 Clear 버튼이 나오도록 표시 | ||
userIdTextField.clearButtonMode = .whileEditing | ||
} | ||
|
||
private func addActionToTextField() { | ||
// TextField에 이벤트 감지 시 함수 실행을 위한 addTarget() 설정 | ||
self.userIdTextField.addTarget(self, action: #selector(textFieldDidChange), for: .editingChanged) | ||
} | ||
|
||
@objc func textFieldDidChange(sender: UITextField) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 질문 있습니다 !! @objc 는 키보드 입력으로 실시간으로 바뀐걸 반응하려고 넣는건가요..? 꼭 넣어야하는건가요...? 코베 어려워요 . . . 🥲 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 부족하지만,, 아는 선에서 최대한 자세히 설명해보겠습니다.. 하하 저는 TextField에 입력이 되면 버튼을 활성화 시키는 기능을 구현하기 위해서 이벤트 감지 메서드 #selector가 Objective-C의 개념이기 때문에 실행시킬 함수(textFieldDidChange)에 @objc를 적어주는 겁니다! 저도 기능 구현할 때 찾아봤던 내용이라 도움 되었던 자료 공유하겠습니다 🔥 |
||
self.nextButton.isEnabled = sender.hasText ? true : false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sender.hasText자체가 true/false값이기 때문에
|
||
} | ||
|
||
@IBAction func backButtonDidTap(_ sender: Any) { | ||
self.navigationController?.popViewController(animated: true) | ||
} | ||
|
||
@IBAction func nextButtonDidTap(_ sender: Any) { | ||
guard let nextVC = self.storyboard?.instantiateViewController(withIdentifier: "AddPasswordToSignupViewController") as? AddPasswordToSignupViewController else { return } | ||
|
||
// 회원가입(2) VC로 사용자 이름 전달 | ||
nextVC.userId = userIdTextField.text | ||
|
||
self.navigationController?.pushViewController(nextVC, animated: true) | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// AddPasswordToSignupViewController.swift | ||
// | ||
// Created by 변주현 on 2022/04/07. | ||
// | ||
|
||
import UIKit | ||
|
||
class AddPasswordToSignupViewController: UIViewController { | ||
|
||
@IBOutlet weak var passwordTextField: UITextField! | ||
@IBOutlet weak var nextButton: UIButton! | ||
var userId: String? | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
setButtonOption() | ||
setTextFieldOption() | ||
addActionToTextField() | ||
} | ||
|
||
private func setButtonOption() { | ||
// 다음 버튼 비활성화 | ||
nextButton.isEnabled = false | ||
} | ||
|
||
private func setTextFieldOption() { | ||
// TextField에 입력하면 Clear 버튼이 나오도록 표시 | ||
passwordTextField.clearButtonMode = .whileEditing | ||
} | ||
|
||
Comment on lines
+24
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요부분도 스토리보드의 장점을 살린다면 스토리보드 인스펙터 창에서 직접 설정해줄 수도 있을 것같아요!!! 하지만 그저 취향차이니까 코드도 좋습니다~!~!! |
||
private func addActionToTextField() { | ||
// TextField에 이벤트 감지 시 함수 실행을 위한 addTarget() 설정 | ||
self.passwordTextField.addTarget(self, action: #selector(textFieldDidChange), for: .editingChanged) | ||
} | ||
|
||
@objc func textFieldDidChange(sender: UITextField) { | ||
self.nextButton.isEnabled = sender.hasText ? true : false | ||
} | ||
|
||
@IBAction func backButtonDidTap(_ sender: Any) { | ||
self.navigationController?.popViewController(animated: true) | ||
} | ||
|
||
@IBAction func nextButtonDidTap(_ sender: Any) { | ||
guard let signinVC = self.storyboard?.instantiateViewController(withIdentifier: "SigninViewController") as? SigninViewController else { return } | ||
|
||
signinVC.modalPresentationStyle = .fullScreen | ||
// 회원가입(1)에서 받아온 사용자 id를 로그인 완료 VC로 전달 | ||
signinVC.userId = userId | ||
|
||
self.present(signinVC, animated: true, completion: nil) | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// AppDelegate.swift | ||
// | ||
// Created by 변주현 on 2022/04/07. | ||
// | ||
|
||
import UIKit | ||
|
||
@main | ||
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
|
||
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
// Override point for customization after application launch. | ||
return true | ||
} | ||
|
||
// MARK: UISceneSession Lifecycle | ||
|
||
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { | ||
// Called when a new scene session is being created. | ||
// Use this method to select a configuration to create the new scene with. | ||
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) | ||
} | ||
|
||
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { | ||
// Called when the user discards a scene session. | ||
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. | ||
// Use this method to release any resources that were specific to the discarded scenes, as they will not return. | ||
} | ||
|
||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "76x76" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "76x76" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "83.5x83.5" | ||
}, | ||
{ | ||
"idiom" : "ios-marketing", | ||
"scale" : "1x", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
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,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Instagram Black Logo.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "Instagram Black [email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "Instagram Black [email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "icn_back_24.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "password hidden eye icon.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "password hidden eye [email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "password hidden eye [email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "password shown eye icon.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "password shown eye [email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "password shown eye [email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
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.
(담인님 리뷰에 썼던거 긁어왔어여..
!! 더 이상 상속되지 않는다면 앞에 final 키워드를 붙이면 좋을 것 같습니다~!)swift에서 더 이상 상속되지 않는 클래스에는 final 키워드를 붙여주면 훨씬 성능이 좋은 코드가 됩니다!!
클래스를 호출할때 스위프트에서는 Dynamic한 방법을 사용하는데 이게 성능을 떨어뜨리는 요소중 하나에요!
그래서 final을 붙여주면 Dynaimc -> Static 한 방식으로 바꿔준답니다,,
요건 링크를 첨부하면 좋을 것 같아서..몇가지 남기고 갑니다..
https://docs.swift.org/swift-book/LanguageGuide/Inheritance.html#ID202
https://velog.io/@ryan-son/Swift-final-%ED%82%A4%EC%9B%8C%EB%93%9C-%EC%99%9C-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94%EA%B1%B8%EA%B9%8C
https://jellysong.tistory.com/122
그래서 지금 이 SignInViewController가 어디선가 상속될 클래스가 아니라면 final class SignInViewController: UIViewControleller { ~~ 로 적어주심 좋을 것 같아요!!