Git Product home page Git Product logo

combine's Introduction

Combine

Framework

Combine

link

Customize handling of asynchronous events by combining event-processing


Overview

The Combine framework provides a declarative Swift API for processing values overtime. These values can represent many kinds of asynchronous events. Combine declares publishers to expose values that can change over time, and subscribers to receive those values from the publishers.

  • The Publisher protocol declares a type that can deliver a sequence of values over time. Publishers have operators to act on the values received from upstream publishers and republish them.
  • At the end of a chain of publishers, a Sebscriber acts on elements as it receives them. Publishers only emit values when explicitly requested to do so by subscribers. This puts your subscriber code in control of how fast it receivers events from the publishers it's connected to.

Several Foundation types expose their functionality through pubishers, including Timer, NotificationCenter, and URLSession. Combine also provide a built-in publisher for any property that's compliant with Key-Value Observing.

You can combine the output of multiple publishers and coordinat their interaction. For example, you can subscribe to updates from a text field's publisher, and use the text to perform URL requests. You can then use another publisher to process the responses and use them to update your app.

By adopting Combine, you'll make your code esaier to read and maintain, by centralizing your event-processing code and eliminating troublesome techniques like nested closures and convention-based callbacks.

Topic

Essentials

Receiving and Handling Events with Combine

Publishers

protocol Publisher

enum Publishers

struct AnyPublisher

protocol ConnectablePublisher

struct Published

protocol Cancellable

class AnyCancellable

Convenience Publishers

class Future

struct Just

struct Deferred

struct Empty

struct Fail

struct Record

Subscribers

protocol Subscriber

enum Subscribers

struct AnySubscriber

protocol Subscription

enum Subscriptions

Subject

protocol Subject

class CurrentValueSubject

class PassthroughSubject

Schedulers

Observable Objects

Encoders and Decoders

Debugging Identifiers

combine's People

Contributors

doulos76 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.