iZettle / Presentation

Presentation is an iOS Swift library for working with UI presentations in a more structured way
MIT License
72 stars 11 forks source link

Add "materialize" overload for void result type #30

Closed nataliq closed 5 years ago

nataliq commented 5 years ago

Small addition to Presentable for the cases in which there is no meaningful result of materialize.

mansbernhardt commented 5 years ago

I use another similar convenience helper when the result is a disposable, that might be worth adding as well:

extension Presentable where Result == Disposable {
    func materialize(into bag: DisposeBag) -> Matter {
        let (matter, disposable) = materialize()
        bag += disposable
        return matter
    }
}
let matter = model.materialize(into: bag)

Not sure if that on can give any direction how to name things?