Skip to content

Instantly share code, notes, and snippets.

@piotrtobolski
piotrtobolski / CombineFlatMapIssue.swift
Last active January 27, 2022 10:01
Combine.Publisher.flatMap issue
import Combine
enum MyError: Error {
case error
}
let subject1 = PassthroughSubject<Int, Error>()
let cancellable1 = subject1
.print("before flatMap")
@discardableResult
@inlinable
private func with<T>(_ value: T, _ builder: (T) throws -> Void) rethrows -> T {
try builder(value)
return value
}
// Use
class MyClass {
var prop = "it's"