iOS
-
Single 일련의 element를 방출하는 대신 항상 단일 요소 또는 error를 방출하는 것을 보장하는 Observable의 변형 Observable.create{ observer -> Disposable in observer.onError(TraitsError.single) return Disposables.create() }.asSingle() .subscribe(onSuccess: { print($0) }, onFailure: { print("error : \($0.localizedDescription)") }, onDisposed: { print("disposed") } ).disposed(by: disposeBag) // error : The operation couldn’t be compl..
[RxSwift] TraitsSingle 일련의 element를 방출하는 대신 항상 단일 요소 또는 error를 방출하는 것을 보장하는 Observable의 변형 Observable.create{ observer -> Disposable in observer.onError(TraitsError.single) return Disposables.create() }.asSingle() .subscribe(onSuccess: { print($0) }, onFailure: { print("error : \($0.localizedDescription)") }, onDisposed: { print("disposed") } ).disposed(by: disposeBag) // error : The operation couldn’t be compl..
2023.09.18 -
Subject observer(관찰자)와 Observable을 모두 수행할 수 있는 Class ※ 여기서 observer은 세부 정보를 저장, 코드를 한 번만 실행하고 모든 observer에 결과를 제공 PublishSubject - 빈 상태로 시작, 새로운 값만 subscriber에 방출 - Observable이 오류로 종료되면 PublishSubject 이후 subscriber에 가지 않고 Observable의 오류로 방출 let publishSubject = PublishSubject() publishSubject.onNext("1. 여러분 안녕하세요") let 구독자1 = publishSubject .subscribe(onNext: { print("첫 번째 구독자 : \($0)") }) publi..
[RxSwift] SubjectSubject observer(관찰자)와 Observable을 모두 수행할 수 있는 Class ※ 여기서 observer은 세부 정보를 저장, 코드를 한 번만 실행하고 모든 observer에 결과를 제공 PublishSubject - 빈 상태로 시작, 새로운 값만 subscriber에 방출 - Observable이 오류로 종료되면 PublishSubject 이후 subscriber에 가지 않고 Observable의 오류로 방출 let publishSubject = PublishSubject() publishSubject.onNext("1. 여러분 안녕하세요") let 구독자1 = publishSubject .subscribe(onNext: { print("첫 번째 구독자 : \($0)") }) publi..
2023.09.16 -
Observable Rx에서 가장 중요한 요소이다. Swift에서 Sequence와 같다. Sequence | Apple Developer Documentation A type that provides sequential, iterated access to its elements. developer.apple.com Element들을 비동기적으로 수신할 수 있다는 장점이 있다. 반환된 반복자에서 next()를 호출하는 대신 Squence 요소를 수신하려면 Observer(callback)을 ObservableType.subscribe에 전달해야 된다. Observable들은 일정 기간 동안 계속해서 이벤트를 생성 Observable의 생명주기는 3가지 enum Event { case next(Elemen..
[RxSwift] ObservableObservable Rx에서 가장 중요한 요소이다. Swift에서 Sequence와 같다. Sequence | Apple Developer Documentation A type that provides sequential, iterated access to its elements. developer.apple.com Element들을 비동기적으로 수신할 수 있다는 장점이 있다. 반환된 반복자에서 next()를 호출하는 대신 Squence 요소를 수신하려면 Observer(callback)을 ObservableType.subscribe에 전달해야 된다. Observable들은 일정 기간 동안 계속해서 이벤트를 생성 Observable의 생명주기는 3가지 enum Event { case next(Elemen..
2023.09.10 -
BackgroundTasks Background Tasks | Apple Developer Documentation Request the system to launch your app in the background to run tasks. developer.apple.com BackgroundTasks Framework를 사용하여 앱 컨텐츠를 최신상태로 유지하고 앱이 백그라운드에 있는 동안 완료하는데 몇 분이 걸리는 작업을 실행하세요. 더 긴 작업에는 선택적으로 전원이 공급되는 장치와 네트워크 연결이 필요할 수 있습니다.
[Swift] BackgroundTasksBackgroundTasks Background Tasks | Apple Developer Documentation Request the system to launch your app in the background to run tasks. developer.apple.com BackgroundTasks Framework를 사용하여 앱 컨텐츠를 최신상태로 유지하고 앱이 백그라운드에 있는 동안 완료하는데 몇 분이 걸리는 작업을 실행하세요. 더 긴 작업에는 선택적으로 전원이 공급되는 장치와 네트워크 연결이 필요할 수 있습니다.
2023.09.03 -
회사에서 API를 만들 때 Dynamic Library?, Static Library? 개념에 대하여 이해하기 위해 포스팅해 보았다. Dynamic과 Static의 차이는 여기서 확인할 수 있다. Dynamic Library 처음 Xcode에서 Framework를 선택하면 Dynamic Library로 생성 된다. 아래와 같은 간단한 클래스를 만들었다. open class DynamicClass{ public init(){} open func test1(_ a: Int, _ b: Int) -> Int{ return a + b } } init 사용하지 않으면 사용하려는 프로젝트에서 initializer is inaccessible due to 'internal' protection level 위와 같은 에..
[Swift] Dynamic Library vs Static Library회사에서 API를 만들 때 Dynamic Library?, Static Library? 개념에 대하여 이해하기 위해 포스팅해 보았다. Dynamic과 Static의 차이는 여기서 확인할 수 있다. Dynamic Library 처음 Xcode에서 Framework를 선택하면 Dynamic Library로 생성 된다. 아래와 같은 간단한 클래스를 만들었다. open class DynamicClass{ public init(){} open func test1(_ a: Int, _ b: Int) -> Int{ return a + b } } init 사용하지 않으면 사용하려는 프로젝트에서 initializer is inaccessible due to 'internal' protection level 위와 같은 에..
2023.08.21 -
Core Data Core Data | Apple Developer Documentation Persist or cache data on a single device, or sync data to multiple devices with CloudKit. developer.apple.com 단일 장치에서 데이터를 유지 또는 캐시 하거나 CloudKit을 사용하여 여러 장치에 동기화하는 Framework Core Data를 사용하여 오프라인에서 사용하기 위해 Application의 영구정인 데이터를 저장하고, 임시 데이터를 캐시 하고, 단일 기기에서는 앱의 실행 취소 기능을 추가합니다. 단일 iCloud 계정의 여러 장치에서 데이터를 동기화하기 위해 Core Data는 Schema를 CloudKit Cont..
[Swift] Core DataCore Data Core Data | Apple Developer Documentation Persist or cache data on a single device, or sync data to multiple devices with CloudKit. developer.apple.com 단일 장치에서 데이터를 유지 또는 캐시 하거나 CloudKit을 사용하여 여러 장치에 동기화하는 Framework Core Data를 사용하여 오프라인에서 사용하기 위해 Application의 영구정인 데이터를 저장하고, 임시 데이터를 캐시 하고, 단일 기기에서는 앱의 실행 취소 기능을 추가합니다. 단일 iCloud 계정의 여러 장치에서 데이터를 동기화하기 위해 Core Data는 Schema를 CloudKit Cont..
2023.08.21