Created
November 16, 2021 03:13
-
-
Save steveriggins/36a6c5715a09f3ebbf69b9d8d4b51f95 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Foo { | |
var blurValuePublisher: AnyPublisher<Float, Never> { | |
_blurValuePublisher.eraseToAnyPublisher() | |
} | |
private var _blurValuePublisher: CurrentValueSubject<Float, Never> | |
init() { | |
_blurValuePublisher = CurrentValueSubject<Float, Never>(12.0) | |
} | |
func doStuff(_ stuff: Float) { | |
_blurValuePublisher.send(50.3) | |
} | |
} | |
class Bar { | |
init() { | |
let f = Foo() | |
f.blurValuePublisher | |
.sink { value in | |
print(value) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment