Home

MapKit (1)

이번엔 MapKit, CloudKit을 활용한 지도앱을 만들어본다. 기본적인건 최대한 생략을 해보는걸로… 프로젝트에 클라우드 기능 추가하기 프로젝트를 생성하고 iCloud를 추가해준다. 그리고 클라우드킷을 체크해주면 Container를 추가하는 창이 뜨는데 + 버튼을 눌러 추가해주자. App group 컨테이너 추가하듯 Identifier를 복사해서 붙이고, 앞에 icloud를 적어주었다. 그러면 CloudKit을 사용할 준비는 끝났다. Color Asset 추가 주로 사용할 색상에 대해 추가를 해준다. +를 클릭하고 Color Set을 추가해주자 그리고 이름은 brandPrima...

Read more

Combine Remind (Fin)

Http Client 이 코드를 가지고 UIKit, SwiftUI에 적용을 한다. import Combine enum NetworkError: Error { case badUrl } class HTTPClient { func fetchMovies(search: String) -> AnyPublisher<[Movie], Error> { guard let encodedSearch = search.urlEncoded, let url = URL(string: "https://www.omdbapi.com/?s=\(encod...

Read more

Combine Remind (2)

CustomSubject Subject하면 우리는 PassthroughSubject와 CurrentValueSubject 이렇게 2개를 알고 있는데, Subject를 Customizing 할 수 있다. 짝수에 관한 CustomSubject를 만들어본다. class CustomSubject<Failure: Error>: Subject { } Generic을 사용해서 Error를 다룬다. 이때 class는 반드시 Subject 프로토콜을 준수해야한다. Subject Docs 에러가 떠서 Fix를 하면 typealias Output = <#type#> typealias F...

Read more

Combine Remind (1)

Combine을 UIKit에서만 사용해봤었는데, SwiftUI에서도 적용을 해보려한다. 그전에 Combine 사용한지 오래 되었기에, Udemy 강의를 가볍게 정리를 하면서 Remind를 하려고한다. 이전에 서술한 내용이 있는 부분은 패스를 할 예정. 이전글은 여기에. Reactive Programming? Reactive Programming는 비동기 데이터 및 이벤트를 선언적이고 데이터 중심적으로 관리하는 프로그래밍 패러다임이다. Reactive Programming 장점 Code Readability: 선언적 스타일로 작성해 코드 가독성 향상. Immutable State: 상태 변경 없...

Read more

HealthKit (Fin)

iOS 18 적용 Swift6 Concurrency 지금 Xcode에서 사용하는 Swift Version은 5이지만, Swift6가 최근 발표가 되었기에 사용을 해본다. Swift 버전설정은 위의 사진을 참고! 문제 버전을 바꾸자 에러가 발생 해당 코드만 보면 // Background thread async let steps = hkManager.fetchStepCount() async let weightsForLineChart = hkManager.fetchWeights(daysBack: 28) async let weightsForDiffBarChart = hkManager.fetchWeigh...

Read more

HealthKit (14)

Code Comments DocC를 활용하여 우리가 만든 프로젝트에 우리가 Docs를 만드는 과정을 진행한다. Cmd + Option + / 를 사용하면 이렇게 함수에 대해 설명을 할 수 있는 주석이 생성이 된다. 사용 예시: 리턴함수 아래와 같이 fetchStepCount 함수에 대해 작성을 해보았다. 이때 Description을 작성할때는 아래와 같이 ///를 하나더 두고 작성한다. /// Fetch last 28days of step count from HealthKit /// /// This is where you would describe the method further. /// - Re...

Read more

HealthKit (13)

Accessibility(손쉬운사용) 사용하기 VoiceOver Tutorial Accessibility & Inclusion Design an effective chart New iOS18 feature VoiceOver rotor 참고 링크를 한번 확인해보자/ ChartContainer var titleView: some View { VStack(alignment: .leading) { // 생략 } .accessibilityAddTraits(.isHeader) .accessibilityLabel(accessibilityLabel) .acc...

Read more

HealthKit (12)

Optimizing 1. sheet to fullScreenCover 이부분은 예전글에 여러 수강생의 의견이라는 섹션으로 작성을 했던 부분이다. 그래서 크게 언급은 하지 않는걸로 하겠다. fullScreenCover를 사용한다면 primingView에서 .interactiveDismissDisabled() 이부분은 지워주자. 2. DataListView: LabeledContent 사용 현재 List에서는 HStack { Text(data.date, format: .dateTime.month(.wide).day().year()) Spacer() Text(data.value, for...

Read more