Skip to content

Instantly share code, notes, and snippets.

View ezura's full-sized avatar

Yuka Ezura ezura

View GitHub Profile

Typed error can be useful in certain cases, especially when accompanied with NoError type.

For example, in reactive programming, https://github.com/ReactiveCocoa/ReactiveSwift (typed error) allows us to create UI bindings only if Error is NoError, i.e.:

static func <~ <Source: BindingSource> (provider: Self, source: Source) -> Disposable? 
    where Source.Value == Value, Source.Error == NoError { ... }
    
// example
let alphaSignal: Signal = ...