• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    미해결

클로저

18.11.11 18:04 작성 조회수 183

0

클로저 고급을 확인하였는데 아직 다음 구문이 이해가 안 됩니다.

{[weak toBeFirstResponder] (action: UIAlertAction) in toBeFirstResponder?.becomeFirstResponder()}

[weak toBeFirstResponder]는 배열인가요?

설명 부탁드립니다.

답변 1

답변을 작성해보세요.

0

강한 참조 순환(Strong Reference Cycle)을 방지하기 위한 클로저의 캡쳐 리스트(Capture lists)입니다.

아래 문서에서 해당 내용을 확인할 수 있습니다.

https://docs.swift.org/swift-book/LanguageGuide/Closures.html#ID103

https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html#ID56