일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- SwiftUI
- graphql
- Xcode
- swift6
- @Binding
- @Environment
- typeorm
- Operater
- init
- nonisolated
- Creating Operators
- RxCocoa
- RFC1738/1808
- @EnvironmentObject
- Bug
- Operators
- IOS
- URL(string:)
- NullObject
- SWIFT
- subject
- vim
- RxSwift
- init?
- @State
- ios14
- dismiss
- operator
- NavigationLink
- nestjs
- Today
- Total
목록RxSwift (35)
Tunko Development Diary

RxCocoa 를 이용해 UICollectionView를 사용 let systemColors = [UIColor.systemRed, UIColor.systemOrange, UIColor.systemYellow, UIColor.systemGreen, UIColor.systemTeal, UIColor.systemBlue, UIColor.systemIndigo, UIColor.systemPurple, UIColor.systemPink, UIColor.systemBrown] @available(iOS 14.0, *) class TestViewController: UIViewController { @IBOutlet weak var collectionView: UICollectionView! let disposeB..

Driver Traits 에서 가장 핵심적인 Driver입니다. Driver는 share() 연산자를 사용한것 처럼 하나의 시퀀스에서 동작하는 옵저버블이며 Error를 방출하지 않습니다. Driver를 사용하기 위해선 기존 옵저버블에 asDriver() 연산자를 추가 기존 UI와 연동중이던 bind(to:) 를 .drive로 대체합니다. 예제) import UIKit import RxSwift import RxCocoa enum ValidationError: Error { case notANumber } class DriverViewController: UIViewController { let bag = DisposeBag() @IBOutlet weak var inputField: UITextField!..

바인딩 에는 소비자와 생산자가 있습니다. 생산자는 Observable 입니다. 소비자는 UI Component 입니다. Binder는 특별한 옵저버 입니다. 즉 데이터 소비자 입니다. Observable → Binder Binder는 옵저버이기에 새로운값을 전달할 수는 있지만 구독자를 추가할 수는 없습니다. Observable → Next ✅ → Binder Observable → Completed ✅ → Binder Observable → Error ❌ → Binder Binder는 Next 이벤트를 받으면 UI가 업데이트 됩니다. Binder는 Error 이벤트를 받지 않습니다. UI는 Main Thread에서 업데이트 되어야 합니다. 이제 UITextFiled 에 입력한 글씨는UILabel에 업데이..

RxCocoa는 cocoa touch 프레임워크에 reactive 의 장점을 더해준 라이브러리입니다. RxCocoa는 RxSwift를 기반으로 구동됩니다. cocoapods install을 통해서 RxSwift와 함께 설치해주어야 합니다. podfile pod 'RxSwift', '6.2.0' pod 'RxCocoa' 설치된 프로젝트에서 Pods/Pods/RxCocoa/UIButton+Rx.swift 파일을 열어보면 extension Reactive where Base: UIButton { public var tap: ControlEvent { controlEvent(.touchUpInside) } } 이런식으로 확장되어 있습니다. UIButton 을 직접적으로 확장하는것이 아니라 Base타입을 지정해서..

retry retry연산자는 옵저버블에서 에러가 발생하면 현재 시퀀스를 중단하고 다시 새로운 구독을 시작합니다. 새롭게 구독하는것이므로 기존에 있던 next이벤트들은 소멸되고 다시 시작합니다. retry 연산자 함수 원형 public func retry() -> Observable { CatchSequence(sources: InfiniteSequence(repeatedValue: self.asObservable())) } public func retry(_ maxAttemptCount: Int) -> Observable { CatchSequence(sources: Swift.repeatElement(self.asObservable(), count: maxAttemptCount)) } 함수 원형을 보시면..