일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 콩세알프로젝트
- tutorial
- DynamicIsland
- 대학생협
- unittest
- ActivityKit
- 1주차
- letswift
- watchapp
- tutorials
- RxSwift
- Unit
- 2주차
- KoreaMango
- 회고
- 프로그래머스
- Swift
- SwiftData
- 2023
- fruta
- 3주차
- swiftUI
- WWDC
- 개발자
- xcode15
- wwdc2023
- @Model
- test
- ios
- watchkit
- Today
- Total
목록iOS/iOS App Dev Tutorials (17)
KoreaMango 나무
Apple Developer Documentation developer.apple.com 2. Responding to Events Scene Architecture Scene은 시스템이 관리하는 수명주기가 있는 앱의 UI의 일부이다. 앱을 만들기 위해서는 앱 프로토콜을 준수하는 구조를 정의해야한다. @main 속성을 앞에 둠으로써 시작점이 이곳이라는 것을 시스템에게 알릴 수 잇다. 앱 구조 내에 Scene 프토토콜을 준수하는 장면을 하나 이상 추가한다. Scene은 앱이 보여지는 View 계층의 컨테이너이다. 예를 들어 iOS와 watchOS는 하나의 Scene을 보여줄 수 있지만, macOS와 iPadOS는 여러 Scene을 보여줄 수 있다. SwiftUI는 WindowGrouop 같은 원시적인 Sc..
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 (참조 타입) 을 진실 소스..
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 { @..
Apple Developer Documentation developer.apple.com 1. Passing Data with Bindings Section 1. Add a Theme View struct ThemeView: View { let theme: Theme var body: some View { ZStack { RoundedRectangle(cornerRadius: 4) .fill(theme.mainColor) Label(theme.name, systemImage: "paintpalette") .padding(4) } .foregroundColor(theme.accentColor) .fixedSize(horizontal: false, vertical: true) } } struct ThemeV..
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의 속성 값을 받고 계산된 데이터를 반환..
Apple Developer Documentation developer.apple.com 2. Managing Data Flow Between Views @State, @Binding 을 사용하여 사용자 인터페이스가 앱 데이터의 현재 상태를 반영하도록 한다. Source of Truth 정보의 여러 복사본을 관리하면 앱에서 버그를 유발할 수 있다. 따라서 각 데이터 요소에 대해 단일화 한다. 단일 데이터 요소(단일 진실 소스)를 한 곳에 저장하면, 다른 뷰가 동일한 데이터에 액세스 할 수 있다. 데이터를 어디에 저장하는지 정의하는 것은 다양한 뷰에서 공유하는지, 데이터가 변화하는지에 따라 달라진다. Swift Property Wrappers SwiftUI는 @State, @Binding 속성 래퍼를 사용..
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..
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 프로토콜을 사용해서 앱 전체에서 일관된 스타일의 레이블을 사용할 수 있게 한다. 여..