Skip to content

Commit 4bbab63

Browse files
committed
Enable targeted strict concurrency
1 parent 146ddb6 commit 4bbab63

File tree

28 files changed

+52
-21
lines changed

28 files changed

+52
-21
lines changed

Samples.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,6 +3348,7 @@
33483348
SUPPORTS_MACCATALYST = YES;
33493349
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
33503350
SWIFT_EMIT_LOC_STRINGS = YES;
3351+
SWIFT_STRICT_CONCURRENCY = targeted;
33513352
SWIFT_VERSION = 5.0;
33523353
TARGETED_DEVICE_FAMILY = "1,2,6";
33533354
};
@@ -3379,6 +3380,7 @@
33793380
SUPPORTS_MACCATALYST = YES;
33803381
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
33813382
SWIFT_EMIT_LOC_STRINGS = YES;
3383+
SWIFT_STRICT_CONCURRENCY = targeted;
33823384
SWIFT_VERSION = 5.0;
33833385
TARGETED_DEVICE_FAMILY = "1,2,6";
33843386
VALIDATE_PRODUCT = YES;

Shared/Samples/Add ENC exchange set/AddENCExchangeSetView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ struct AddENCExchangeSetView: View {
5757
}
5858

5959
private extension AddENCExchangeSetView {
60+
@MainActor
6061
class Model: ObservableObject {
6162
/// A map with Oceans style.
6263
let map: Map = {

Shared/Samples/Add feature layers/AddFeatureLayersView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ private struct ChallengeHandler: ArcGISAuthenticationChallengeHandler {
7676
private extension AddFeatureLayersView {
7777
/// The model used to store the geo model and other expensive objects
7878
/// used in this view.
79+
@MainActor
7980
class Model: ObservableObject {
8081
/// A map with a topographic basemap style.
8182
let map = Map(basemapStyle: .arcGISTopographic)

Shared/Samples/Analyze network with subnetwork trace/AnalyzeNetworkWithSubnetworkTraceView.Model.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ extension AnalyzeNetworkWithSubnetworkTraceView {
294294
func addConditionalExpression(
295295
attribute: UtilityNetworkAttribute,
296296
comparison: UtilityNetworkAttributeComparison.Operator,
297-
value: Any
297+
value: any Sendable
298298
) throws {
299-
let convertedValue: Any
299+
let convertedValue: any Sendable
300300

301301
if let codedValue = value as? CodedValue, attribute.domain is CodedValueDomain {
302302
convertedValue = convertToDataType(value: codedValue.code!, dataType: attribute.dataType)
@@ -331,7 +331,7 @@ extension AnalyzeNetworkWithSubnetworkTraceView {
331331
/// - value: The right hand side value used in the conditional expression.
332332
/// - dataType: An `UtilityNetworkAttribute.DataType` enum case.
333333
/// - Returns: Converted value.
334-
func convertToDataType(value: Any, dataType: UtilityNetworkAttribute.DataType) -> Any {
334+
func convertToDataType(value: any Sendable, dataType: UtilityNetworkAttribute.DataType) -> any Sendable {
335335
switch dataType {
336336
case .integer:
337337
if let value = value as? Int16 {

Shared/Samples/Augment reality to collect data/AugmentRealityToCollectDataView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private extension AugmentRealityToCollectDataView {
153153
let featurePoint = featureGraphic.geometry as? Point else { return }
154154

155155
// Create attributes for the new feature.
156-
let featureAttributes: [String: Any] = [
156+
let featureAttributes: [String: any Sendable] = [
157157
"Health": health.rawValue,
158158
"Height": 3.2,
159159
"Diameter": 1.2

Shared/Samples/Augment reality to navigate route/AugmentRealityToNavigateRouteView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import ArcGISToolkit
1717
import AVFoundation
1818
import SwiftUI
1919

20+
@MainActor
2021
struct AugmentRealityToNavigateRouteView: View {
2122
/// The data model for the selected route.
2223
@StateObject private var routeDataModel = RouteDataModel()
@@ -147,7 +148,7 @@ struct AugmentRealityToNavigateRouteView: View {
147148
) {
148149
if let densifiedPolyline = GeometryEngine.densify(polyline, maxSegmentLength: 0.3) as? Polyline {
149150
let polylineBuilder = PolylineBuilder(spatialReference: densifiedPolyline.spatialReference)
150-
Task {
151+
Task { @MainActor in
151152
for part in densifiedPolyline.parts {
152153
for point in part.points {
153154
async let elevation = try await elevationSurface.elevation(at: point)

Shared/Samples/Augment reality to show hidden infrastructure/AugmentRealityToShowHiddenInfrastructureView.ARSceneView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ extension AugmentRealityToShowHiddenInfrastructureView {
7171
// MARK: Scene Model
7272

7373
/// The view model for scene view in the sample.
74+
@MainActor
7475
class SceneModel: ObservableObject {
7576
/// A scene with an imagery basemap style and an elevation surface.
7677
let scene: ArcGIS.Scene = {

Shared/Samples/Augment reality to show hidden infrastructure/AugmentRealityToShowHiddenInfrastructureView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ private extension AugmentRealityToShowHiddenInfrastructureView {
132132
// MARK: Map Model
133133

134134
/// The view model for the map view in the sample.
135+
@MainActor
135136
class MapModel: ObservableObject {
136137
/// A map with an imagery basemap style.
137138
let map = Map(basemapStyle: .arcGISImagery)

Shared/Samples/Configure clusters/ConfigureClustersView.Model.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import UIKit.UIColor
1818
extension ConfigureClustersView {
1919
/// The model used to store the geo model and other expensive objects
2020
/// used in this view.
21+
@MainActor
2122
class Model: ObservableObject {
2223
/// A Zurich buildings web map.
2324
let map = Map(

Shared/Samples/Create and save KML file/CreateAndSaveKMLView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ final class KMZFile: FileDocument {
105105
}
106106

107107
/// Saves the KML document as a KMZ file to a temporary location.
108+
@MainActor
108109
func saveFile() async throws {
109110
temporaryDirectory = FileManager.createTemporaryDirectory()
110111

0 commit comments

Comments
 (0)