[Chore] #141 - 자잘한 수정 사항#143
Hidden character warning
Conversation
lsj8706
left a comment
There was a problem hiding this comment.
수고하셨습니다~~!!👍
이번 기회에 클로저와 Delegate에 대해 조금씩이라도 더 이해해보면 좋을거 같아요!
| } else { | ||
| // 수정이 된 상태라면 팝업을 띄워주기 | ||
| self.navibar.resetLeftButtonAction({ [weak self] in | ||
| self?.navibar.leftButton.addTarget(self, action: #selector(self?.presentToQuitEditAlertVC), for: .touchUpInside) |
There was a problem hiding this comment.
resetLeftButtonAction을 사용하는 방식으로 수정하셨군요!
혹시 여기서 157줄에서 addTarget을 하지 않고 바로
presentToQuitEditAlertVC()로 적으면 원하는대로 동작을 안 할까요?
There was a problem hiding this comment.
오!! 돼요! 근데 왜 addTarget을 하지 않아도 동작을 하는지 궁금합니다...!
There was a problem hiding this comment.
resetLeftButtonAction 함수 내부를 보시면 addTarget하는 함수가 이미 들어가 있습니다!
즉, resetLeftButtonAction는 파라미터로 받은 클로저를 자신의 프로퍼티인 leftButtonClosure에 담고 새로 addTarget을 실행해서 새로 담긴 leftButtonClosure (우리가 파라미터로 넣은 클로저)를 버튼 터치 액션으로 지정해주고 있습니다!
There was a problem hiding this comment.
와우 그랬군요... 코드를 더 살펴봤어야 햇네욥.. 감사합니다!
| self.navibar.resetLeftButtonAction({ [weak self] in | ||
| self?.navigationController?.popViewController(animated: true) | ||
| }, .titleWithLeftButton) |
| import UIKit | ||
|
|
||
| import Then | ||
|
|
||
| final class InfoView: UIView { | ||
|
|
||
| // MARK: - initialization | ||
|
|
||
| init() { | ||
| super.init(frame: .zero) | ||
| self.setUI() | ||
| self.setLayout() | ||
| self.setDelegate() | ||
| self.register() | ||
| } | ||
|
|
||
| required init?(coder: NSCoder) { | ||
| fatalError("init(coder:) has not been implemented") | ||
| } | ||
| } |
There was a problem hiding this comment.
실수입니다... 삭제할게요 ㅋ
| import Foundation | ||
| import UIKit |
There was a problem hiding this comment.
import UIKit을 했으면 Foundation은 따로 import 해주지 않아도 됩니다!
🌱 작업한 내용
🌱 PR Point
📸 스크린샷
생략
📮 관련 이슈