combine
-
Combine-Chap7_Sequence OperatorCombine 2021. 12. 10. 18:01
import Foundation import Combine var subscriptions = Set() func example(of name: String, closure: () -> Void) { print("-----------------\(name)----------") closure() } example(of: "hi") { print("hi") } example(of: "min") { let publisher = [1,-50,246,0].publisher publisher .print("publisher") .min() .sink(receiveValue: {print("Lowest value is \($0)")}) .store(in: &subscriptions) } // using own co..
-
Combine_Chap5_CombiningOperatorsCombine 2021. 11. 26. 17:42
import UIKit import Combine var greeting = "Hello, playground" var subscriptions = Set() func example(of name: String, closure: () -> Void) { print("--------------------------\(name)--------------------------") closure() } example(of: "prepend(Output...)") { let publisher = [3,4].publisher publisher .prepend(1,2) .prepend(-1,0) .sink(receiveValue: {print($0)}) .store(in: &subscriptions) } exampl..
-
Swift - CombineCombine 2021. 11. 16. 14:04
Section I: Introduction to Combine Chapter 1: Hello, Combine! Chapter 2: Publishers & Subscribers Section II: Operators Chapter 3: Transforming Operators Chapter 4: Filtering Operators Chapter 5: Combining Operators Chapter 6: Time Manipulation Operators Chapter 7: Sequence Operators Chapter 8: In Practice: Project "Collage" Section III: Combine in Action Chapter 9: Networking Chapter 10: Debugg..
-
Combine - 1 BasicCombine 2021. 11. 3. 14:03
1. Combine Basics Combine 에서 가장 중요한건, publishers, operators, and subscribers 에요. Combine 엔 물론 다른 요소들도 있지만, 이 세개가 없으면 할 수 있는게 많이 없답니다. 먼저, 이것들의 역할부터 알아보도록 하겠습니다. 1.1 Publishers Publishers 는, 하나 또는 여러 곳으로 (to subscribers) 값들을 보낼 수 있는 타입입니다. Publishers 의 내부 로직은 거의 모든 math calculations, networking, handling user events 이지만 모든 publisher 는 아래 세가지 타입들 로 이루어진 여러개의 events 를 보낼 수 있습니다. 1. An output value ..