diff --git a/week5/ImageBoard/ImageBoard/AddAtricleViewController.swift b/week5/ImageBoard/ImageBoard/AddAtricleViewController.swift index f27b4f3..3bc1594 100644 --- a/week5/ImageBoard/ImageBoard/AddAtricleViewController.swift +++ b/week5/ImageBoard/ImageBoard/AddAtricleViewController.swift @@ -19,6 +19,9 @@ class AddArticleViewController : UIViewController { @IBAction func setPhotoFromLibrary(_ sender: UITapGestureRecognizer) { + // 메서드 이름은 setPhotoFromLibray 인데, 텍스트 필트를 resign 시키는 기능이 들어있는 것은 + // 차후에 예상치 못한 동작들을 유발할 가능성이 있어 보입니다. + // 예제라 크게 문제 없겠지만, 실전이라면 나중에 나 또는 다른사람이 내 코드를 운용할 때 문제가 발생할 여지가 있습니다. titleField.resignFirstResponder() let imagePickerController = UIImagePickerController() imagePickerController.sourceType = .photoLibrary diff --git a/week5/ImageBoard/ImageBoard/SignUpViewController.swift b/week5/ImageBoard/ImageBoard/SignUpViewController.swift index 5a7c378..3abfae2 100644 --- a/week5/ImageBoard/ImageBoard/SignUpViewController.swift +++ b/week5/ImageBoard/ImageBoard/SignUpViewController.swift @@ -52,6 +52,8 @@ class SignUpViewController : UIViewController { DispatchQueue.main.async { switch result { case .ok : + // viewControllers[0] 보다는 viewControllers.first 사용하기 + // 빈 Array일 때 viewControllers[0]은 크래쉬가 날 수 있습니다. let loginViewControllerVC = self.navigationController?.viewControllers[0] as? LoginViewController loginViewControllerVC?.signUpSuccess = true self.signUpSuccess = true