본문 바로가기

반응형

전체 글

(102)
[RxSwift] Filtering Observable ReactiveX - Operators Introduction Each language-specific implementation of ReactiveX implements a set of operators. Although there is much overlap between implementations, there are also some operators that are only implemented in certain implementations. Also, each implementa reactivex.io Filtering Observable 이벤트들이 특정 조건이 맞을 때 발생하도록 이벤트를 필터링 하는 메서드다. Filtering Observable 종류 Debounce Distinct E..
[RxSwift] Transforming Observable Transforming Observable Operators Buffer GroupBy Map FlatMap Scan Window Buffer Observable을 지정된 크기만큼 담고 있다가 버퍼가 꽉 차면 가지고 있던 Observable을 배열로 내보내는 연산자다. 버퍼의 다양한 언어별 구현체에는 어떤 항목이 어떤 버퍼에 들어갈지 선택하는 방법에 따라 다양한 변형이 있다. Observable이 onError 알림을 실행하면 버퍼가 오류 알림을 실행하기 전에 소스 Observable에서 내보낸 항목을 포함하더라도 버퍼는 먼저 버퍼를 내보내지 않고 이 알림을 즉시 전달한다. Window 연산자는 Buffer과 유사하지만 항목을 다시 실행하기 전에 데이터 구조로 수집하지 않고 별도의 Observable로 ..
[RxSwift] Observable 생성 연산자 ReactiveX - Operators 연산자 소개 ReactiveX를 지원하는 언어 별 구현체들은 다양한 연산자들을 제공하는데, 이 중에는 공통적으로 제공되는 연산자도 있지만 반대로 특정 구현체에서만 제공하는 연산자들도 존재한다 reactivex.io Observable 연산자 Observable 생성 연산자 Create 직접적인 코드 구현을 통해 옵저버 메소드를 호출해 Observable을 생성한다 create는 Cancelable 프로토콜을 따르기 때문에 Disposable 형태를 반환해야한다. Observable .create { observable in observable.onNext(0) observable.onNext(1) observable.onNext(2) observable.onComp..
[RxSwift] Observables ReactiveX - Observable Observable ReactiveX에서 옵저버는 Observable을 구독한다. Obseravable이 배출하는 하나 또는 연속된 항목에 옵저버는 반응한다. 이러한 패턴은 동시성 연산을 가능하게 한다. 그 이유는 Observable이 객체를 reactivex.io Observer Pattern 이 패턴은 무한한 데이터 스트림에 매력적이다. 데이터 스트림의 끝을 알리는 기능은 없고, 에러 메커니즘도 없다. 객체 상태 변화를 관찰하는 Observer들의 목록을 객체에 등록하여 상태 변화가 있을 때마다 메서드를 통해 객체가 직접 목록의 각 옵저버에게 통지하도록 하는 디자인 패턴이다. 상태를 가지고 있는 주체 객체와, 상태의 변경을 알아야하는 관찰 객체가 존재하며 이들..
[RxSwift] Traits, Subject, Scheduler GitHub - ReactiveX/RxSwift: Reactive Programming in Swift Reactive Programming in Swift. Contribute to ReactiveX/RxSwift development by creating an account on GitHub. github.com Traits (특성) 특성은 읽기 전용으로 관측 가능한 단일 시퀀스 속성을 가진 래퍼 구조이다. 관찰 가능한 시퀀스를 위한 일종의 Builder 패턴 구현이라고 볼 수 있다. 특성이 구축될 때 .asObservable()을 호출하면 시퀀스로 다시 변환된다. Traits 요소들은 Side Effect, 부작용을 공유하지 않는 특성이 있다. Single (Nonnull) Maybe (Nullab..
[Objective-C] Swift와 비교 (2) - 변수 생성 및 ViewController 변수 1. Swift import UIKit var view = UIView(frame: .zero) let image = UIImage(named: "sample.png") let imageView = UIImageView(image: image) 2. Objective - C #import UIView *view = [UIView init]; UIImage *image = [UIImage imageNamed:@"sample.png"]; UIImageView *imageView = [[UIImageView alloc] initWithFrame: CGRectZero]; imageView.image = image; ViewController 1. Swift import UIKit final class Te..
[Objective-C] Swift와 비교 (1) - 함수, 타입 선언 편 Objective-C를 알기 위해 Swift를 Objective-C로 Convert 하기.. 🙃 함수 호출 방식 /* Swift */ func printColor() { } func getColor() -> Color { } func setNewColor(name: String, code: Int) { } /* Objective - C */ - (void) printColor { } - (Color) getColor { } - (void) setNewColor:(NSString *)name, setNewCode:(NSNumber) code { } 타입 호출 방식 1. Struct /* Swift */ struct Color { let name : String var code : Int } let colo..
[Objective-C] 기본 개념 요약 Objective C 지시어 @interface : 클래스 선언 @implementation : 클래스 구현 @protocol : Delegate 등 일반적인 선언 @end : class, category, protocol 종료 선언 지시어 @property : 프로퍼티 정의 @synthesize : getter, setter 없이 사용할 때 사용하며 @property 에서 정의한 변수를 사용 @dynamic : 동적으로 사용하는 메소드와 변수에 사용 특별 지시어 @class : 사용자 클래스 선언 @selector(name) : 정의된 메소드 이름을 리턴 @protocol(name) : 프로토콜 클래스의 인스턴스 리턴 @encoode(type) : type의 구조를 인코딩하는 문자열 산출 @synchr..

반응형