-
Notifications
You must be signed in to change notification settings - Fork 75
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
일기장 [STEP 1] Yetti, idinaloq #118
Conversation
AppDelegate, SceneDelegate 파일 swiftLint 제외
ViewController.swift -> DiaryListViewController.swift 네이밍 변경
화면에 데이터 받아와서 표시, 수정가능하도록 추가
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.
중복되는 코드의 경우 프로토콜로 정의한 뒤
프로토콜의 extenstion을 활용하는건 어떨까요?
중복되는 코드의 경우 프로토콜로 정의한 뒤 라는 말씀을 듣고 추가로, 해당 방법이 잘 되지 않아서 |
|
@havilog
하비 안녕하세요~ 첫 PR 드립니다!
이번 프로젝트동안 잘 부탁드립니다. 🫡
고민한 점
DateFormatter 확장해서 사용하기
DateFormatter를 사용할 때 여러 ViewController에서 사용되고 또 각각의 ViewController마다 다른 날짜를 표시해줘야 했기 때문에 어떤식으로 작성해야할지 고민했습니다. 저희는 extension으로 DateFormatter를 확장하고 각각의 날짜를 호출할 수 있도록 기능을 구현해 주었습니다.
편집중인 텍스트가 키보드에 의해 가리지 않도록 하기
NotificationCenter
를 사용하는 방법이 있었는데, 그 이유는 keyboardWillShowNotification, keyboardWillHideNotification을 사용해서 키보드가 나타나고 사라질 때notification
을 post 하기 때문입니다.textView
의 크기 조절을 어떻게 하는지에 따라서도 방법이 나뉘어져 있었습니다. 키보드의 크기에 맞게 텍스트뷰의 위치를 위로 올렸으나, 이렇게 되면 safe area를 벗어나게 되므로 이 방법 대신 content와 contentView 가장자리 간격을 확장하는 contentInset, verticalScrollIndicatorInsets을 사용해서 글자를 가리지 않도록 했습니다.조언을 얻고 싶은 점
중복되는 코드
현재
DiaryDetailViewController
와NewDiaryViewController
에서 키보드 구현을 위한 코드가 작성되어 있습니다. 하지만 중복되는 코드이기에 키보드를 사용하는UIViewController
에 protocol을 채택하였으나@objc
메서드때문에 사용할 수 없었고, extension을 사용한 경우 새로운 textView를 받아와야하고 각 메서드마다 textView를 받아야하는 것 같은데 그 부분에서 실행이 되지 않아 실패했습니다.setUpKeyboardEvent()
,keyboardWillShow(_ notification: Notification)
,keyboardWillHide()
이 3개의 메서드를 키보드를 사용하는 뷰컨에서만 사용할 수 있도록 코드를 합치려면 어떤 방식을 사용해야 좋을까요?swiftLint