ios 29

[iOS App Dev Tutorials] SwiftUI - State Management (1)

Apple Developer Documentation developer.apple.com 1. Making Classes Observable Working with Reference Type 이전 챕터에서는 @State, @Binding property wrappers를 사용하여 View 계층에서 업데이트를 트리거하기 위해 진실 소스를 정의했다. 이번에는 앱의 UI에 대한 진실 소스로서 참조 유형을 정의하는 것을 알아본다. @State 은 오직 structures 나 enumerations 같은 Value type (값 타입)에만 작동한다. SwiftUI는 @ObservedObject, @StateObject, @EnvironmentObject 같은 reference type (참조 타입) 을 진실 소스..

[WWDC 2020] Vision

0. 시작에 앞서.. Detect Body and Hand Pose with Vision - WWDC20 - Videos - Apple Developer WWDC 스터디에서 [Detect Body and Hand Pose with Vision] 영상을 보고 각자 공부를 해봤다. Vision 기술을 통해서 얼굴과 몸, 손을 인식하고 움직임까지 감지한다. 이러한 기술을 어떻게 구현하는지 설명하는 동영상이다. 그 중에 손에 대해 요약해서 말하자면 손가락 관절 하나 하나에 포인트(랜드마크)를 찍어서 포인트가 어떻게 변하는지 감지한다. 또한 ARKit 과 Vision의 차이점에 대해서도 설명하고 있다. Landmarks 는 똑같이 제공하고 개수도 같다. Confidence 는 신뢰 값이라고 하는데 Vision만 ..

WWDC 2022.05.13

[iOS App Dev Tutorials] SwiftUI - Passing Data (2)

Apple Developer Documentation developer.apple.com Section 3. Pass the Edit View a Binding to Data struct DetailEditView: View { @Binding var data: DailyScrum.Data ... } struct DetailEditView_Previews: PreviewProvider { static var previews: some View { DetailEditView(data: .constant(DailyScrum.sampleData[0].data)) } } DetailView에서 State 변수를 받기 위해 Binding으로 data 를 선언한다. struct DetailView: View { @..

[iOS App Dev Tutorials] SwiftUI - Navigation and Modal Presentation (3)

Apple Developer Documentation developer.apple.com 3. Creating the Edit View Section 1. Update the Data Model struct Data { var title: String = "" var attendees: [Attendee] = [] var lengthInMinutes: Double = 5 var theme: Theme = .seafoam } var data: Data { Data(title: title, attendees: attendees, lengthInMinutes: Double(lengthInMinutes), theme: theme) } } 아래 data는 DailyScrum의 속성 값을 받고 계산된 데이터를 반환..

[iOS App Dev Tutorials] SwiftUI - Navigation and Modal Presentation (2)

Apple Developer Documentation developer.apple.com 2. Managing Data Flow Between Views @State, @Binding 을 사용하여 사용자 인터페이스가 앱 데이터의 현재 상태를 반영하도록 한다. Source of Truth 정보의 여러 복사본을 관리하면 앱에서 버그를 유발할 수 있다. 따라서 각 데이터 요소에 대해 단일화 한다. 단일 데이터 요소(단일 진실 소스)를 한 곳에 저장하면, 다른 뷰가 동일한 데이터에 액세스 할 수 있다. 데이터를 어디에 저장하는지 정의하는 것은 다양한 뷰에서 공유하는지, 데이터가 변화하는지에 따라 달라진다. Swift Property Wrappers SwiftUI는 @State, @Binding 속성 래퍼를 사용..

[iOS App Dev Tutorials] SwiftUI - Navigation and Modal Presentation (1)

Apple Developer Documentation developer.apple.com 1. Creating a Navigation Hierarchy Section 1. Set Up Navigation @main struct ScrumdingerApp: App { var body: some Scene { WindowGroup { NavigationView { ScrumsView(scrums: DailyScrum.sampleData) } } } } struct ScrumsView: View { let scrums: [DailyScrum] var body: some View { List { ForEach(scrums) { scrum in NavigationLink(destination: Text(scrum..

[iOS App Dev Tutorials] SwiftUI - Views

Apple Developer Documentation developer.apple.com 1. Creating a Card View Color SwiftUI 프레임 워크는 View의 인스턴스로서 color를 다룬다. 에셋 카탈로그와 이름을 같게 enum을 만들어준다. accentColor는 해당 색의 보색으로 강조할 수 있게 만들어 주는 색이다. 그 색에 맞게 하얀색과 검정색을 반환한다. 메인 칼라 함수를 써서 enum의 rawValue를 Color 타입에 넣어 초기화를 한다. View의 background에 theme의 mainColor로 초기화하는 모습 LabelStyle SwiftUI에서 제공하는 LabelStyle 프로토콜을 사용해서 앱 전체에서 일관된 스타일의 레이블을 사용할 수 있게 한다. 여..

[iOS App Dev Tutorials] SwiftUI - SwiftUI Essentials

Apple Developer Documentation developer.apple.com 개요 SwiftUI는 모든 애플 플랫폼을 위한 앱 구축 선언형 프레임 워크이다. 단일 언어와 공통된 API를 사용하여 동작과 UI를 정의한다. 다음 특징이 SwiftUI를 더 빠르고 오류를 적게 만든다. 선언 구문 간단한 Swift 구조를 사용해서 View를 정의한다. 구성 API 기본 제공 View와 Modifiers(한정자)를 사용해 UI를 빠르게 만들고 반복한다. 간단한 View 들을 구성함으로써 복잡한 View를 만든다. 강력한 레이아웃 시스템 존재하는 View와 Control들이 필요에 맞지 않는다면 직접 만들 수 있다. 앱 데이터를 반영하는 View Data가 변경되면 View를 자동으로 업데이트하여 잘못..