This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Combine | |
public final class Signal<Output, Failure: Error>: Publisher { | |
let observer: Observer | |
public static func pipe() -> (Signal, Observer) { | |
var _observer: Observer? = nil | |
let signal = Signal { (observer, lifetime) in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Combine | |
extension Publishers { | |
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) | |
public struct Materialize<Upstream>: Publisher where Upstream: Publisher { | |
public typealias Output = Event<Upstream.Output, Upstream.Failure> | |
public typealias Failure = Never | |
internal let cancellable = SerialCancellable() | |
internal let stream: PassthroughSubject<Output, Never> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Combine | |
class Lifetime { | |
static func +(lhs: Lifetime, rhs: @escaping () -> Void) -> () -> Void { | |
let result: ()->Void = { | |
lhs.end() | |
rhs() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Combine | |
/// Naming and idea where taken from ReactiveSwift | |
precedencegroup BindingPrecedence { | |
associativity: right | |
// Binds tighter than assignment but looser than everything else | |
higherThan: AssignmentPrecedence | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Combine | |
extension Subscribers { | |
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) | |
public final class SinkEvents<Upstream>: Subscriber where Upstream: Publisher { | |
public typealias Input = Upstream.Output | |
public typealias Failure = Upstream.Failure | |
let lifetime: Cancellable | |
internal var subscription: Subscription? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../components/polymer/polymer.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; | |
width: 100%; | |
height: 100%; |