일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- vtable
- 공백
- Custom Class
- ios
- moya
- weak self
- RxSwift
- ReactorKit
- binder
- Combine
- 입력
- UserDefaults
- Python
- URLSession
- swift
- reversed
- hitTest
- DISPATCH
- AVCaptureSession
- async
- BidirectionalCollection
- UIResponder
- input
- 사내배포
- MaxHeap
- delays deallocation
- readLine
- Responder chain
- 전자출입
- Asnyc
- Today
- Total
목록📱 iOS, Swift/📚 Combine (4)
틈틈히 적어보는 개발 일기
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/SsSyJ/btsdtFWkyFX/ERVG9Cz00MsBEyNyDpDLRk/img.png)
Filtering basics 💡 기본적으로 filter {...} 의 효과와 동일함! 클로저 내부 결과(Bool)가 true이면 스트림이 지속되고, false라면 스트림이 걸러지게 됨 ⭐️removeDuplicates() RxSwift의 distinctUntilChanged() 와 동일 이전과 동일한 값이 방출될경우 해당 스트림을 필터링 함 Compacting and ignoring 💡 종종 publisher가 Optional 값을 방출하는 경우가 있거나 이벤트가 nil을 반환하는 경우가 있다! 이러한 이벤트를 다뤄보도록 하자 compactMap 클로저 내부 값이 대해 Optional이면 본래의 값을, nil 이라면 해당 이벤트를 방출하지 않음 ignoreOutput() 모든 이벤트를 무시함. 단 co..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bzpqme/btsbV7gb9Kf/nAYcQC7t6rWyN8bMyJapm0/img.png)
Getting started Operators Are publishers 여기서는 에러핸들링에 대한 내용 보다는 operator를 이용한 스트림의 변화에 대해 알아볼것이다~ Collecting values .collect() 스트림을 모두 모아 하나의 array 로 반환합니다 💡 주의: 다른 counting or limit이 없는 buffering operators와 같이 사용할 경우 collect에 값을 계속 담게되어 이벤트가 방출하지 않아 메모리 누수가 일어날 수 있음 Mapping values .map(_:) 발생하는 이벤트를 각각 매핑하여 다른 형태로 변환 .tryMap(_:) try가 가능한 .map(_:) try 문이 실패 시 스트림의 Error에 해당하는 failure(Error) 이벤트를 ..
Hello Publisher publisher는 두가지 이벤트를 방출함 값 (as element) completion event Hello Subscriber Subscribing with sink(_: _:) RxSwift의 subscribe(onNext: ) 와 동일 // Code Just(["myung", "sub"]) .sink(receiveCompletion: { print("오늘 스터디는?? \\($0)") }, receiveValue: { print("스터디 참가자: \\($0)") }) // Result 스터디 참가자: ["myung", "sub"] 오늘 스터디는?? finished Subscribing with assign(to:on:), assign(to: ) KVO 방식으로 값을 할당..
애플이 말하는 컴바인이란? “The Combine framework provides a declarative approach for how your app processes events. Rather than potentially implementing multiple delegate callbacks or completion handler closures, you can create a single processing chain for a given event source. Each part of the chain is a Combine operator that performs a distinct action on the elements received from the previous step.” - ..