[SwiftUI] App 프로토콜

J_sung_0o0
1 min readSep 14, 2020

--

참고: https://developer.apple.com/documentation/swiftui/app

  1. 반드시 앞에 @main 을 붙여주어야 합니다. (entry point)
  2. App 프로토콜은 body에서 Scene을 생성합니다.
  3. Scene들간의 공유를 위해 상태를 선언하여 데이터 모델을 초기화 합니다.(@StateObject)
  4. 이렇게 초기화된 데이터는 environmentObject 또는 observedObject 형태로 다른 Scene으로 넘겨질 수 있습니다.
  5. WindowGroup을 사용하여 사용자는 동시에 1개 이상의 Window를 열 수 있습니다.

6. App 프로토콜은 앱이 시작될 때 시스템이 호출하는 main() static method의 기본 구현부를 제공합니다.

--

--

J_sung_0o0
J_sung_0o0

Written by J_sung_0o0

Apple WWDC 19 & 20 Winner (The 1st two-time winner of all time from South Korea)

No responses yet