Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Combine

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
Avatar for Arvind Arvind
August 22, 2019
47

 Combine

Avatar for Arvind

Arvind

August 22, 2019

Transcript

  1. Problem Statement Introduction to Combine How to use it? Combine

    Patterns Error Handling © The App Business Agenda
  2. © The App Business © The App Business 5 Server

    Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  3. © The App Business © The App Business 6 Server

    Target/Action URLSession Callbacks KVO Timer Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  4. Target/Action Notification Center URLSession Key-value observing Callbacks © The App

    Business Asynchronous Interfaces Nope. Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  5. © The App Business 8 COMBINE Problem Statement Introduction to

    Combine How to use it? Combine Patterns Error Handling
  6. Publisher Subscriber Operator Subjects © The App Business Key Concepts

    Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  7. © The App Business Publisher 11 Problem Statement Introduction to

    Combine How to use it? Combine Patterns Error Handling A publisher fundamentally provides data, when available, upon request. It is described with two associated types: one for Output and one for Failure.
  8. What? Defines how values and errors are produced Type Value

    Type Feature Allows registration of a subscriber © The App Business Publisher 16 Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  9. Value Error Completion © The App Business Types of Values

    Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  10. © The App Business Value 18 Problem Statement Introduction to

    Combine How to use it? Combine Patterns Error Handling
  11. © The App Business Error 19 Problem Statement Introduction to

    Combine How to use it? Combine Patterns Error Handling
  12. © The App Business Completion 20 Problem Statement Introduction to

    Combine How to use it? Combine Patterns Error Handling
  13. A protocol that declares a type that can receive input

    from a publisher. A given subscriber’s Input and Failure associated types must match the Output and Failure of its corresponding publisher. © The App Business Subscriber 21 Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  14. © The App Business Subscriber 22 Problem Statement Introduction to

    Combine How to use it? Combine Patterns Error Handling
  15. What? Receives value Type Reference Type Feature Can request N

    values © The App Business Subscriber 29 Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  16. Feature Can request N values © The App Business 30

    Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  17. © The App Business © The App Business 31 Problem

    Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  18. © The App Business © The App Business BACKPRESSURE 32

    Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  19. © The App Business Backpressure Resistance or force opposing the

    desired flow of water through pipes. 33 Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling software data
  20. Computational Speed Awaiting user inputs Server Capability © The App

    Business Backpressure Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  21. Buffering Using a buffer to temporarily store and process data.

    Dropping Dropping requests instead of handling them. © The App Business 39 Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling Backpressure
  22. © The App Business © The App Business 40 Problem

    Statement Introduction to Combine How to use it? Combine Patterns Error Handling Backpressure
  23. Subscribers.Demand © The App Business Backpressure 41 Problem Statement Introduction

    to Combine How to use it? Combine Patterns Error Handling
  24. © The App Business Backpressure 42 Problem Statement Introduction to

    Combine How to use it? Combine Patterns Error Handling
  25. © The App Business Pattern 43 Problem Statement Introduction to

    Combine How to use it? Combine Patterns Error Handling subscribe() receive(subscription:) Here you go: request(_: Demand) I demand 3 values. receive(completion:) receive(_: Input) Here are 3 values: Subscriber Publisher
  26. © The App Business Pattern 44 Problem Statement Introduction to

    Combine How to use it? Combine Patterns Error Handling subscribe() receive(subscription:) Here you go: request(_: Demand) I demand 3 values. receive(completion:) receive(_: Input) Here are 3 values: Subscriber Publisher
  27. What? Pre-built functions to transform and interact with values. Feature

    Support bringing together outputs from different pipelines, or splitting to send to multiple subscribers. © The App Business Operators 46 Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  28. © The App Business 47 Problem Statement Introduction to Combine

    How to use it? Combine Patterns Error Handling
  29. Publisher Operator Subscriber © The App Business Pipeline 48 Problem

    Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  30. © The App Business 52 Operators can also help with

    error handling and retry logic, buffering and prefetch, controlling timing, and supporting debugging. Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  31. © The App Business 53 Operators can also help with

    error handling and retry logic, buffering and prefetch, controlling timing, and supporting debugging. Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  32. © The App Business 54 Operators can also help with

    error handling and retry logic, buffering and prefetch, controlling timing, and supporting debugging. Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  33. © The App Business 55 Operators can also help with

    error handling and retry logic, buffering and prefetch, controlling timing, and supporting debugging. Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  34. © The App Business 56 Operators can also help with

    error handling and retry logic, buffering and prefetch, controlling timing, and supporting debugging. Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  35. © The App Business 57 Operators can also help with

    error handling and retry logic, buffering and prefetch, controlling timing, and supporting debugging. Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  36. © The App Business 58 Operators can also help with

    error handling and retry logic, buffering and prefetch, controlling timing, and supporting debugging. Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  37. What? A special case of publisher that adopts the Subject

    protocol which allows external entities to publish values. Feature Used to "inject" values into a stream, by calling the subject’s send() method © The App Business Subjects 59 Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  38. CurrentValueSubject A subject that wraps a single value and publishes

    a new element whenever the value changes. PassThroughSubject A subject that broadcasts elements to downstream subscribers. © The App Business Types of Built-In Subjects 64 Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  39. Make use of existing Publishers, Operators & Subscribers Create Publishers

    that wrap a remote API call Create Subscribers that consume an API © The App Business Developing with Combine Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  40. © The App Business 67 Scenario: Creating a subscriber with

    sink Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  41. © The App Business 72 Scenario: Making a network request

    with dataTaskPublisher Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  42. © The App Business 74 Network Request let publisher: Publishers.Decode<Publishers.Map<URLSession.DataTaskPublisher,

    JSONDecoder.Input>, RawBase64, JSONDecoder> let publisher: AnyPublisher<RawBase64, Publishers.Decode<Upstream, Output, Coder>.Failure>
  43. © The App Business 77 Scenario: Using catch to handle

    errors in a one-shot pipeline Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  44. Testing Debugging SwiftUI Integration Entwine Test Flux © The App

    Business Where to go from here? Problem Statement Introduction to Combine How to use it? Combine Patterns Error Handling
  45. © The App Business Hello 82 Problem Statement Introduction to

    Combine How to use it? Combine Patterns Error Handling Summary
  46. Functions that are used to publish values. Functions that are

    used to operate on published values. Functions that are used exclusively for handling errors. Functions that map published values using a closure. Functions that subscribe to publishers. © The App Business What is an Operator?
  47. Functions that are used to publish values. Functions that are

    used to operate on published values. Functions that are used exclusively for handling errors. Functions that map published values using a closure. Functions that subscribe to publishers. © The App Business What is an Operator?
  48. Values, Error, Completion Subscribers, Error, Completion Signals, Error, Completion Operators

    Books © The App Business What are the types of values that a Publisher can publish?
  49. Values, Error, Completion Subscribers, Error, Completion Signals, Error, Completion Operators

    Books © The App Business What are the types of values that a Publisher can publish?
  50. A function that creates a publisher and sends values. An

    operator that subscribes to a publisher. A function that creates a subscriber and receives values. A place where you wash your hands. © The App Business What is a sink?
  51. A function that creates a publisher and sends values. An

    operator that subscribes to a publisher. A function that creates a subscriber and receives values. A place where you wash your hands. © The App Business What is a sink?
  52. IntegerValue & PassThrough CurrentValue & PassThrough Future & Promises Unrealised

    Hopes & Dreams © The App Business Types of in-built Subjects
  53. IntegerValue & PassThrough CurrentValue & PassThrough Future & Promises Unrealised

    Hopes & Dreams © The App Business Types of in-built Subjects
  54. © The App Business © The App Business 101 ⚡

    ✨ ⭐ ⭐ ✨ ⚡ THANK YOU.