Home > AI > IOS > Combine >

reduce(_:_:)

Example (Apple Official)


let cancellable = (0...10).publisher
    .reduce(0, { accum, next in accum + next })
    .sink { print("\($0)") }

// 55

Leave a Reply