Skip to content

Commit 40f5cef

Browse files
committed
Update CustomLocationProvider.swift
1 parent e383c99 commit 40f5cef

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
//
2-
// ManualLocationDataSource.swift
3-
// arcgis_map_sdk_ios
4-
//
52
// Created by Julian Bissekkou on 27.11.23.
63
//
74

85
import Foundation
96
import ArcGIS
107

118
final class CustomLocationProvider: LocationProvider {
12-
private var locationContinuation: AsyncThrowingStream<Location, Error>.Continuation?
13-
private var headingContinuation: AsyncThrowingStream<Double, Error>.Continuation?
9+
private var locationContinuation: AsyncStream<Location>.Continuation?
10+
private var headingContinuation: AsyncStream<Double>.Continuation?
1411

1512

1613
// Exposed stream
17-
var locations: AsyncThrowingStream<Location, Error> {
18-
AsyncThrowingStream { continuation in
14+
var locations: AsyncStream<Location> {
15+
AsyncStream { @Sendable continuation in
1916
self.locationContinuation = continuation
17+
continuation.onTermination = { _ in
18+
self.locationContinuation = nil
19+
}
2020
}
2121
}
2222

23-
var headings: AsyncThrowingStream<Double, Error> {
24-
AsyncThrowingStream { continuation in
23+
var headings: AsyncStream<Double> {
24+
AsyncStream { continuation in
2525
self.headingContinuation = continuation
26+
continuation.onTermination = { @Sendable _ in
27+
self.headingContinuation = nil
28+
}
2629
}
2730
}
2831

0 commit comments

Comments
 (0)