일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- ios
- 리펙터링
- Clean Code
- UITextView
- tableView
- Refactoring
- combine
- 클린 코드
- MVVM
- swift documentation
- Xcode
- rxswift
- UICollectionView
- uitableview
- collectionview
- HIG
- Human interface guide
- 리펙토링
- Protocol
- swiftUI
- RxCocoa
- 리팩토링
- map
- uiscrollview
- 애니메이션
- ribs
- clean architecture
- 스위프트
- Observable
- SWIFT
- Today
- Total
목록rxswift (43)
김종권의 iOS 앱 개발 알아가기
* 타이머 종류 - foreground에서만 동작하는 Timer - background에서도 동작하는듯한 Timer Foreground에서만 동작하는 Timer 변수 하나를 선언해놓고 RxSwift의 연산자 interval(_:scheduler:) 사용 // ViewController.swift private var currentCount = 0 private func setupOnlyForegroundTimer() { let timer = Observable.interval( .seconds(1), scheduler: MainScheduler.instance ) timer.withUnretained(self) .do(onNext: { weakSelf, countValue in weakSelf.curre..
RxSwift withUnretained(self) - capture list를 사용하지 않고 심플하게 표현 Observable.of(1, 2, 3, 4, 5) .withUnretained(self) .subscribe { vc, value in vc.temp = value } .disposed(by: disposeBag) 1) Combine(결합) 연산자 (merge, combineLatest, withLatestFrom, zip, concat) - 이전 글 참고 Scan Observable.of(1,2,3,4) .scan(0, accumulator: { (prevValue, newValue) in return prevValue + newValue }) .do { print($0) } .subscri..
RxCocoa에서 제공하는 방법으로 tableView의 ControlEvent 처리 방법 RxCocoa의 UITableView+Rx 파일에 존재 itemSelected: 선택한 셀의 IndexPath 값 획득 // viewDidLoad()에서 호출 private func setupTableViewDelegate() { tableView.rx.itemSelected .map { "셀 선택 indexPath = \($0)" } .bind(to: titleLabel.rx.text) .disposed(by: disposeBag) } modelSelected: 선택한 셀의 model 값을 획득 itemDeleted tableView.rx.itemDeleted .map { "아이템 제거 = \($0)" } .bin..
1. ReactorKit - 개념 2. ReactorKit - 테스트 방법 (Storyboard 사용, IBOutlet 테스트 방법) 3. ReactorKit - `TaskList 구현`, 템플릿 (template), 비동기 처리 transform(mutation:) 4. ReactorKit - `TaskEdit 구현`, 화면전환, 데이터 전달 * ReactorKit과 RxDataSources 사용 방법은 이곳 참고 ReactorKit 구현 방향 View, Reactor 생성 View의 storyboard에 UI 생성, IBOutlet 입력 Reactor의 Action 정의, Action에 해당하는 Mutation, State 정의 Reactor에서 필요한 service 정의 Reactor의 mutate..
* Section별, Item별로 dataSource 사용 모델 구현 패턴 방법은 이곳 참고 Cocoa Pods 종속성 pod 'RxSwift' pod 'RxCocoa' pod 'RxDataSources' 모델 정의 RxTableViewSectionedReloadDataSource를 사용하여 DataSource에서 사용되는 데이터형은 `AnimatableSectionModelType`를 준수하는 모델이어야 가능 AnimatableSectionModelType은 SectionModelType을 준수하는 프로토콜 original에 해당되는 모델은 Section에 해당되고, items에 해당되는 인수는 rows값 AnimatableSectionModelType을 준수하는 모델 정의하기 전에 [Item] 타입..
1. ReactorKit - 개념 2. ReactorKit - 테스트 방법 (Storyboard 사용, IBOutlet 테스트 방법) 3. ReactorKit - `TaskList 구현`, 템플릿 (template), 비동기 처리 transform(mutation:) 4. ReactorKit - `TaskEdit 구현`, 화면전환, 데이터 전달 * 해당 코드는 ReactorKit git repository 코드를 참고하였습니다. * Unit Test가 중요한 이유, 클린 코드: https://ios-development.tistory.com/770 * Counter 예제 코드: https://github.com/JK0369/ExReactorKit/tree/BaseComponent ReactorKit 테스..
1. ReactorKit - 개념 2. ReactorKit - 테스트 방법 (Storyboard 사용, IBOutlet 테스트 방법) 3. ReactorKit - `TaskList 구현`, 템플릿 (template), 비동기 처리 transform(mutation:) 4. ReactorKit - `TaskEdit 구현`, 화면전환, 데이터 전달 * 해당 코드는 ReactorKit git repository 코드를 참고하였습니다. ReactorKit 개념 RxSwift의 강점인 비동기 처리에 편리한 코드 API를 통해 앱에서 연속적인 페이지 로드할 때 이전 페이지를 기록해놓아야 하듯이, 이전 페이지를 기록하는 `상태`컴포넌트가 따로 관리되게끔 설계된 구조 `상태`라는 컴포넌트 추상화 개념이 적용되어 있고,..
Subject 기본 개념 Observable과 Observer의 성격을 모두 가지고 있는 프로토콜 Observable의 성격: subscribe을 하여 이벤트를 수신할 수 있는 상태 Observer의 성격: subscribe한 대상들을 내부에서 기록하고 있는 상태 (= subscribe한 대상들을 알고 있기 때문에, 여러번 Observable에 이벤트를 emit이 가능) (= multi case) // 프레임워크 없이 직접 구현한 MySubject.swift public final class MySubject { struct Observer { weak var observer: AnyObject? let block: (Value) -> Void } private var observers = [Observ..