Created
May 26, 2023 10:58
-
-
Save yimajo/7926de7a890867b429027da207869cb7 to your computer and use it in GitHub Desktop.
Wrap Firestore Remote Config's addOnConfigUpdateListener method for use with AsyncThrowingStream.
This file contains 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 Foundation | |
import FirebaseRemoteConfig | |
extension RemoteConfig { | |
func addOnConfigUpdateListener() -> AsyncThrowingStream<Set<String>, Error> { | |
.init { continuation in | |
addOnConfigUpdateListener { configUpdate, error in | |
if let error { | |
continuation.finish(throwing: error) | |
} else { | |
continuation.yield(configUpdate!.updatedKeys) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment