mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
revert observable to a pre ios 26 implementation
This commit is contained in:
@@ -14,18 +14,7 @@ extension Observable {
|
|||||||
///
|
///
|
||||||
/// - Parameter property: The key path to the property you would like to observe.
|
/// - Parameter property: The key path to the property you would like to observe.
|
||||||
func observe<Value>(_ property: KeyPath<Self, Value>) -> AsyncStream<Value> {
|
func observe<Value>(_ property: KeyPath<Self, Value>) -> AsyncStream<Value> {
|
||||||
if #available(iOS 26, *) {
|
AsyncStream { continuation in
|
||||||
let observations = Observations { self[keyPath: property] }
|
|
||||||
return AsyncStream { continuation in
|
|
||||||
let task = Task {
|
|
||||||
for await value in observations {
|
|
||||||
continuation.yield(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continuation.onTermination = { _ in task.cancel() }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return AsyncStream { continuation in
|
|
||||||
let isActive = Mutex(true)
|
let isActive = Mutex(true)
|
||||||
|
|
||||||
@Sendable func observe() {
|
@Sendable func observe() {
|
||||||
@@ -46,5 +35,4 @@ extension Observable {
|
|||||||
observe()
|
observe()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user