Swift Class Initialization(Two-Phase Initialization)

이번 포스팅에서는 스위프트 클래스의 Two-Phase Initialization에 대해 알아보겠습니다. Two-Phase Initialization이란? 간단하게 말하면 클래스를 생성할 시 초기화가 2단계에 걸쳐 이뤄진다고 할 수 있겠습니다. 이렇게 2단계에 걸친 클래스의 초기화는 클래스를 더욱 안전하게 다룰 수 있도록 하기 위함입니다. 해당 내용에 대한 스위프트 공식 문서의 내용을 확인해보았습니다. > Class initialization in Swift is a two-phase process. In the first phase, each stored property is assigned an initial value by the class that introduced it. Once the initial state for every stored property has been determined, the second phase begins, and **each

2020년 12월 29일
·
0개의 댓글
·