From c409e592d19b351aa80fe00fd1e3a2bc46ef7d09 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 20 Sep 2024 13:29:16 -0700 Subject: [PATCH 01/56] Bump `LastUpgradeVersion` --- .../xcschemes/arcgis-runtime-toolkit-swift.xcscheme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/arcgis-runtime-toolkit-swift.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/arcgis-runtime-toolkit-swift.xcscheme index accc42ade..d6fe1c997 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/arcgis-runtime-toolkit-swift.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/arcgis-runtime-toolkit-swift.xcscheme @@ -1,6 +1,6 @@ Date: Fri, 20 Sep 2024 13:31:35 -0700 Subject: [PATCH 02/56] Bump swift-tools-version --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 648359f32..7bd3f2b2d 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.9 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. // Copyright 2021 Esri // From 3b476efefbb3147a7a575dd37c52eba22ea87795 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 20 Sep 2024 14:01:24 -0700 Subject: [PATCH 03/56] Add SWIFT_VERSION to "Examples" project --- Examples/Examples.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Examples/Examples.xcodeproj/project.pbxproj b/Examples/Examples.xcodeproj/project.pbxproj index 13120f43d..5f7130d0e 100644 --- a/Examples/Examples.xcodeproj/project.pbxproj +++ b/Examples/Examples.xcodeproj/project.pbxproj @@ -348,6 +348,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -403,6 +404,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 6.0; VALIDATE_PRODUCT = YES; }; name = Release; From 6c4a6afc46df902a6665c5ba028a08c3dfff3805 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 20 Sep 2024 14:03:26 -0700 Subject: [PATCH 04/56] Bump SWIFT_VERSION to 6.0 for Toolkit Examples target --- Examples/Examples.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/Examples.xcodeproj/project.pbxproj b/Examples/Examples.xcodeproj/project.pbxproj index 5f7130d0e..fb3e3e27f 100644 --- a/Examples/Examples.xcodeproj/project.pbxproj +++ b/Examples/Examples.xcodeproj/project.pbxproj @@ -436,7 +436,7 @@ SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2,6"; }; name = Debug; @@ -468,7 +468,7 @@ SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2,6"; }; name = Release; From ba11e271c7c2d1bdc9dfe72a73742daa4733f8fd Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 20 Sep 2024 14:05:11 -0700 Subject: [PATCH 05/56] Specify Swift 6 for Authentication project and target --- .../AuthenticationExample.xcodeproj/project.pbxproj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj b/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj index 88025c98d..949bb6a97 100644 --- a/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj +++ b/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj @@ -270,6 +270,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -325,6 +326,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 6.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -359,7 +361,7 @@ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -394,7 +396,7 @@ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; From b94cece403f3216948905f9e42fafeb01c7db1d6 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 20 Sep 2024 14:06:02 -0700 Subject: [PATCH 06/56] Specify Swift 6 for Job Manager project and target --- .../JobManagerExample.xcodeproj/project.pbxproj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj b/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj index b84e6a483..c6725af22 100644 --- a/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj +++ b/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj @@ -246,6 +246,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -299,6 +300,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 6.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -330,7 +332,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -362,7 +364,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; From 374baf29da3d93bcf11c609e7ba17e44b785f472 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 20 Sep 2024 14:07:10 -0700 Subject: [PATCH 07/56] Specify Swift 6 for Test Runner project and targets --- Test Runner/Test Runner.xcodeproj/project.pbxproj | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Test Runner/Test Runner.xcodeproj/project.pbxproj b/Test Runner/Test Runner.xcodeproj/project.pbxproj index 13e939e8b..2eb4ec282 100644 --- a/Test Runner/Test Runner.xcodeproj/project.pbxproj +++ b/Test Runner/Test Runner.xcodeproj/project.pbxproj @@ -409,6 +409,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -464,6 +465,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 6.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -499,7 +501,7 @@ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2,6"; }; name = Debug; @@ -535,7 +537,7 @@ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2,6"; }; name = Release; @@ -553,7 +555,7 @@ SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_TARGET_NAME = "Test Runner"; }; @@ -572,7 +574,7 @@ SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_TARGET_NAME = "Test Runner"; }; From 24f41ded5910c842459fcaf6b7faa51352a3aa70 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 20 Sep 2024 14:17:57 -0700 Subject: [PATCH 08/56] Bump LastUpgradeVersion in other schemes --- .../xcshareddata/xcschemes/Toolkit Examples.xcscheme | 2 +- .../xcshareddata/xcschemes/JobManagerExample.xcscheme | 2 +- .../xcshareddata/xcschemes/Test Runner.xcscheme | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Examples/Examples.xcodeproj/xcshareddata/xcschemes/Toolkit Examples.xcscheme b/Examples/Examples.xcodeproj/xcshareddata/xcschemes/Toolkit Examples.xcscheme index 2b84f18e4..9599ca231 100644 --- a/Examples/Examples.xcodeproj/xcshareddata/xcschemes/Toolkit Examples.xcscheme +++ b/Examples/Examples.xcodeproj/xcshareddata/xcschemes/Toolkit Examples.xcscheme @@ -1,6 +1,6 @@ Date: Fri, 20 Sep 2024 17:15:55 -0700 Subject: [PATCH 09/56] Update FlyoverExampleView.swift --- Examples/Examples/FlyoverExampleView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Examples/FlyoverExampleView.swift b/Examples/Examples/FlyoverExampleView.swift index e7b47899a..2ecd4f3f4 100644 --- a/Examples/Examples/FlyoverExampleView.swift +++ b/Examples/Examples/FlyoverExampleView.swift @@ -23,7 +23,7 @@ struct FlyoverExampleView: View { id: PortalItem.ID("7558ee942b2547019f66885c44d4f0b1")! ) ) - + var body: some View { FlyoverSceneView( initialLocation: Point(x: 4.4777, y: 51.9244, z: 1_000, spatialReference: .wgs84), From 35a7c595a6bb58b16da7b7e26d6bb32efdaba7f1 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 20 Sep 2024 17:24:57 -0700 Subject: [PATCH 10/56] Fix error in `UtilityNetworkTraceViewModel.addStartingPoints(at:mapPoint:with:)` Fixes error: Main actor-isolated value of type '() async -> Void' passed as a strongly transferred parameter; later accesses could race --- .../UtilityNetworkTrace/UtilityNetworkTraceViewModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTraceViewModel.swift b/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTraceViewModel.swift index d19db5b34..54087dc28 100644 --- a/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTraceViewModel.swift +++ b/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTraceViewModel.swift @@ -129,7 +129,7 @@ import SwiftUI await withTaskGroup(of: Void.self) { [weak self] taskGroup in guard let self else { return } for layer in network?.layers ?? [] { - taskGroup.addTask { @MainActor in + taskGroup.addTask { @MainActor @Sendable in if let result = try? await proxy.identify(on: layer, screenPoint: screenPoint, tolerance: 10) { for element in result.geoElements { await self.processAndAdd( From 05b4c65fa078b6f62d1e96e9e6ad5b8c734bb97f Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 20 Sep 2024 18:45:20 -0700 Subject: [PATCH 11/56] Fix error in `AttachmentCameraController.onCameraCaptureModeChanged(perform:)` Fixes error: Main actor-isolated property 'microphoneAccessAlertIsVisible' can not be mutated from a Sendable closure --- .../AttachmentHelpers/AttachmentImportMenu.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift index 5d7ec0fb5..a52a745b5 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift @@ -204,7 +204,9 @@ struct AttachmentImportMenu: View { #if !targetEnvironment(macCatalyst) && !targetEnvironment(simulator) .onCameraCaptureModeChanged { captureMode in if captureMode == .video && AVCaptureDevice.authorizationStatus(for: .audio) == .denied { - microphoneAccessAlertIsVisible = true + Task { @MainActor in + microphoneAccessAlertIsVisible = true + } } } #endif From 3401c024313257e7ebd3dbd24e83cd725400756e Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 20 Sep 2024 18:47:02 -0700 Subject: [PATCH 12/56] Fix error in `AttachmentCameraController.onCameraCaptureModeChanged(perform:)` Fixes error: Assigning non-sendable parameter 'action' to a @Sendable closure --- .../AttachmentHelpers/AttachmentCameraController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift index 57f06a3c9..843034323 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift @@ -81,7 +81,7 @@ final class CameraControllerCoordinator: NSObject, UIImagePickerControllerDelega extension AttachmentCameraController { /// Specifies an action to perform when the camera capture mode has changed from photo to video or vice versa. /// - Parameter action: The new camera capture mode. - func onCameraCaptureModeChanged(perform action: @escaping (_: UIImagePickerController.CameraCaptureMode) -> Void) -> Self { + func onCameraCaptureModeChanged(perform action: @Sendable @escaping (_: UIImagePickerController.CameraCaptureMode) -> Void) -> Self { self.controller.action = action return self } From 89c22a05663a0eeda4b0ca255cfb4bf04cecec3b Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 14:57:56 -0700 Subject: [PATCH 13/56] Remove experimental and upcoming feature flags --- Package.swift | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Package.swift b/Package.swift index 7bd3f2b2d..113a46771 100644 --- a/Package.swift +++ b/Package.swift @@ -50,13 +50,3 @@ let package = Package( ) ] ) - -for target in package.targets { - target.swiftSettings = (target.swiftSettings ?? []) + [ - // Experimental Features. - .enableExperimentalFeature("AccessLevelOnImport"), - .enableExperimentalFeature("StrictConcurrency"), - // Upcoming Features. - .enableUpcomingFeature("DisableOutwardActorInference") - ] -} From aae526d41e659d8761d1f394036d1543244805e2 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 14:59:00 -0700 Subject: [PATCH 14/56] Add missing default case to `TextFormElementView` --- .../FeatureFormView/Subviews/TextFormElementView.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/TextFormElementView.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/TextFormElementView.swift index 3bc029d9d..3b22b2dd7 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/TextFormElementView.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/TextFormElementView.swift @@ -27,6 +27,8 @@ struct TextFormElementView: View { MarkdownView(markdown: text) case .plainText: Text(text) + default: + EmptyView() } } .task { From 317758bbfe7c346dfbfffda5d6da71ec619ddfb1 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 15:01:59 -0700 Subject: [PATCH 15/56] Bump `objectVersion` to `77` --- .../AuthenticationExample.xcodeproj/project.pbxproj | 2 +- Examples/Examples.xcodeproj/project.pbxproj | 2 +- JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj | 2 +- Test Runner/Test Runner.xcodeproj/project.pbxproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj b/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj index 949bb6a97..20065685d 100644 --- a/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj +++ b/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 55; + objectVersion = 77; objects = { /* Begin PBXBuildFile section */ diff --git a/Examples/Examples.xcodeproj/project.pbxproj b/Examples/Examples.xcodeproj/project.pbxproj index fb3e3e27f..ff346a02d 100644 --- a/Examples/Examples.xcodeproj/project.pbxproj +++ b/Examples/Examples.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 77; objects = { /* Begin PBXBuildFile section */ diff --git a/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj b/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj index c6725af22..cfb81b7d9 100644 --- a/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj +++ b/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 56; + objectVersion = 77; objects = { /* Begin PBXBuildFile section */ diff --git a/Test Runner/Test Runner.xcodeproj/project.pbxproj b/Test Runner/Test Runner.xcodeproj/project.pbxproj index 2eb4ec282..77e345d4c 100644 --- a/Test Runner/Test Runner.xcodeproj/project.pbxproj +++ b/Test Runner/Test Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 56; + objectVersion = 77; objects = { /* Begin PBXBuildFile section */ From 689075edda3db39604f68338b81f46691a28472a Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 15:04:11 -0700 Subject: [PATCH 16/56] Bump `LastUpgradeCheck` to `1600` --- .../AuthenticationExample.xcodeproj/project.pbxproj | 2 +- Examples/Examples.xcodeproj/project.pbxproj | 2 +- JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj | 2 +- Test Runner/Test Runner.xcodeproj/project.pbxproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj b/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj index 20065685d..7ff6201f5 100644 --- a/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj +++ b/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj @@ -133,7 +133,7 @@ attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1320; - LastUpgradeCheck = 1530; + LastUpgradeCheck = 1600; TargetAttributes = { 88AD13742834355000500B2E = { CreatedOnToolsVersion = 13.2.1; diff --git a/Examples/Examples.xcodeproj/project.pbxproj b/Examples/Examples.xcodeproj/project.pbxproj index ff346a02d..918770b51 100644 --- a/Examples/Examples.xcodeproj/project.pbxproj +++ b/Examples/Examples.xcodeproj/project.pbxproj @@ -199,7 +199,7 @@ attributes = { BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1250; - LastUpgradeCheck = 1530; + LastUpgradeCheck = 1600; TargetAttributes = { E47ABE3F2652FE0900FD2FE3 = { CreatedOnToolsVersion = 12.5; diff --git a/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj b/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj index cfb81b7d9..25ebc3fb0 100644 --- a/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj +++ b/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj @@ -116,7 +116,7 @@ attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1430; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1600; TargetAttributes = { 88140D582A8BD940003F55D4 = { CreatedOnToolsVersion = 14.3.1; diff --git a/Test Runner/Test Runner.xcodeproj/project.pbxproj b/Test Runner/Test Runner.xcodeproj/project.pbxproj index 77e345d4c..6bab2f700 100644 --- a/Test Runner/Test Runner.xcodeproj/project.pbxproj +++ b/Test Runner/Test Runner.xcodeproj/project.pbxproj @@ -251,7 +251,7 @@ attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1400; - LastUpgradeCheck = 1530; + LastUpgradeCheck = 1600; TargetAttributes = { 7552A74F2A573CBB0023DA5A = { CreatedOnToolsVersion = 14.0; From d5b28a4a098f570d2a7f2240bda93647114e6c17 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 16:50:06 -0700 Subject: [PATCH 17/56] Update FlyoverExampleView.swift Main actor-isolated value of type '() async throws -> ()' passed as a strongly transferred parameter; later accesses could race --- Examples/Examples/FlyoverExampleView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Examples/FlyoverExampleView.swift b/Examples/Examples/FlyoverExampleView.swift index 2ecd4f3f4..705fa19e5 100644 --- a/Examples/Examples/FlyoverExampleView.swift +++ b/Examples/Examples/FlyoverExampleView.swift @@ -32,7 +32,7 @@ struct FlyoverExampleView: View { SceneView(scene: scene) .onSingleTapGesture { screen, _ in print("Identifying...") - Task.detached { @MainActor in + Task { @MainActor in let results = try await proxy.identifyLayers(screenPoint: screen, tolerance: 20) print("\(results.count) identify result(s).") } From b7414cc61f1d4bcf7630ae3a2db04f4b26cba4ef Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 16:51:05 -0700 Subject: [PATCH 18/56] Update TableTopExampleView.swift Main actor-isolated value of type '() async throws -> ()' passed as a strongly transferred parameter; later accesses could race --- Examples/Examples/TableTopExampleView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Examples/TableTopExampleView.swift b/Examples/Examples/TableTopExampleView.swift index fb8845206..fc1d78225 100644 --- a/Examples/Examples/TableTopExampleView.swift +++ b/Examples/Examples/TableTopExampleView.swift @@ -49,7 +49,7 @@ struct TableTopExampleView: View { SceneView(scene: scene) .onSingleTapGesture { screen, _ in print("Identifying...") - Task.detached { @MainActor in + Task { @MainActor in let results = try await proxy.identifyLayers(screenPoint: screen, tolerance: 20) print("\(results.count) identify result(s).") } From f13fa49c429634aac8d2a5818733d076dc85c2c4 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 16:52:22 -0700 Subject: [PATCH 19/56] Update GroupView.swift Main actor-isolated value of type '() async -> ()' passed as a strongly transferred parameter; later accesses could race --- .../Components/FeatureFormView/Subviews/GroupView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/GroupView.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/GroupView.swift index 7203dd30b..04ecf5868 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/GroupView.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/GroupView.swift @@ -61,7 +61,7 @@ struct GroupView: View where Content: View { .onAppear { isExpanded = element.initialState == .expanded for element in element.elements { - let newTask = Task.detached { @MainActor [self] in + let newTask = Task { @MainActor [self] in for await _ in element.$isVisible { self.updateVisibleElements() } From 10be361211fb0a1351deef5ca57ceaf1419bbf81 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 16:53:08 -0700 Subject: [PATCH 20/56] Update HTMLTextView.swift Main actor-isolated value of type '() async -> ()' passed as a strongly transferred parameter; later accesses could race --- Sources/ArcGISToolkit/Components/Popups/HTMLTextView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/Popups/HTMLTextView.swift b/Sources/ArcGISToolkit/Components/Popups/HTMLTextView.swift index 22dca1e58..048fae09a 100644 --- a/Sources/ArcGISToolkit/Components/Popups/HTMLTextView.swift +++ b/Sources/ArcGISToolkit/Components/Popups/HTMLTextView.swift @@ -144,7 +144,7 @@ extension HTMLTextView.Coordinator: WKNavigationDelegate { // `WKNavigationDelegate` method invoked when a main frame navigation completes. This is // where the height calculation happens. func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { - Task.detached { @MainActor [onHeightChanged] in + Task { @MainActor [onHeightChanged] in guard let readyState = try? await webView.evaluateJavaScript("document.readyState") as? String, readyState == "complete" else { return From edaa5cd40ba15d70b3a123947b7a1e37ffafb701 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 17:33:52 -0700 Subject: [PATCH 21/56] Fix `SearchSource` sendability errors Fixes "Sending 'source' risks causing data races" at https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/b322842cf427b4c8d59b00768af7d9b8c75ad1f1/Sources/ArcGISToolkit/Components/Search/SearchViewModel.swift#L256 and https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/b322842cf427b4c8d59b00768af7d9b8c75ad1f1/Sources/ArcGISToolkit/Components/Search/SearchViewModel.swift#L270 and https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/b322842cf427b4c8d59b00768af7d9b8c75ad1f1/Sources/ArcGISToolkit/Components/Search/SearchViewModel.swift#L285 --- .../ArcGISToolkit/Components/Search/LocatorSearchSource.swift | 2 +- Sources/ArcGISToolkit/Components/Search/SearchSource.swift | 2 +- .../Components/Search/SmartLocatorSearchSource.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/ArcGISToolkit/Components/Search/LocatorSearchSource.swift b/Sources/ArcGISToolkit/Components/Search/LocatorSearchSource.swift index b2c03ba00..9a5bfc902 100644 --- a/Sources/ArcGISToolkit/Components/Search/LocatorSearchSource.swift +++ b/Sources/ArcGISToolkit/Components/Search/LocatorSearchSource.swift @@ -18,7 +18,7 @@ import Foundation /// Uses a Locator to provide search and suggest results. Most configuration should be done on the /// `GeocodeParameters` directly. -public class LocatorSearchSource: ObservableObject, SearchSource { +public class LocatorSearchSource: ObservableObject, SearchSource, @unchecked Sendable { /// Creates a locator search source. /// - Parameters: /// - name: The name to show when presenting this source in the UI. diff --git a/Sources/ArcGISToolkit/Components/Search/SearchSource.swift b/Sources/ArcGISToolkit/Components/Search/SearchSource.swift index 09b880d83..c84826bd9 100644 --- a/Sources/ArcGISToolkit/Components/Search/SearchSource.swift +++ b/Sources/ArcGISToolkit/Components/Search/SearchSource.swift @@ -15,7 +15,7 @@ import ArcGIS /// Defines the contract for a search result provider. -public protocol SearchSource { +public protocol SearchSource: Sendable { /// Name to show when presenting this source in the UI. var name: String { get set } diff --git a/Sources/ArcGISToolkit/Components/Search/SmartLocatorSearchSource.swift b/Sources/ArcGISToolkit/Components/Search/SmartLocatorSearchSource.swift index 24dcd8569..b5ec96217 100644 --- a/Sources/ArcGISToolkit/Components/Search/SmartLocatorSearchSource.swift +++ b/Sources/ArcGISToolkit/Components/Search/SmartLocatorSearchSource.swift @@ -17,7 +17,7 @@ import ArcGIS /// Extends `LocatorSearchSource` with intelligent search behaviors; adds support for features like /// type-specific placemarks, repeated search, and more on the world geocode service. -public class SmartLocatorSearchSource: LocatorSearchSource { +public class SmartLocatorSearchSource: LocatorSearchSource, @unchecked Sendable { /// Creates a smart locator search source. /// - Parameters: /// - name: Name to show when presenting this source in the UI. From abc22c4684d0de44895772bdf2a388112e77eaf9 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 17:35:50 -0700 Subject: [PATCH 22/56] Update ExampleView.swift Property was unused and Main actor-isolated property 'id' cannot be used to satisfy nonisolated protocol requirement --- Examples/ExamplesApp/ExampleView.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Examples/ExamplesApp/ExampleView.swift b/Examples/ExamplesApp/ExampleView.swift index e8f279fec..abd2bd4ae 100644 --- a/Examples/ExamplesApp/ExampleView.swift +++ b/Examples/ExamplesApp/ExampleView.swift @@ -24,7 +24,3 @@ struct ExampleView: View { .navigationBarTitleDisplayMode(.inline) } } - -extension ExampleView: Identifiable { - var id: String { example.name } -} From ea5f86ff98057b91f66a14f1d80253ce47199363 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 17:38:58 -0700 Subject: [PATCH 23/56] Update AnyExample.swift Fixes various instances of "Call to main actor-isolated initializer 'init()' in a synchronous nonisolated context" in Examples.swift --- Examples/ExamplesApp/AnyExample.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/ExamplesApp/AnyExample.swift b/Examples/ExamplesApp/AnyExample.swift index 54900ad34..d28c8412f 100644 --- a/Examples/ExamplesApp/AnyExample.swift +++ b/Examples/ExamplesApp/AnyExample.swift @@ -16,9 +16,9 @@ import SwiftUI struct AnyExample { var name: String - var content: @MainActor () -> Content + var content: () -> Content - init(_ name: String, content: @autoclosure @escaping @MainActor () -> Content) { + init(_ name: String, content: @autoclosure @escaping () -> Content) { self.name = name self.content = content } From 0d726f1275091fa167f976f28d0162b5d118df4c Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 17:41:53 -0700 Subject: [PATCH 24/56] Drop `MainActor.runUnsafely` Fixes "Sending 'self' risks causing data races" @ ARSwiftUIView.swift line 153 --- .../Utilities/ARSwiftUIView.swift | 5 ++- .../Extensions/Swift/MainActor.swift | 43 ------------------- 2 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 Sources/ArcGISToolkit/Extensions/Swift/MainActor.swift diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift index 03c6bd839..9a302d063 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift @@ -143,14 +143,15 @@ extension ARSwiftUIView { } /// A proxy for the ARSwiftUIView. -class ARSwiftUIViewProxy: NSObject, ARSessionProviding { +@MainActor +class ARSwiftUIViewProxy: NSObject, @preconcurrency ARSessionProviding, Sendable { /// The underlying AR view. /// This is set by the ARSwiftUIView when it is available. fileprivate var arView: ARViewType! /// The AR session. @objc dynamic var session: ARSession { - MainActor.runUnsafely { arView.session } + arView.session } } diff --git a/Sources/ArcGISToolkit/Extensions/Swift/MainActor.swift b/Sources/ArcGISToolkit/Extensions/Swift/MainActor.swift deleted file mode 100644 index 06b193a62..000000000 --- a/Sources/ArcGISToolkit/Extensions/Swift/MainActor.swift +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2024 Esri -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import Dispatch - -extension MainActor { - /// A version of `assumeIsolated` for use on iOS 16 with the Swift 5.9 - /// compiler. - /// - Note: Remove when either the minimum version of Xcode is 15.3 (or - /// newer) or the deployment target is iOS 17. - @available(iOS, introduced: 16.0, obsoleted: 17.0) - @_unavailableFromAsync - static func runUnsafely( - _ body: @MainActor () throws -> T, - file: StaticString = #fileID, - line: UInt = #line - ) rethrows -> T { - if #available(iOS 17.0, *) { - return try MainActor.assumeIsolated(body, file: file, line: line) - } else { -#if compiler(>=5.10) - return try MainActor.assumeIsolated(body, file: file, line: line) -#else - // https://forums.swift.org/t/replacement-for-mainactor-unsafe/65956/2 - dispatchPrecondition(condition: .onQueue(.main)) - return try withoutActuallyEscaping(body) { fn in - try unsafeBitCast(fn, to: (() throws -> T).self)() - } -#endif - } - } -} From cb311756b9b29cd761fbe981dc684fe7fd7659e0 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 23 Sep 2024 17:51:24 -0700 Subject: [PATCH 25/56] Update ValueContinuation.swift Sending 'value' risks causing data races --- .../Components/Authentication/ValueContinuation.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/Authentication/ValueContinuation.swift b/Sources/ArcGISToolkit/Components/Authentication/ValueContinuation.swift index 61a0380ff..ebc905859 100644 --- a/Sources/ArcGISToolkit/Components/Authentication/ValueContinuation.swift +++ b/Sources/ArcGISToolkit/Components/Authentication/ValueContinuation.swift @@ -28,7 +28,9 @@ import Foundation func setValue(_ value: Value) { guard _value == nil else { return } _value = value - continuation?.resume(returning: value) + Task { + continuation?.resume(returning: value) + } } /// The value. This property supports only one consumer. From 1eba326cd3512c2cb46ffc818f64167b7f15c5ef Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 24 Sep 2024 14:26:17 -0700 Subject: [PATCH 26/56] Drop older Xcode `compatibilityVersion`s --- .../AuthenticationExample.xcodeproj/project.pbxproj | 1 - Examples/Examples.xcodeproj/project.pbxproj | 1 - JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj | 1 - Test Runner/Test Runner.xcodeproj/project.pbxproj | 1 - 4 files changed, 4 deletions(-) diff --git a/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj b/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj index 7ff6201f5..a5c4e0beb 100644 --- a/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj +++ b/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj @@ -141,7 +141,6 @@ }; }; buildConfigurationList = 88AD13702834355000500B2E /* Build configuration list for PBXProject "AuthenticationExample" */; - compatibilityVersion = "Xcode 13.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( diff --git a/Examples/Examples.xcodeproj/project.pbxproj b/Examples/Examples.xcodeproj/project.pbxproj index 918770b51..9aab407ad 100644 --- a/Examples/Examples.xcodeproj/project.pbxproj +++ b/Examples/Examples.xcodeproj/project.pbxproj @@ -207,7 +207,6 @@ }; }; buildConfigurationList = E47ABE3B2652FE0900FD2FE3 /* Build configuration list for PBXProject "Examples" */; - compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( diff --git a/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj b/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj index 25ebc3fb0..92b03c829 100644 --- a/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj +++ b/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj @@ -124,7 +124,6 @@ }; }; buildConfigurationList = 88140D542A8BD940003F55D4 /* Build configuration list for PBXProject "JobManagerExample" */; - compatibilityVersion = "Xcode 14.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( diff --git a/Test Runner/Test Runner.xcodeproj/project.pbxproj b/Test Runner/Test Runner.xcodeproj/project.pbxproj index 6bab2f700..1346ac20b 100644 --- a/Test Runner/Test Runner.xcodeproj/project.pbxproj +++ b/Test Runner/Test Runner.xcodeproj/project.pbxproj @@ -263,7 +263,6 @@ }; }; buildConfigurationList = 7552A74B2A573CBB0023DA5A /* Build configuration list for PBXProject "Test Runner" */; - compatibilityVersion = "Xcode 14.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( From 9f22362665aa56696c404c186a06cecd9f93e77e Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 24 Sep 2024 14:27:02 -0700 Subject: [PATCH 27/56] Add Xcode 16 `preferredProjectObjectVersion` --- .../AuthenticationExample.xcodeproj/project.pbxproj | 1 + Examples/Examples.xcodeproj/project.pbxproj | 1 + JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj | 1 + Test Runner/Test Runner.xcodeproj/project.pbxproj | 1 + 4 files changed, 4 insertions(+) diff --git a/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj b/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj index a5c4e0beb..0262abb9c 100644 --- a/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj +++ b/AuthenticationExample/AuthenticationExample.xcodeproj/project.pbxproj @@ -148,6 +148,7 @@ Base, ); mainGroup = 88AD136C2834355000500B2E; + preferredProjectObjectVersion = 77; productRefGroup = 88AD13762834355000500B2E /* Products */; projectDirPath = ""; projectRoot = ""; diff --git a/Examples/Examples.xcodeproj/project.pbxproj b/Examples/Examples.xcodeproj/project.pbxproj index 9aab407ad..85eb19794 100644 --- a/Examples/Examples.xcodeproj/project.pbxproj +++ b/Examples/Examples.xcodeproj/project.pbxproj @@ -214,6 +214,7 @@ Base, ); mainGroup = E47ABE372652FE0900FD2FE3; + preferredProjectObjectVersion = 77; productRefGroup = E47ABE412652FE0900FD2FE3 /* Products */; projectDirPath = ""; projectRoot = ""; diff --git a/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj b/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj index 92b03c829..2b7f5f24d 100644 --- a/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj +++ b/JobManagerExample/JobManagerExample.xcodeproj/project.pbxproj @@ -131,6 +131,7 @@ Base, ); mainGroup = 88140D502A8BD940003F55D4; + preferredProjectObjectVersion = 77; productRefGroup = 88140D5A2A8BD940003F55D4 /* Products */; projectDirPath = ""; projectRoot = ""; diff --git a/Test Runner/Test Runner.xcodeproj/project.pbxproj b/Test Runner/Test Runner.xcodeproj/project.pbxproj index 1346ac20b..24eea8c6b 100644 --- a/Test Runner/Test Runner.xcodeproj/project.pbxproj +++ b/Test Runner/Test Runner.xcodeproj/project.pbxproj @@ -272,6 +272,7 @@ mainGroup = 7552A7472A573CBB0023DA5A; packageReferences = ( ); + preferredProjectObjectVersion = 77; productRefGroup = 7552A7512A573CBB0023DA5A /* Products */; projectDirPath = ""; projectRoot = ""; From aa4ededb099c89593ad7d41f7c7c82aacbdbb998 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 24 Sep 2024 15:08:13 -0700 Subject: [PATCH 28/56] Update LoginViewModifierTests.swift --- Tests/ArcGISToolkitTests/LoginViewModifierTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/ArcGISToolkitTests/LoginViewModifierTests.swift b/Tests/ArcGISToolkitTests/LoginViewModifierTests.swift index 68b574073..e7fa15fd8 100644 --- a/Tests/ArcGISToolkitTests/LoginViewModifierTests.swift +++ b/Tests/ArcGISToolkitTests/LoginViewModifierTests.swift @@ -15,6 +15,7 @@ import XCTest @testable import ArcGISToolkit +@MainActor final class LoginViewModifierTests: XCTestCase { func testMemberwiseInit() { var signInCalled = false From 51f2f05915b21b3dfec6088e479f2946ed90daf1 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 24 Sep 2024 15:12:40 -0700 Subject: [PATCH 29/56] Update RepresentedUITextViewTests.swift --- Test Runner/UI Tests/RepresentedUITextViewTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Test Runner/UI Tests/RepresentedUITextViewTests.swift b/Test Runner/UI Tests/RepresentedUITextViewTests.swift index d987956a1..77812ab80 100644 --- a/Test Runner/UI Tests/RepresentedUITextViewTests.swift +++ b/Test Runner/UI Tests/RepresentedUITextViewTests.swift @@ -14,6 +14,7 @@ import XCTest +@MainActor final class RepresentedUITextViewTests: XCTestCase { func testInit() { let app = XCUIApplication() From 88ce73320682fa412e24599a9c8f57e341bb9d99 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 24 Sep 2024 15:13:10 -0700 Subject: [PATCH 30/56] Update FormViewTests.swift --- Test Runner/UI Tests/FormViewTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Test Runner/UI Tests/FormViewTests.swift b/Test Runner/UI Tests/FormViewTests.swift index e06fd75bd..5942cf214 100644 --- a/Test Runner/UI Tests/FormViewTests.swift +++ b/Test Runner/UI Tests/FormViewTests.swift @@ -14,6 +14,7 @@ import XCTest +@MainActor final class FeatureFormViewTests: XCTestCase { override func setUp() async throws { continueAfterFailure = false From 5495f9a0468a950b4fb0d79dde4adb7082158639 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 24 Sep 2024 15:16:28 -0700 Subject: [PATCH 31/56] Update FloorFilterTests.swift --- Test Runner/UI Tests/FloorFilterTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Test Runner/UI Tests/FloorFilterTests.swift b/Test Runner/UI Tests/FloorFilterTests.swift index 8b87a4b6e..7d3527023 100644 --- a/Test Runner/UI Tests/FloorFilterTests.swift +++ b/Test Runner/UI Tests/FloorFilterTests.swift @@ -14,6 +14,7 @@ import XCTest +@MainActor final class FloorFilterTests: XCTestCase { override func setUpWithError() throws { continueAfterFailure = false From 203dc65d0a2d2aee8e1a2c8b4afca5423cc75a85 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 24 Sep 2024 15:19:39 -0700 Subject: [PATCH 32/56] Update BookmarksTests.swift --- Test Runner/UI Tests/BookmarksTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Test Runner/UI Tests/BookmarksTests.swift b/Test Runner/UI Tests/BookmarksTests.swift index ef1763455..5638d818c 100644 --- a/Test Runner/UI Tests/BookmarksTests.swift +++ b/Test Runner/UI Tests/BookmarksTests.swift @@ -14,6 +14,7 @@ import XCTest +@MainActor final class BookmarksTests: XCTestCase { override func setUpWithError() throws { continueAfterFailure = false From 24c7c120d0ff01eb3a4d0d90e47e1ee0d1df1b6b Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 24 Sep 2024 15:24:31 -0700 Subject: [PATCH 33/56] Update BasemapGalleryTests.swift --- Test Runner/UI Tests/BasemapGalleryTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Test Runner/UI Tests/BasemapGalleryTests.swift b/Test Runner/UI Tests/BasemapGalleryTests.swift index 09ec82e3a..cde600084 100644 --- a/Test Runner/UI Tests/BasemapGalleryTests.swift +++ b/Test Runner/UI Tests/BasemapGalleryTests.swift @@ -14,6 +14,7 @@ import XCTest +@MainActor final class BasemapGalleryTests: XCTestCase { override func setUpWithError() throws { continueAfterFailure = false From 47aa4f728827be994e738254a7c2ca1be452d45f Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 24 Sep 2024 15:25:47 -0700 Subject: [PATCH 34/56] Update AttachmentCameraControllerTests.swift --- Test Runner/UI Tests/AttachmentCameraControllerTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Test Runner/UI Tests/AttachmentCameraControllerTests.swift b/Test Runner/UI Tests/AttachmentCameraControllerTests.swift index 45c2c0a76..c34e21ac3 100644 --- a/Test Runner/UI Tests/AttachmentCameraControllerTests.swift +++ b/Test Runner/UI Tests/AttachmentCameraControllerTests.swift @@ -14,6 +14,7 @@ import XCTest +@MainActor final class AttachmentCameraControllerTests: XCTestCase { override func setUpWithError() throws { continueAfterFailure = true From c90e603f42f2ed35af6cf475dcbb8d660fcd0645 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 24 Sep 2024 16:50:31 -0700 Subject: [PATCH 35/56] Revert "Add missing default case to `TextFormElementView`" This reverts commit aae526d41e659d8761d1f394036d1543244805e2. --- .../FeatureFormView/Subviews/TextFormElementView.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/TextFormElementView.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/TextFormElementView.swift index 3b22b2dd7..3bc029d9d 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/TextFormElementView.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/TextFormElementView.swift @@ -27,8 +27,6 @@ struct TextFormElementView: View { MarkdownView(markdown: text) case .plainText: Text(text) - default: - EmptyView() } } .task { From 399a49534063f3027765e5d8298ca7408d758d20 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 27 Sep 2024 16:46:37 -0700 Subject: [PATCH 36/56] Update TableTopSceneView.swift --- .../Components/Augmented Reality/TableTopSceneView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift index 002ab32c7..6a2b11a91 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift @@ -219,7 +219,7 @@ public struct TableTopSceneView: View { } } - /// Sets the visibility of the coaching overlay view for the AR experince. + /// Sets the visibility of the coaching overlay view for the AR experience. /// - Parameter hidden: A Boolean value that indicates whether to hide the /// coaching overlay view. public func coachingOverlayHidden(_ hidden: Bool) -> Self { From 3f2d86f700612afef03a8315b6788c968201fe3d Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 1 Oct 2024 16:19:35 -0700 Subject: [PATCH 37/56] Update ARSwiftUIView.swift --- .../Components/Augmented Reality/Utilities/ARSwiftUIView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift index 9a302d063..3061b44c7 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift @@ -144,7 +144,7 @@ extension ARSwiftUIView { /// A proxy for the ARSwiftUIView. @MainActor -class ARSwiftUIViewProxy: NSObject, @preconcurrency ARSessionProviding, Sendable { +class ARSwiftUIViewProxy: NSObject, @preconcurrency ARSessionProviding { /// The underlying AR view. /// This is set by the ARSwiftUIView when it is available. fileprivate var arView: ARViewType! From ee2da5794268944e248a239c65e43d953a35450d Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 2 Oct 2024 10:09:52 -0700 Subject: [PATCH 38/56] Update Package.swift Co-authored-by: Philip Ridgeway --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 113a46771..9a5c85a4a 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:6.0 +// swift-tools-version: 6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. // Copyright 2021 Esri // From e319a14fac16b133e6b3f0f0e10c48ca080618a0 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 2 Oct 2024 10:44:13 -0700 Subject: [PATCH 39/56] Remove `@MainActor` from `ExampleList` --- Examples/ExamplesApp/ExampleList.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Examples/ExamplesApp/ExampleList.swift b/Examples/ExamplesApp/ExampleList.swift index c4b280ec2..e1625523a 100644 --- a/Examples/ExamplesApp/ExampleList.swift +++ b/Examples/ExamplesApp/ExampleList.swift @@ -14,7 +14,6 @@ import SwiftUI -@MainActor struct ExampleList: View { /// The name of the list of examples. let name: String From 3661c3d0af416dc231a4c3f4de02e2caa72c2e19 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 2 Oct 2024 11:10:20 -0700 Subject: [PATCH 40/56] Remove unneeded `@MainActor` annotation from `BasemapGalleryExampleView` --- Examples/Examples/BasemapGalleryExampleView.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Examples/Examples/BasemapGalleryExampleView.swift b/Examples/Examples/BasemapGalleryExampleView.swift index 1f2872f2d..fe381e1f6 100644 --- a/Examples/Examples/BasemapGalleryExampleView.swift +++ b/Examples/Examples/BasemapGalleryExampleView.swift @@ -16,7 +16,6 @@ import ArcGIS import ArcGISToolkit import SwiftUI -@MainActor struct BasemapGalleryExampleView: View { /// A Boolean value indicating whether the basemap gallery is presented. @State private var basemapGalleryIsPresented = false From 065aa812285f0d7bd58deb561d9e3dc9f651e457 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 2 Oct 2024 11:50:58 -0700 Subject: [PATCH 41/56] Conform `ValueContinuation` generic type to `Sendable` https: //github.com/Esri/arcgis-maps-sdk-swift-toolkit/pull/883#discussion_r1783648153 Co-Authored-By: Philip Ridgeway --- .../Components/Authentication/ValueContinuation.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Sources/ArcGISToolkit/Components/Authentication/ValueContinuation.swift b/Sources/ArcGISToolkit/Components/Authentication/ValueContinuation.swift index ebc905859..f6ccc5f5d 100644 --- a/Sources/ArcGISToolkit/Components/Authentication/ValueContinuation.swift +++ b/Sources/ArcGISToolkit/Components/Authentication/ValueContinuation.swift @@ -16,7 +16,7 @@ import Foundation /// An object that allows a consumer to await on a value and a provider to provide a value /// asynchronously. This is effectively a continuation that holds a value. -@MainActor class ValueContinuation { +@MainActor class ValueContinuation { /// The value. private var _value: Value? @@ -28,9 +28,7 @@ import Foundation func setValue(_ value: Value) { guard _value == nil else { return } _value = value - Task { - continuation?.resume(returning: value) - } + continuation?.resume(returning: value) } /// The value. This property supports only one consumer. From 678747ff41dab74f4d218be12ca9e0c507f9394a Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 2 Oct 2024 12:36:58 -0700 Subject: [PATCH 42/56] Update AttachmentCameraControllerTests.swift Button is "Allow" instead of "OK" in iOS 17 --- .../UI Tests/AttachmentCameraControllerTests.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Test Runner/UI Tests/AttachmentCameraControllerTests.swift b/Test Runner/UI Tests/AttachmentCameraControllerTests.swift index c34e21ac3..724f21bd7 100644 --- a/Test Runner/UI Tests/AttachmentCameraControllerTests.swift +++ b/Test Runner/UI Tests/AttachmentCameraControllerTests.swift @@ -35,8 +35,6 @@ final class AttachmentCameraControllerTests: XCTestCase { let cameraModeLabel = app.staticTexts["Camera Capture Mode"] let device = UIDevice.current.userInterfaceIdiom let orientation = app.staticTexts["Device Orientation"] - let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard") - let allowButton = springboard.buttons["OK"] app.launch() @@ -81,3 +79,14 @@ final class AttachmentCameraControllerTests: XCTestCase { XCTAssertEqual(cameraModeLabel.label, "Photo") } } + +private extension AttachmentCameraControllerTests { + var allowButton: XCUIElement { + let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard") + if #available(iOS 18.0, *) { + return springboard.buttons["Allow"] + } else { + return springboard.buttons["OK"] + } + } +} From 50664bfe6ddaba15a5238524753ecd4c504946fd Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 2 Oct 2024 12:39:23 -0700 Subject: [PATCH 43/56] Annotate `action` on `onCameraCaptureModeChanged(perform:)` `@MainActor` https: //github.com/Esri/arcgis-maps-sdk-swift-toolkit/pull/883#discussion_r1783654114 Co-Authored-By: Philip Ridgeway --- .../AttachmentHelpers/AttachmentCameraController.swift | 2 +- .../AttachmentHelpers/AttachmentImportMenu.swift | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift index 843034323..fae249df5 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift @@ -81,7 +81,7 @@ final class CameraControllerCoordinator: NSObject, UIImagePickerControllerDelega extension AttachmentCameraController { /// Specifies an action to perform when the camera capture mode has changed from photo to video or vice versa. /// - Parameter action: The new camera capture mode. - func onCameraCaptureModeChanged(perform action: @Sendable @escaping (_: UIImagePickerController.CameraCaptureMode) -> Void) -> Self { + func onCameraCaptureModeChanged(perform action: @MainActor @Sendable @escaping (_: UIImagePickerController.CameraCaptureMode) -> Void) -> Self { self.controller.action = action return self } diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift index a52a745b5..5d7ec0fb5 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift @@ -204,9 +204,7 @@ struct AttachmentImportMenu: View { #if !targetEnvironment(macCatalyst) && !targetEnvironment(simulator) .onCameraCaptureModeChanged { captureMode in if captureMode == .video && AVCaptureDevice.authorizationStatus(for: .audio) == .denied { - Task { @MainActor in - microphoneAccessAlertIsVisible = true - } + microphoneAccessAlertIsVisible = true } } #endif From beece08ea14e596275d8e8ecbd3787c89e55f18f Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 4 Oct 2024 14:21:54 -0700 Subject: [PATCH 44/56] Enable `Carousel.iOS18Implementation` --- Sources/ArcGISToolkit/Utility/Carousel.swift | 34 +++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/Sources/ArcGISToolkit/Utility/Carousel.swift b/Sources/ArcGISToolkit/Utility/Carousel.swift index d4267cf01..7f887b178 100644 --- a/Sources/ArcGISToolkit/Utility/Carousel.swift +++ b/Sources/ArcGISToolkit/Utility/Carousel.swift @@ -42,11 +42,9 @@ struct Carousel: View { self.content = content } - /// - Note: The iOS 18 version currently uses `legacyImplementation` as - /// `iOS18Implementation` contains symbols not available in Xcode 15.4. var body: some View { if #available(iOS 18.0, *) { - legacyImplementation + iOS18Implementation } else { legacyImplementation } @@ -71,22 +69,20 @@ struct Carousel: View { .frame(height: cellSize.height) } -// The iOS 18 implementation is commented as it contains symbols not -// available in Xcode 15.4. -// @available(iOS 18.0, *) -// var iOS18Implementation: some View { -// ScrollViewReader { scrollViewProxy in -// ScrollView(.horizontal) { -// makeCommonScrollViewContent(scrollViewProxy) -// .padding(.bottom, 10) -// } -// } -// .onScrollGeometryChange(for: CGFloat.self) { geometry in -// geometry.containerSize.width -// } action: { _, newValue in -// updateCellSizeForContainer(newValue) -// } -// } + @available(iOS 18.0, *) + var iOS18Implementation: some View { + ScrollViewReader { scrollViewProxy in + ScrollView(.horizontal) { + makeCommonScrollViewContent(scrollViewProxy) + .padding(.bottom, 10) + } + } + .onScrollGeometryChange(for: CGFloat.self) { geometry in + geometry.containerSize.width + } action: { _, newValue in + updateCellSizeForContainer(newValue) + } + } func makeCommonScrollViewContent(_ scrollViewProxy: ScrollViewProxy) -> some View { HStack(spacing: cellSpacing) { From e77ca13ebc70cea414984ab2cda259d596c57b82 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 4 Oct 2024 15:15:03 -0700 Subject: [PATCH 45/56] Drop redundant `@MainActor`s As of Xcode 16 `View` is `@MainActor` --- .../AuthenticationExample/LoadableImageView.swift | 1 - .../AuthenticationExample/MapItemView.swift | 1 - .../AuthenticationExample/ProfileView.swift | 1 - AuthenticationExample/AuthenticationExample/SignInView.swift | 1 - Examples/Examples/WorldScaleExampleView.swift | 1 - .../JobManagerExample/JobManagerExampleView.swift | 1 - JobManagerExample/JobManagerExample/View.swift | 1 - Sources/ArcGISToolkit/Common/AttachmentPreview.swift | 1 - .../ArcGISToolkit/Common/AttachmentsFeatureElementView.swift | 5 ----- Sources/ArcGISToolkit/Common/ThumbnailView.swift | 1 - .../Components/Augmented Reality/FlyoverSceneView.swift | 1 - .../Components/Augmented Reality/TableTopSceneView.swift | 1 - .../Augmented Reality/Utilities/CalibrationView.swift | 1 - .../Augmented Reality/Utilities/GeoTrackingSceneView.swift | 2 -- .../Augmented Reality/Utilities/WorldTrackingSceneView.swift | 1 - .../Components/Augmented Reality/WorldScaleSceneView.swift | 1 - .../Components/BasemapGallery/BasemapGallery.swift | 1 - .../Components/BasemapGallery/BasemapGalleryCell.swift | 1 - Sources/ArcGISToolkit/Components/Bookmarks/Bookmarks.swift | 1 - Sources/ArcGISToolkit/Components/Compass/Compass.swift | 1 - .../AttachmentHelpers/AttachmentCameraController.swift | 1 - .../AttachmentHelpers/AttachmentImportMenu.swift | 1 - .../AttachmentHelpers/AttachmentPhotoPicker.swift | 1 - .../Components/FeatureFormView/FeatureFormView.swift | 1 - .../Components/FeatureFormView/Subviews/GroupView.swift | 1 - .../FeatureFormView/Subviews/Inputs/ComboBoxInput.swift | 1 - .../FeatureFormView/Subviews/Inputs/DateTimeInput.swift | 1 - .../FeatureFormView/Subviews/Inputs/Other/InputFooter.swift | 1 - .../FeatureFormView/Subviews/Inputs/Other/InputHeader.swift | 1 - .../FeatureFormView/Subviews/Inputs/RadioButtonsInput.swift | 1 - .../FeatureFormView/Subviews/Inputs/TextInput.swift | 1 - .../Components/FloatingPanel/FloatingPanel.swift | 1 - .../ArcGISToolkit/Components/FloorFilter/FloorFilter.swift | 1 - .../ArcGISToolkit/Components/FloorFilter/LevelSelector.swift | 1 - .../Components/FloorFilter/SiteAndFacilitySelector.swift | 1 - Sources/ArcGISToolkit/Components/OverviewMap.swift | 1 - .../Components/Popups/PopupMedia/Charts/PieChart.swift | 2 -- Sources/ArcGISToolkit/Components/Popups/PopupView.swift | 1 - Sources/ArcGISToolkit/Components/Scalebar/Scalebar.swift | 1 - Sources/ArcGISToolkit/Components/Search/SearchView.swift | 1 - .../Components/UtilityNetworkTrace/UtilityNetworkTrace.swift | 1 - .../ArcGISToolkit/Extensions/SwiftUI/View+FeatureForm.swift | 1 - .../ArcGISToolkit/Extensions/SwiftUI/View+FormInput.swift | 1 - Sources/ArcGISToolkit/Utility/AsyncImageView.swift | 1 - Sources/ArcGISToolkit/Utility/SearchField.swift | 1 - .../Test Runner/TestViews/BasemapGalleryTestView.swift | 1 - Test Runner/Test Runner/TestViews/FeatureFormTestView.swift | 3 +-- 47 files changed, 1 insertion(+), 54 deletions(-) diff --git a/AuthenticationExample/AuthenticationExample/LoadableImageView.swift b/AuthenticationExample/AuthenticationExample/LoadableImageView.swift index 9263f0e3f..02c716e66 100644 --- a/AuthenticationExample/AuthenticationExample/LoadableImageView.swift +++ b/AuthenticationExample/AuthenticationExample/LoadableImageView.swift @@ -18,7 +18,6 @@ import SwiftUI /// A view that loads a `LoadableImage` and displays it. /// While the image is loading a progress view is displayed. /// If there is an error displaying the image a red exclamation circle is displayed. -@MainActor struct LoadableImageView: View { /// The loadable image to display. let loadableImage: LoadableImage diff --git a/AuthenticationExample/AuthenticationExample/MapItemView.swift b/AuthenticationExample/AuthenticationExample/MapItemView.swift index 26e8374f4..faa861cdc 100644 --- a/AuthenticationExample/AuthenticationExample/MapItemView.swift +++ b/AuthenticationExample/AuthenticationExample/MapItemView.swift @@ -16,7 +16,6 @@ import ArcGIS import SwiftUI /// A view that displays a map. -@MainActor struct MapItemView: View { /// The map that is to be displayed. let map: Map diff --git a/AuthenticationExample/AuthenticationExample/ProfileView.swift b/AuthenticationExample/AuthenticationExample/ProfileView.swift index 9f01e2b62..06a88ce0f 100644 --- a/AuthenticationExample/AuthenticationExample/ProfileView.swift +++ b/AuthenticationExample/AuthenticationExample/ProfileView.swift @@ -17,7 +17,6 @@ import ArcGISToolkit import SwiftUI /// A view that displays the profile of a user. -@MainActor struct ProfileView: View { /// The portal that the user is signed in to. let portal: Portal diff --git a/AuthenticationExample/AuthenticationExample/SignInView.swift b/AuthenticationExample/AuthenticationExample/SignInView.swift index 85a211390..7e772de1b 100644 --- a/AuthenticationExample/AuthenticationExample/SignInView.swift +++ b/AuthenticationExample/AuthenticationExample/SignInView.swift @@ -18,7 +18,6 @@ import CryptoKit import SwiftUI /// A view that allows the user to sign in to a portal. -@MainActor struct SignInView: View { /// The error that occurred during an attempt to sign in. @State private var error: Error? diff --git a/Examples/Examples/WorldScaleExampleView.swift b/Examples/Examples/WorldScaleExampleView.swift index 597c5913f..566ba3cba 100644 --- a/Examples/Examples/WorldScaleExampleView.swift +++ b/Examples/Examples/WorldScaleExampleView.swift @@ -20,7 +20,6 @@ import SwiftUI /// An example that utilizes the `WorldScaleSceneView` to show an augmented reality view /// of your current location. Because this is an example that can be run from anywhere, /// it places a red circle around your initial location which can be explored. -@MainActor struct WorldScaleExampleView: View { @State private var scene: ArcGIS.Scene = { // Creates an elevation source from Terrain3D REST service. diff --git a/JobManagerExample/JobManagerExample/JobManagerExampleView.swift b/JobManagerExample/JobManagerExample/JobManagerExampleView.swift index 0b5b10346..25293333c 100644 --- a/JobManagerExample/JobManagerExample/JobManagerExampleView.swift +++ b/JobManagerExample/JobManagerExample/JobManagerExampleView.swift @@ -18,7 +18,6 @@ import OSLog import SwiftUI import UserNotifications -@MainActor struct JobManagerExampleView: View { /// The job manager used by this view. @ObservedObject var jobManager = JobManager.shared diff --git a/JobManagerExample/JobManagerExample/View.swift b/JobManagerExample/JobManagerExample/View.swift index e26d28ab7..5e980b2f0 100644 --- a/JobManagerExample/JobManagerExample/View.swift +++ b/JobManagerExample/JobManagerExample/View.swift @@ -24,7 +24,6 @@ extension View { /// The value emitted by `sequence` is passed as a parameter to `action`. /// The `action` is called on the `MainActor`. /// - Returns: A view that triggers `action` when `sequence` emits a value. - @MainActor @ViewBuilder func onReceive( _ sequence: S, diff --git a/Sources/ArcGISToolkit/Common/AttachmentPreview.swift b/Sources/ArcGISToolkit/Common/AttachmentPreview.swift index 7f29d0e74..c2f6227d2 100644 --- a/Sources/ArcGISToolkit/Common/AttachmentPreview.swift +++ b/Sources/ArcGISToolkit/Common/AttachmentPreview.swift @@ -90,7 +90,6 @@ struct AttachmentPreview: View { /// /// - Note: The rename contextual action is disabled for attachments greater than the attachment download /// size limit as rename operations trigger a download which currently has adverse memory implications. - @MainActor func makeCarouselContent(for size: CGSize) -> some View { ForEach(attachmentModels) { attachmentModel in AttachmentCell(attachmentModel: attachmentModel, attachmentDownloadSizeLimit: attachmentDownloadSizeLimit, cellSize: size) diff --git a/Sources/ArcGISToolkit/Common/AttachmentsFeatureElementView.swift b/Sources/ArcGISToolkit/Common/AttachmentsFeatureElementView.swift index 436863811..f3c0d3523 100644 --- a/Sources/ArcGISToolkit/Common/AttachmentsFeatureElementView.swift +++ b/Sources/ArcGISToolkit/Common/AttachmentsFeatureElementView.swift @@ -17,7 +17,6 @@ import QuickLook import SwiftUI /// A view displaying an `AttachmentsFeatureElement`. -@MainActor struct AttachmentsFeatureElementView: View { /// The `AttachmentsFeatureElement` to display. let featureElement: AttachmentsFeatureElement @@ -159,7 +158,6 @@ struct AttachmentsFeatureElementView: View { /// Creates a model for the new attachment for display. /// - Parameter attachment: The added attachment. - @MainActor func onAdd(attachment: FeatureAttachment) -> Void { guard case .initialized(var models) = attachmentModelsState else { return } let newModel = AttachmentModel( @@ -178,7 +176,6 @@ struct AttachmentsFeatureElementView: View { /// - Parameters: /// - attachmentModel: The model for the attachment to rename. /// - newAttachmentName: The new attachment name. - @MainActor func onRename(attachmentModel: AttachmentModel, newAttachmentName: String) -> Void { if let attachment = attachmentModel.attachment as? FormAttachment { attachment.name = newAttachmentName @@ -190,7 +187,6 @@ struct AttachmentsFeatureElementView: View { /// Deletes the attachment associated with the given model. /// - Parameters: /// - attachmentModel: The model for the attachment to delete. - @MainActor func onDelete(attachmentModel: AttachmentModel) -> Void { if let element = featureElement as? AttachmentsFormElement, let attachment = attachmentModel.attachment as? FormAttachment { @@ -245,7 +241,6 @@ extension View { /// - element: The attachment form element to watch for changes on. /// - action: The action which watches for changes. /// - Returns: The modified view. - @MainActor @ViewBuilder func onAttachmentIsEditableChange( of element: AttachmentsFeatureElement, diff --git a/Sources/ArcGISToolkit/Common/ThumbnailView.swift b/Sources/ArcGISToolkit/Common/ThumbnailView.swift index e04eb5426..463bd2d9d 100644 --- a/Sources/ArcGISToolkit/Common/ThumbnailView.swift +++ b/Sources/ArcGISToolkit/Common/ThumbnailView.swift @@ -16,7 +16,6 @@ import ArcGIS import SwiftUI /// A view displaying a thumbnail image for an attachment. -@MainActor struct ThumbnailView: View { /// The model represented by the thumbnail. @ObservedObject var attachmentModel: AttachmentModel diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/FlyoverSceneView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/FlyoverSceneView.swift index 45f25082a..8d746a210 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/FlyoverSceneView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/FlyoverSceneView.swift @@ -17,7 +17,6 @@ import SwiftUI import ArcGIS /// A scene view that provides an augmented reality fly over experience. -@MainActor @preconcurrency public struct FlyoverSceneView: View { /// The AR session. diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift index 6a2b11a91..f4ce6248c 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift @@ -17,7 +17,6 @@ import SwiftUI import ArcGIS /// A scene view that provides an augmented reality table top experience. -@MainActor @preconcurrency public struct TableTopSceneView: View { /// The proxy for the ARSwiftUIView. diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/CalibrationView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/CalibrationView.swift index 771c55d1c..177b9bf1f 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/CalibrationView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/CalibrationView.swift @@ -63,7 +63,6 @@ class WorldScaleCalibrationViewModel: ObservableObject { extension WorldScaleSceneView { /// A view that allows the user to calibrate the heading of the scene view camera controller. - @MainActor struct CalibrationView: View { @ObservedObject var viewModel: WorldScaleCalibrationViewModel diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/GeoTrackingSceneView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/GeoTrackingSceneView.swift index cd6e33588..35933a3d4 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/GeoTrackingSceneView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/GeoTrackingSceneView.swift @@ -17,7 +17,6 @@ import SwiftUI import ArcGIS /// A scene view that provides an augmented reality world scale experience using geo-tracking. -@MainActor @preconcurrency public struct GeoTrackingSceneView: View { /// A Boolean value indicating if the camera was initially set. @@ -165,7 +164,6 @@ public struct GeoTrackingSceneView: View { cameraController.transformationMatrix = .identity } - @MainActor private func handleGeoTrackingStatusChange(_ status: ARGeoTrackingStatus) { switch status.state { case .notAvailable, .initializing, .localizing: diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/WorldTrackingSceneView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/WorldTrackingSceneView.swift index d51a4517f..cc745c18e 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/WorldTrackingSceneView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/WorldTrackingSceneView.swift @@ -17,7 +17,6 @@ import SwiftUI import ArcGIS /// A scene view that provides an augmented reality world scale experience using world-tracking. -@MainActor struct WorldTrackingSceneView: View { /// A Boolean value indicating if the camera was initially set. @Binding var initialCameraIsSet: Bool diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/WorldScaleSceneView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/WorldScaleSceneView.swift index 05797efa2..f26172093 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/WorldScaleSceneView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/WorldScaleSceneView.swift @@ -17,7 +17,6 @@ import SwiftUI import ArcGIS /// A scene view that provides an augmented reality world scale experience. -@MainActor @preconcurrency public struct WorldScaleSceneView: View { /// The clipping distance of the scene view. diff --git a/Sources/ArcGISToolkit/Components/BasemapGallery/BasemapGallery.swift b/Sources/ArcGISToolkit/Components/BasemapGallery/BasemapGallery.swift index 71605c2e7..a6d80ce6e 100644 --- a/Sources/ArcGISToolkit/Components/BasemapGallery/BasemapGallery.swift +++ b/Sources/ArcGISToolkit/Components/BasemapGallery/BasemapGallery.swift @@ -52,7 +52,6 @@ import ArcGIS /// To see it in action, try out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [BasemapGalleryExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/BasemapGalleryExampleView.swift) /// in the project. To learn more about using the `BasemapGallery` see the . -@MainActor @preconcurrency public struct BasemapGallery: View { /// The view style of the gallery. diff --git a/Sources/ArcGISToolkit/Components/BasemapGallery/BasemapGalleryCell.swift b/Sources/ArcGISToolkit/Components/BasemapGallery/BasemapGalleryCell.swift index 995c5eb04..838fe63a1 100644 --- a/Sources/ArcGISToolkit/Components/BasemapGallery/BasemapGalleryCell.swift +++ b/Sources/ArcGISToolkit/Components/BasemapGallery/BasemapGalleryCell.swift @@ -15,7 +15,6 @@ import SwiftUI /// A row or grid element representing a basemap gallery item. -@MainActor struct BasemapGalleryCell: View { /// The displayed item. @ObservedObject var item: BasemapGalleryItem diff --git a/Sources/ArcGISToolkit/Components/Bookmarks/Bookmarks.swift b/Sources/ArcGISToolkit/Components/Bookmarks/Bookmarks.swift index 420f5697c..d2b483d69 100644 --- a/Sources/ArcGISToolkit/Components/Bookmarks/Bookmarks.swift +++ b/Sources/ArcGISToolkit/Components/Bookmarks/Bookmarks.swift @@ -30,7 +30,6 @@ import SwiftUI /// To see it in action, try out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [BookmarksExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/BookmarksExampleView.swift) /// in the project. To learn more about using the `Bookmarks` component see the . -@MainActor @preconcurrency public struct Bookmarks: View { /// The data source used to initialize the view. diff --git a/Sources/ArcGISToolkit/Components/Compass/Compass.swift b/Sources/ArcGISToolkit/Components/Compass/Compass.swift index de77deb11..9e1d0f2a3 100644 --- a/Sources/ArcGISToolkit/Components/Compass/Compass.swift +++ b/Sources/ArcGISToolkit/Components/Compass/Compass.swift @@ -30,7 +30,6 @@ import SwiftUI /// To see it in action, try out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [CompassExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/CompassExampleView.swift) /// in the project. To learn more about using the `Compass` see the . -@MainActor @preconcurrency public struct Compass: View { /// The opacity of the compass. diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift index fae249df5..ebb541b93 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentCameraController.swift @@ -16,7 +16,6 @@ import SwiftUI import UniformTypeIdentifiers /// A UIImagePickerController wrapper to provide a native photo capture experience. -@MainActor struct AttachmentCameraController: UIViewControllerRepresentable { @Environment(\.dismiss) private var dismiss diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift index 5d7ec0fb5..586cf67f0 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentImportMenu.swift @@ -20,7 +20,6 @@ import UniformTypeIdentifiers internal import os /// The context menu shown when the new attachment button is pressed. -@MainActor struct AttachmentImportMenu: View { /// The attachment form element displaying the menu. private let element: AttachmentsFormElement diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentPhotoPicker.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentPhotoPicker.swift index 91daf12a2..16f8726b4 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentPhotoPicker.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/AttachmentHelpers/AttachmentPhotoPicker.swift @@ -16,7 +16,6 @@ import PhotosUI import SwiftUI /// A wrapper for the PhotosPicker API. -@MainActor struct AttachmentPhotoPicker: ViewModifier { /// The item selected in the photos picker. @State private var item: PhotosPickerItem? diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/FeatureFormView.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/FeatureFormView.swift index 3287c0533..5148431df 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/FeatureFormView.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/FeatureFormView.swift @@ -64,7 +64,6 @@ import SwiftUI /// `Info.plist` file. /// /// - Since: 200.4 -@MainActor @preconcurrency public struct FeatureFormView: View { /// The view model for the form. diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/GroupView.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/GroupView.swift index 04ecf5868..d7818482e 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/GroupView.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/GroupView.swift @@ -16,7 +16,6 @@ import ArcGIS import SwiftUI /// Displays a group form element and manages the visibility of the elements within the group. -@MainActor struct GroupView: View where Content: View { /// A Boolean value indicating whether the group is expanded or collapsed. @State private var isExpanded = false diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/ComboBoxInput.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/ComboBoxInput.swift index 3e1eb3e0a..1f6ac9ca8 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/ComboBoxInput.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/ComboBoxInput.swift @@ -18,7 +18,6 @@ import SwiftUI /// A view for numerical value input. /// /// This is the preferable input type for long lists of coded value domains. -@MainActor struct ComboBoxInput: View { /// The view model for the form. @EnvironmentObject var model: FormViewModel diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/DateTimeInput.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/DateTimeInput.swift index 4085b3293..171dca0a4 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/DateTimeInput.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/DateTimeInput.swift @@ -16,7 +16,6 @@ import ArcGIS import SwiftUI /// A view for date/time input. -@MainActor struct DateTimeInput: View { /// The view model for the form. @EnvironmentObject var model: FormViewModel diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/Other/InputFooter.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/Other/InputFooter.swift index 3d743687c..9fa1dfbe7 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/Other/InputFooter.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/Other/InputFooter.swift @@ -16,7 +16,6 @@ import ArcGIS import SwiftUI /// A view shown at the bottom of a field element in a form. -@MainActor struct InputFooter: View { @Environment(\.formElementPadding) var elementPadding diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/Other/InputHeader.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/Other/InputHeader.swift index 63d02f675..ff5a525cd 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/Other/InputHeader.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/Other/InputHeader.swift @@ -16,7 +16,6 @@ import ArcGIS import SwiftUI /// A view shown at the top of a field element in a form. -@MainActor struct InputHeader: View { @Environment(\.formElementPadding) var elementPadding diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/RadioButtonsInput.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/RadioButtonsInput.swift index 4c49a51fd..4331bac17 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/RadioButtonsInput.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/RadioButtonsInput.swift @@ -18,7 +18,6 @@ import SwiftUI /// A view for numerical value input. /// /// This is the preferable input type for short lists of coded value domains. -@MainActor struct RadioButtonsInput: View { /// The view model for the form. @EnvironmentObject var model: FormViewModel diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/TextInput.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/TextInput.swift index 06ccedf72..3099c4d08 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/TextInput.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/Inputs/TextInput.swift @@ -16,7 +16,6 @@ import ArcGIS import SwiftUI /// A view for text input. -@MainActor struct TextInput: View { /// The view model for the form. @EnvironmentObject var model: FormViewModel diff --git a/Sources/ArcGISToolkit/Components/FloatingPanel/FloatingPanel.swift b/Sources/ArcGISToolkit/Components/FloatingPanel/FloatingPanel.swift index 0b61693f4..f0c80cf74 100644 --- a/Sources/ArcGISToolkit/Components/FloatingPanel/FloatingPanel.swift +++ b/Sources/ArcGISToolkit/Components/FloatingPanel/FloatingPanel.swift @@ -16,7 +16,6 @@ import SwiftUI /// A floating panel is a view that overlays a view and supplies view-related /// content. For more information see . -@MainActor struct FloatingPanel: View where Content: View { /// The height of a geo-view's attribution bar. /// diff --git a/Sources/ArcGISToolkit/Components/FloorFilter/FloorFilter.swift b/Sources/ArcGISToolkit/Components/FloorFilter/FloorFilter.swift index 2c75af479..25375a515 100644 --- a/Sources/ArcGISToolkit/Components/FloorFilter/FloorFilter.swift +++ b/Sources/ArcGISToolkit/Components/FloorFilter/FloorFilter.swift @@ -62,7 +62,6 @@ import SwiftUI /// To see it in action, try out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [FloorFilterExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/FloorFilterExampleView.swift) /// in the project. To learn more about using the `FloorFilter` see the . -@MainActor @preconcurrency public struct FloorFilter: View { @Environment(\.horizontalSizeClass) diff --git a/Sources/ArcGISToolkit/Components/FloorFilter/LevelSelector.swift b/Sources/ArcGISToolkit/Components/FloorFilter/LevelSelector.swift index 1d5d030a7..f293883f4 100644 --- a/Sources/ArcGISToolkit/Components/FloorFilter/LevelSelector.swift +++ b/Sources/ArcGISToolkit/Components/FloorFilter/LevelSelector.swift @@ -16,7 +16,6 @@ import SwiftUI import ArcGIS /// A view which allows selection of levels represented in `FloorFacility`. -@MainActor struct LevelSelector: View { /// The view model used by the `LevelsView`. @EnvironmentObject var viewModel: FloorFilterViewModel diff --git a/Sources/ArcGISToolkit/Components/FloorFilter/SiteAndFacilitySelector.swift b/Sources/ArcGISToolkit/Components/FloorFilter/SiteAndFacilitySelector.swift index b2fd51ae2..77fb198aa 100644 --- a/Sources/ArcGISToolkit/Components/FloorFilter/SiteAndFacilitySelector.swift +++ b/Sources/ArcGISToolkit/Components/FloorFilter/SiteAndFacilitySelector.swift @@ -18,7 +18,6 @@ import SwiftUI /// A view which allows selection of sites and facilities represented in a `FloorManager`. /// /// If the floor aware data contains only one site, the selector opens directly to the facilities list. -@MainActor struct SiteAndFacilitySelector: View { /// Allows the user to toggle the visibility of the site and facility selector. @Binding var isPresented: Bool diff --git a/Sources/ArcGISToolkit/Components/OverviewMap.swift b/Sources/ArcGISToolkit/Components/OverviewMap.swift index fe9b1381a..8ef3032a1 100644 --- a/Sources/ArcGISToolkit/Components/OverviewMap.swift +++ b/Sources/ArcGISToolkit/Components/OverviewMap.swift @@ -47,7 +47,6 @@ import SwiftUI /// the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [OverviewMapExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/OverviewMapExampleView.swift) /// in the project. To learn more about using the `OverviewMap` see the . -@MainActor @preconcurrency public struct OverviewMap: View { /// The `Viewpoint` of the main `GeoView`. diff --git a/Sources/ArcGISToolkit/Components/Popups/PopupMedia/Charts/PieChart.swift b/Sources/ArcGISToolkit/Components/Popups/PopupMedia/Charts/PieChart.swift index 0ae3c46cd..86004db05 100644 --- a/Sources/ArcGISToolkit/Components/Popups/PopupMedia/Charts/PieChart.swift +++ b/Sources/ArcGISToolkit/Components/Popups/PopupMedia/Charts/PieChart.swift @@ -15,7 +15,6 @@ import SwiftUI /// A view displaying details for pie chart popup media. -@MainActor struct PieChart: View { /// The view model for the pie chart. @ObservedObject private var viewModel: PieChartModel @@ -75,7 +74,6 @@ struct PieChart: View { } /// A view representing a pie chart. -@MainActor struct Pie: View { /// The view model for the pie chart. @ObservedObject private var viewModel: PieChartModel diff --git a/Sources/ArcGISToolkit/Components/Popups/PopupView.swift b/Sources/ArcGISToolkit/Components/Popups/PopupView.swift index 4430eab34..0a6176ff6 100644 --- a/Sources/ArcGISToolkit/Components/Popups/PopupView.swift +++ b/Sources/ArcGISToolkit/Components/Popups/PopupView.swift @@ -51,7 +51,6 @@ import ArcGIS /// and refer to /// [PopupExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/PopupExampleView.swift) /// in the project. To learn more about using the `PopupView` see the . -@MainActor @preconcurrency public struct PopupView: View { /// Creates a `PopupView` with the given popup. diff --git a/Sources/ArcGISToolkit/Components/Scalebar/Scalebar.swift b/Sources/ArcGISToolkit/Components/Scalebar/Scalebar.swift index e3f2a5552..b2c310afe 100644 --- a/Sources/ArcGISToolkit/Components/Scalebar/Scalebar.swift +++ b/Sources/ArcGISToolkit/Components/Scalebar/Scalebar.swift @@ -49,7 +49,6 @@ import SwiftUI /// To see it in action, try out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [ScalebarExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/ScalebarExampleView.swift) /// in the project. To learn more about using the `Scalebar` see the . -@MainActor @preconcurrency public struct Scalebar: View { // - MARK: Internal/Private vars diff --git a/Sources/ArcGISToolkit/Components/Search/SearchView.swift b/Sources/ArcGISToolkit/Components/Search/SearchView.swift index 8af2b70e5..af4b4d7d2 100644 --- a/Sources/ArcGISToolkit/Components/Search/SearchView.swift +++ b/Sources/ArcGISToolkit/Components/Search/SearchView.swift @@ -60,7 +60,6 @@ import ArcGIS /// To see the `SearchView` in action, and for examples of `Search` customization, check out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [SearchExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/SearchExampleView.swift) /// in the project. To learn more about using the `SearchView` see the . -@MainActor @preconcurrency public struct SearchView: View { /// Creates a `SearchView`. diff --git a/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTrace.swift b/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTrace.swift index 9dfcf494a..8ee334a3e 100644 --- a/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTrace.swift +++ b/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTrace.swift @@ -61,7 +61,6 @@ import SwiftUI /// To see the `UtilityNetworkTrace` in action, check out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [UtilityNetworkTraceExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/UtilityNetworkTraceExampleView.swift) /// in the project. To learn more about using the `UtilityNetworkTrace` see the . -@MainActor @preconcurrency public struct UtilityNetworkTrace: View { /// The proxy to provide access to map view operations. diff --git a/Sources/ArcGISToolkit/Extensions/SwiftUI/View+FeatureForm.swift b/Sources/ArcGISToolkit/Extensions/SwiftUI/View+FeatureForm.swift index f9654c60f..775a85146 100644 --- a/Sources/ArcGISToolkit/Extensions/SwiftUI/View+FeatureForm.swift +++ b/Sources/ArcGISToolkit/Extensions/SwiftUI/View+FeatureForm.swift @@ -15,7 +15,6 @@ import ArcGIS import SwiftUI -@MainActor extension View { /// Modifier for watching ``FeatureForm.titleChanged`` events. /// - Parameters: diff --git a/Sources/ArcGISToolkit/Extensions/SwiftUI/View+FormInput.swift b/Sources/ArcGISToolkit/Extensions/SwiftUI/View+FormInput.swift index a21853a17..b4dff327a 100644 --- a/Sources/ArcGISToolkit/Extensions/SwiftUI/View+FormInput.swift +++ b/Sources/ArcGISToolkit/Extensions/SwiftUI/View+FormInput.swift @@ -15,7 +15,6 @@ import ArcGIS import SwiftUI -@MainActor extension View { /// Modifier for watching ``FormElement.isEditableChanged`` events. /// - Parameters: diff --git a/Sources/ArcGISToolkit/Utility/AsyncImageView.swift b/Sources/ArcGISToolkit/Utility/AsyncImageView.swift index fe2af37bc..17b8611f0 100644 --- a/Sources/ArcGISToolkit/Utility/AsyncImageView.swift +++ b/Sources/ArcGISToolkit/Utility/AsyncImageView.swift @@ -16,7 +16,6 @@ import SwiftUI import ArcGIS /// A view displaying an async image, with error display and progress view. -@MainActor @preconcurrency public struct AsyncImageView: View { /// The `URL` of the image. diff --git a/Sources/ArcGISToolkit/Utility/SearchField.swift b/Sources/ArcGISToolkit/Utility/SearchField.swift index bc6594b33..489f4fed1 100644 --- a/Sources/ArcGISToolkit/Utility/SearchField.swift +++ b/Sources/ArcGISToolkit/Utility/SearchField.swift @@ -16,7 +16,6 @@ import SwiftUI /// A custom view implementing a SearchField. It contains a search button, text field, delete text button, /// and a button to allow users to hide/show the search results list. -@MainActor @preconcurrency public struct SearchField: View { /// Creates a `SearchField`. diff --git a/Test Runner/Test Runner/TestViews/BasemapGalleryTestView.swift b/Test Runner/Test Runner/TestViews/BasemapGalleryTestView.swift index f821ebb57..addef75cc 100644 --- a/Test Runner/Test Runner/TestViews/BasemapGalleryTestView.swift +++ b/Test Runner/Test Runner/TestViews/BasemapGalleryTestView.swift @@ -16,7 +16,6 @@ import ArcGIS import ArcGISToolkit import SwiftUI -@MainActor struct BasemapGalleryTestView: View { @State private var map = Map(basemapStyle: .arcGISImagery) diff --git a/Test Runner/Test Runner/TestViews/FeatureFormTestView.swift b/Test Runner/Test Runner/TestViews/FeatureFormTestView.swift index ba0a2a6dd..41074b233 100644 --- a/Test Runner/Test Runner/TestViews/FeatureFormTestView.swift +++ b/Test Runner/Test Runner/TestViews/FeatureFormTestView.swift @@ -16,7 +16,6 @@ import ArcGIS import ArcGISToolkit import SwiftUI -@MainActor struct FeatureFormTestView: View { @Environment(\.verticalSizeClass) var verticalSizeClass @@ -51,7 +50,7 @@ private extension FeatureFormTestView { /// - Parameters: /// - map: The map under test. /// - testCase: The test definition. - @MainActor func makeMapView(_ map: Map, _ testCase: TestCase) -> some View { + func makeMapView(_ map: Map, _ testCase: TestCase) -> some View { MapView(map: map) .onAttributionBarHeightChanged { attributionBarHeight = $0 From 747e2144a84317623ac63eaba54ee6bddc89ddc3 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 4 Oct 2024 18:45:11 -0700 Subject: [PATCH 46/56] Remove `Sendable` from `SearchSource` --- .../ArcGISToolkit/Components/Search/LocatorSearchSource.swift | 2 +- Sources/ArcGISToolkit/Components/Search/SearchSource.swift | 2 +- .../Components/Search/SmartLocatorSearchSource.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/ArcGISToolkit/Components/Search/LocatorSearchSource.swift b/Sources/ArcGISToolkit/Components/Search/LocatorSearchSource.swift index 9a5bfc902..b2c03ba00 100644 --- a/Sources/ArcGISToolkit/Components/Search/LocatorSearchSource.swift +++ b/Sources/ArcGISToolkit/Components/Search/LocatorSearchSource.swift @@ -18,7 +18,7 @@ import Foundation /// Uses a Locator to provide search and suggest results. Most configuration should be done on the /// `GeocodeParameters` directly. -public class LocatorSearchSource: ObservableObject, SearchSource, @unchecked Sendable { +public class LocatorSearchSource: ObservableObject, SearchSource { /// Creates a locator search source. /// - Parameters: /// - name: The name to show when presenting this source in the UI. diff --git a/Sources/ArcGISToolkit/Components/Search/SearchSource.swift b/Sources/ArcGISToolkit/Components/Search/SearchSource.swift index c84826bd9..09b880d83 100644 --- a/Sources/ArcGISToolkit/Components/Search/SearchSource.swift +++ b/Sources/ArcGISToolkit/Components/Search/SearchSource.swift @@ -15,7 +15,7 @@ import ArcGIS /// Defines the contract for a search result provider. -public protocol SearchSource: Sendable { +public protocol SearchSource { /// Name to show when presenting this source in the UI. var name: String { get set } diff --git a/Sources/ArcGISToolkit/Components/Search/SmartLocatorSearchSource.swift b/Sources/ArcGISToolkit/Components/Search/SmartLocatorSearchSource.swift index b5ec96217..24dcd8569 100644 --- a/Sources/ArcGISToolkit/Components/Search/SmartLocatorSearchSource.swift +++ b/Sources/ArcGISToolkit/Components/Search/SmartLocatorSearchSource.swift @@ -17,7 +17,7 @@ import ArcGIS /// Extends `LocatorSearchSource` with intelligent search behaviors; adds support for features like /// type-specific placemarks, repeated search, and more on the world geocode service. -public class SmartLocatorSearchSource: LocatorSearchSource, @unchecked Sendable { +public class SmartLocatorSearchSource: LocatorSearchSource { /// Creates a smart locator search source. /// - Parameters: /// - name: Name to show when presenting this source in the UI. From 522bb6da981b2c88c08429d1d26dd2e507999586 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Fri, 4 Oct 2024 18:45:46 -0700 Subject: [PATCH 47/56] Mark `SearchSource` `@MainActor` --- Sources/ArcGISToolkit/Components/Search/SearchSource.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/Search/SearchSource.swift b/Sources/ArcGISToolkit/Components/Search/SearchSource.swift index 09b880d83..6d9d808b2 100644 --- a/Sources/ArcGISToolkit/Components/Search/SearchSource.swift +++ b/Sources/ArcGISToolkit/Components/Search/SearchSource.swift @@ -15,7 +15,7 @@ import ArcGIS /// Defines the contract for a search result provider. -public protocol SearchSource { +@MainActor public protocol SearchSource { /// Name to show when presenting this source in the UI. var name: String { get set } From 25e05423b4b07737036ad23defc852235a2867d2 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 7 Oct 2024 14:33:27 -0700 Subject: [PATCH 48/56] Update Test Runner/UI Tests/AttachmentCameraControllerTests.swift Co-authored-by: Philip Ridgeway --- Test Runner/UI Tests/AttachmentCameraControllerTests.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Test Runner/UI Tests/AttachmentCameraControllerTests.swift b/Test Runner/UI Tests/AttachmentCameraControllerTests.swift index 724f21bd7..d692b17ef 100644 --- a/Test Runner/UI Tests/AttachmentCameraControllerTests.swift +++ b/Test Runner/UI Tests/AttachmentCameraControllerTests.swift @@ -83,10 +83,11 @@ final class AttachmentCameraControllerTests: XCTestCase { private extension AttachmentCameraControllerTests { var allowButton: XCUIElement { let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard") - if #available(iOS 18.0, *) { - return springboard.buttons["Allow"] + let key = if #available(iOS 18.0, *) { + "Allow" } else { - return springboard.buttons["OK"] + "OK" } + return springboard.buttons[key] } } From fb1303a2fa636e42b11158fef195bd6519d8738f Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 7 Oct 2024 14:43:58 -0700 Subject: [PATCH 49/56] Drop `@preconcurrency` where recommended Co-Authored-By: Philip Ridgeway --- Sources/ArcGISToolkit/Components/OverviewMap.swift | 1 - Sources/ArcGISToolkit/Components/Popups/PopupView.swift | 1 - Sources/ArcGISToolkit/Components/Scalebar/Scalebar.swift | 1 - Sources/ArcGISToolkit/Components/Search/SearchView.swift | 1 - .../Components/UtilityNetworkTrace/UtilityNetworkTrace.swift | 1 - Sources/ArcGISToolkit/Utility/AsyncImageView.swift | 1 - Sources/ArcGISToolkit/Utility/SearchField.swift | 1 - 7 files changed, 7 deletions(-) diff --git a/Sources/ArcGISToolkit/Components/OverviewMap.swift b/Sources/ArcGISToolkit/Components/OverviewMap.swift index 8ef3032a1..00ee098bd 100644 --- a/Sources/ArcGISToolkit/Components/OverviewMap.swift +++ b/Sources/ArcGISToolkit/Components/OverviewMap.swift @@ -47,7 +47,6 @@ import SwiftUI /// the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [OverviewMapExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/OverviewMapExampleView.swift) /// in the project. To learn more about using the `OverviewMap` see the . -@preconcurrency public struct OverviewMap: View { /// The `Viewpoint` of the main `GeoView`. let viewpoint: Viewpoint? diff --git a/Sources/ArcGISToolkit/Components/Popups/PopupView.swift b/Sources/ArcGISToolkit/Components/Popups/PopupView.swift index 0a6176ff6..1b9509836 100644 --- a/Sources/ArcGISToolkit/Components/Popups/PopupView.swift +++ b/Sources/ArcGISToolkit/Components/Popups/PopupView.swift @@ -51,7 +51,6 @@ import ArcGIS /// and refer to /// [PopupExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/PopupExampleView.swift) /// in the project. To learn more about using the `PopupView` see the . -@preconcurrency public struct PopupView: View { /// Creates a `PopupView` with the given popup. /// - Parameters: diff --git a/Sources/ArcGISToolkit/Components/Scalebar/Scalebar.swift b/Sources/ArcGISToolkit/Components/Scalebar/Scalebar.swift index b2c310afe..7dd2a7080 100644 --- a/Sources/ArcGISToolkit/Components/Scalebar/Scalebar.swift +++ b/Sources/ArcGISToolkit/Components/Scalebar/Scalebar.swift @@ -49,7 +49,6 @@ import SwiftUI /// To see it in action, try out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [ScalebarExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/ScalebarExampleView.swift) /// in the project. To learn more about using the `Scalebar` see the . -@preconcurrency public struct Scalebar: View { // - MARK: Internal/Private vars diff --git a/Sources/ArcGISToolkit/Components/Search/SearchView.swift b/Sources/ArcGISToolkit/Components/Search/SearchView.swift index af4b4d7d2..ae7a6bcc8 100644 --- a/Sources/ArcGISToolkit/Components/Search/SearchView.swift +++ b/Sources/ArcGISToolkit/Components/Search/SearchView.swift @@ -60,7 +60,6 @@ import ArcGIS /// To see the `SearchView` in action, and for examples of `Search` customization, check out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [SearchExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/SearchExampleView.swift) /// in the project. To learn more about using the `SearchView` see the . -@preconcurrency public struct SearchView: View { /// Creates a `SearchView`. /// - Parameters: diff --git a/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTrace.swift b/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTrace.swift index 8ee334a3e..2ae6c73b3 100644 --- a/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTrace.swift +++ b/Sources/ArcGISToolkit/Components/UtilityNetworkTrace/UtilityNetworkTrace.swift @@ -61,7 +61,6 @@ import SwiftUI /// To see the `UtilityNetworkTrace` in action, check out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples) /// and refer to [UtilityNetworkTraceExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/UtilityNetworkTraceExampleView.swift) /// in the project. To learn more about using the `UtilityNetworkTrace` see the . -@preconcurrency public struct UtilityNetworkTrace: View { /// The proxy to provide access to map view operations. private var mapViewProxy: MapViewProxy? diff --git a/Sources/ArcGISToolkit/Utility/AsyncImageView.swift b/Sources/ArcGISToolkit/Utility/AsyncImageView.swift index 17b8611f0..1bedf9316 100644 --- a/Sources/ArcGISToolkit/Utility/AsyncImageView.swift +++ b/Sources/ArcGISToolkit/Utility/AsyncImageView.swift @@ -16,7 +16,6 @@ import SwiftUI import ArcGIS /// A view displaying an async image, with error display and progress view. -@preconcurrency public struct AsyncImageView: View { /// The `URL` of the image. private var url: URL? diff --git a/Sources/ArcGISToolkit/Utility/SearchField.swift b/Sources/ArcGISToolkit/Utility/SearchField.swift index 489f4fed1..3866b561c 100644 --- a/Sources/ArcGISToolkit/Utility/SearchField.swift +++ b/Sources/ArcGISToolkit/Utility/SearchField.swift @@ -16,7 +16,6 @@ import SwiftUI /// A custom view implementing a SearchField. It contains a search button, text field, delete text button, /// and a button to allow users to hide/show the search results list. -@preconcurrency public struct SearchField: View { /// Creates a `SearchField`. /// - Parameters: From 433b813d00ffa939aca9e624d93270aad16a4c02 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 7 Oct 2024 15:08:25 -0700 Subject: [PATCH 50/56] Update Sources/ArcGISToolkit/Components/Search/SearchSource.swift Co-authored-by: Philip Ridgeway --- Sources/ArcGISToolkit/Components/Search/SearchSource.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/Search/SearchSource.swift b/Sources/ArcGISToolkit/Components/Search/SearchSource.swift index 6d9d808b2..e430858e5 100644 --- a/Sources/ArcGISToolkit/Components/Search/SearchSource.swift +++ b/Sources/ArcGISToolkit/Components/Search/SearchSource.swift @@ -15,7 +15,9 @@ import ArcGIS /// Defines the contract for a search result provider. -@MainActor public protocol SearchSource { +@MainActor +@preconcurrency +public protocol SearchSource { /// Name to show when presenting this source in the UI. var name: String { get set } From 2b2fe9bff6634483437acb6cc255c32fe5fd5621 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Tue, 8 Oct 2024 10:47:55 -0700 Subject: [PATCH 51/56] Fix crash on launch in `JobManagerExampleView` --- .../JobManagerExample/JobManagerExampleView.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/JobManagerExample/JobManagerExample/JobManagerExampleView.swift b/JobManagerExample/JobManagerExample/JobManagerExampleView.swift index 25293333c..46e6b9afd 100644 --- a/JobManagerExample/JobManagerExample/JobManagerExampleView.swift +++ b/JobManagerExample/JobManagerExample/JobManagerExampleView.swift @@ -53,11 +53,11 @@ struct JobManagerExampleView: View { } .listStyle(.plain) } - .onAppear { - UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { _, error in - if let error { - print(error.localizedDescription) - } + .task { + do { + _ = try await UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) + } catch { + print(error.localizedDescription) } } .padding() From 601f34af080d2548ffa10d99a913637b27cf7a06 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 9 Oct 2024 13:27:42 -0700 Subject: [PATCH 52/56] Add workaround for Swift 6148 Co-Authored-By: R Olson --- .../Augmented Reality/TableTopSceneView.swift | 8 +-- .../Utilities/ARSwiftUIView.swift | 49 ++++++++++++++++--- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift index f4ce6248c..4345b9758 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift @@ -97,11 +97,11 @@ public struct TableTopSceneView: View { orientation: interfaceOrientation ) } - .onAddNode { renderer, node, anchor in - addPlane(renderer: renderer, node: node, anchor: anchor) + .onAddNode { parameters in + addPlane(renderer: parameters.renderer, node: parameters.node, anchor: parameters.anchor) } - .onUpdateNode { _, node, anchor in - updatePlane(with: node, for: anchor) + .onUpdateNode { parameters in + updatePlane(with: parameters.node, for: parameters.anchor) } .onTapGesture { screenPoint in guard !initialTransformationIsSet else { return } diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift index 3061b44c7..aae920855 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift @@ -16,6 +16,8 @@ import ArcGIS import ARKit import SwiftUI +internal import os + typealias ARViewType = ARSCNView /// A SwiftUI version of an AR view. @@ -27,9 +29,9 @@ struct ARSwiftUIView { /// The closure to call when the session's frame updates. private(set) var onDidUpdateFrameAction: ((ARSession, ARFrame) -> Void)? /// The closure to call when a node corresponding to a new anchor has been added to the view. - private(set) var onAddNodeAction: ((SCNSceneRenderer, SCNNode, ARAnchor) -> Void)? + private(set) var onAddNodeAction: (@MainActor (SceneParameters) -> Void)? /// The closure to call when a node has been updated to match it's corresponding anchor. - private(set) var onUpdateNodeAction: ((SCNSceneRenderer, SCNNode, ARAnchor) -> Void)? + private(set) var onUpdateNodeAction: (@MainActor (SceneParameters) -> Void)? /// The proxy. private let proxy: ARSwiftUIViewProxy @@ -72,7 +74,7 @@ struct ARSwiftUIView { /// Sets the closure to call when a new node has been added to the scene. func onAddNode( - perform action: @escaping (SCNSceneRenderer, SCNNode, ARAnchor) -> Void + perform action: @escaping @MainActor (SceneParameters) -> Void ) -> Self { var view = self view.onAddNodeAction = action @@ -81,7 +83,7 @@ struct ARSwiftUIView { /// Sets the closure to call when the scene's nodes are updated. func onUpdateNode( - perform action: @escaping (SCNSceneRenderer, SCNNode, ARAnchor) -> Void + perform action: @escaping @MainActor (SceneParameters) -> Void ) -> Self { var view = self view.onUpdateNodeAction = action @@ -114,11 +116,24 @@ extension ARSwiftUIView: UIViewRepresentable { extension ARSwiftUIView { class Coordinator: NSObject, ARSCNViewDelegate, ARSessionDelegate { + struct State: Sendable { + var onAddNodeAction: (@MainActor (SceneParameters) -> Void)? + var onUpdateNodeAction: (@MainActor (SceneParameters) -> Void)? + } + + let state = OSAllocatedUnfairLock(initialState: State()) + var onDidChangeGeoTrackingStatusAction: ((ARSession, ARGeoTrackingStatus) -> Void)? var onCameraDidChangeTrackingStateAction: ((ARSession, ARCamera.TrackingState) -> Void)? var onDidUpdateFrameAction: ((ARSession, ARFrame) -> Void)? - var onAddNodeAction: ((SCNSceneRenderer, SCNNode, ARAnchor) -> Void)? - var onUpdateNodeAction: ((SCNSceneRenderer, SCNNode, ARAnchor) -> Void)? + var onAddNodeAction: (@MainActor (SceneParameters) -> Void)? { + get { state.withLock { $0.onAddNodeAction } } + set { state.withLock { $0.onAddNodeAction = newValue } } + } + var onUpdateNodeAction: (@MainActor (SceneParameters) -> Void)? { + get { state.withLock { $0.onUpdateNodeAction } } + set { state.withLock { $0.onUpdateNodeAction = newValue } } + } func session(_ session: ARSession, didChange geoTrackingStatus: ARGeoTrackingStatus) { onDidChangeGeoTrackingStatusAction?(session, geoTrackingStatus) @@ -133,15 +148,33 @@ extension ARSwiftUIView { } func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { - onAddNodeAction?(renderer, node, anchor) + let sceneParameters = SceneParameters(renderer: renderer, node: node, anchor: anchor) + Task { [onAddNodeAction] in + await MainActor.run { + onAddNodeAction?(sceneParameters) + } + } } func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) { - onUpdateNodeAction?(renderer, node, anchor) + let sceneParameters = SceneParameters(renderer: renderer, node: node, anchor: anchor) + Task { [onUpdateNodeAction] in + await MainActor.run { + onUpdateNodeAction?(sceneParameters) + } + } } } } +/// A temporary type to workaround this issue: +/// https://forums.developer.apple.com/forums/thread/765644 +struct SceneParameters: @unchecked Sendable { + let renderer: SCNSceneRenderer + let node: SCNNode + let anchor: ARAnchor +} + /// A proxy for the ARSwiftUIView. @MainActor class ARSwiftUIViewProxy: NSObject, @preconcurrency ARSessionProviding { From fda93a8aad70e2798b621042bb6ac4e8f31016a9 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 9 Oct 2024 13:31:33 -0700 Subject: [PATCH 53/56] Update Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift Co-authored-by: R Olson --- .../Components/Augmented Reality/Utilities/ARSwiftUIView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift index aae920855..98e635418 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift @@ -116,7 +116,7 @@ extension ARSwiftUIView: UIViewRepresentable { extension ARSwiftUIView { class Coordinator: NSObject, ARSCNViewDelegate, ARSessionDelegate { - struct State: Sendable { + private struct State: Sendable { var onAddNodeAction: (@MainActor (SceneParameters) -> Void)? var onUpdateNodeAction: (@MainActor (SceneParameters) -> Void)? } From 27ce6fc7e2c5fcd61a62236e1590df1f7bba074e Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 9 Oct 2024 13:33:10 -0700 Subject: [PATCH 54/56] Mark `state` private --- .../Components/Augmented Reality/Utilities/ARSwiftUIView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift index 98e635418..b0d8beb3d 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift @@ -121,7 +121,7 @@ extension ARSwiftUIView { var onUpdateNodeAction: (@MainActor (SceneParameters) -> Void)? } - let state = OSAllocatedUnfairLock(initialState: State()) + private let state = OSAllocatedUnfairLock(initialState: State()) var onDidChangeGeoTrackingStatusAction: ((ARSession, ARGeoTrackingStatus) -> Void)? var onCameraDidChangeTrackingStateAction: ((ARSession, ARCamera.TrackingState) -> Void)? From dfdaaf5841bc078b7f9bb99f198ea6c3558bd92f Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 9 Oct 2024 15:17:45 -0700 Subject: [PATCH 55/56] Remove `@preconcurrency` on `TableTopSceneView` Co-Authored-By: Philip Ridgeway --- .../Components/Augmented Reality/TableTopSceneView.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift index 4345b9758..c08fad244 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/TableTopSceneView.swift @@ -17,7 +17,6 @@ import SwiftUI import ArcGIS /// A scene view that provides an augmented reality table top experience. -@preconcurrency public struct TableTopSceneView: View { /// The proxy for the ARSwiftUIView. @State private var arViewProxy = ARSwiftUIViewProxy() From d5b79064b5324b07e078ce4cb1aa77fef69b451a Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Wed, 9 Oct 2024 15:38:37 -0700 Subject: [PATCH 56/56] Revise Swift 6148 workaround Co-Authored-By: Philip Ridgeway --- .../Utilities/ARSwiftUIView.swift | 113 +++++++++--------- 1 file changed, 55 insertions(+), 58 deletions(-) diff --git a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift index b0d8beb3d..b34d32b19 100644 --- a/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift +++ b/Sources/ArcGISToolkit/Components/Augmented Reality/Utilities/ARSwiftUIView.swift @@ -16,8 +16,6 @@ import ArcGIS import ARKit import SwiftUI -internal import os - typealias ARViewType = ARSCNView /// A SwiftUI version of an AR view. @@ -101,72 +99,71 @@ extension ARSwiftUIView: UIViewRepresentable { return arView } - func updateUIView(_ uiView: ARViewType, context: Context) { - context.coordinator.onDidChangeGeoTrackingStatusAction = onDidChangeGeoTrackingStatusAction - context.coordinator.onCameraDidChangeTrackingStateAction = onCameraDidChangeTrackingStateAction - context.coordinator.onDidUpdateFrameAction = onDidUpdateFrameAction - context.coordinator.onAddNodeAction = onAddNodeAction - context.coordinator.onUpdateNodeAction = onUpdateNodeAction - } + func updateUIView(_ uiView: ARViewType, context: Context) {} func makeCoordinator() -> Coordinator { - Coordinator() + return .init( + onDidChangeGeoTrackingStatusAction: onDidChangeGeoTrackingStatusAction, + onCameraDidChangeTrackingStateAction: onCameraDidChangeTrackingStateAction, + onDidUpdateFrameAction: onDidUpdateFrameAction, + onAddNodeAction: onAddNodeAction, + onUpdateNodeAction: onUpdateNodeAction + ) } -} - -extension ARSwiftUIView { - class Coordinator: NSObject, ARSCNViewDelegate, ARSessionDelegate { - private struct State: Sendable { - var onAddNodeAction: (@MainActor (SceneParameters) -> Void)? - var onUpdateNodeAction: (@MainActor (SceneParameters) -> Void)? - } - - private let state = OSAllocatedUnfairLock(initialState: State()) - - var onDidChangeGeoTrackingStatusAction: ((ARSession, ARGeoTrackingStatus) -> Void)? - var onCameraDidChangeTrackingStateAction: ((ARSession, ARCamera.TrackingState) -> Void)? - var onDidUpdateFrameAction: ((ARSession, ARFrame) -> Void)? - var onAddNodeAction: (@MainActor (SceneParameters) -> Void)? { - get { state.withLock { $0.onAddNodeAction } } - set { state.withLock { $0.onAddNodeAction = newValue } } - } - var onUpdateNodeAction: (@MainActor (SceneParameters) -> Void)? { - get { state.withLock { $0.onUpdateNodeAction } } - set { state.withLock { $0.onUpdateNodeAction = newValue } } - } - - func session(_ session: ARSession, didChange geoTrackingStatus: ARGeoTrackingStatus) { - onDidChangeGeoTrackingStatusAction?(session, geoTrackingStatus) - } - - func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) { - onCameraDidChangeTrackingStateAction?(session, camera.trackingState) - } + + class Coordinator: NSObject { + let onDidChangeGeoTrackingStatusAction: ((ARSession, ARGeoTrackingStatus) -> Void)? + let onCameraDidChangeTrackingStateAction: ((ARSession, ARCamera.TrackingState) -> Void)? + let onDidUpdateFrameAction: ((ARSession, ARFrame) -> Void)? + let onAddNodeAction: (@MainActor (SceneParameters) -> Void)? + let onUpdateNodeAction: (@MainActor (SceneParameters) -> Void)? - func session(_ session: ARSession, didUpdate frame: ARFrame) { - onDidUpdateFrameAction?(session, frame) + init( + onDidChangeGeoTrackingStatusAction: ((ARSession, ARGeoTrackingStatus) -> Void)?, + onCameraDidChangeTrackingStateAction: ((ARSession, ARCamera.TrackingState) -> Void)?, + onDidUpdateFrameAction: ((ARSession, ARFrame) -> Void)?, + onAddNodeAction: (@MainActor (SceneParameters) -> Void)?, + onUpdateNodeAction: (@MainActor (SceneParameters) -> Void)? + ) { + self.onDidChangeGeoTrackingStatusAction = onDidChangeGeoTrackingStatusAction + self.onCameraDidChangeTrackingStateAction = onCameraDidChangeTrackingStateAction + self.onDidUpdateFrameAction = onDidUpdateFrameAction + self.onAddNodeAction = onAddNodeAction + self.onUpdateNodeAction = onUpdateNodeAction } - - func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { - let sceneParameters = SceneParameters(renderer: renderer, node: node, anchor: anchor) - Task { [onAddNodeAction] in - await MainActor.run { - onAddNodeAction?(sceneParameters) - } - } + } +} + +extension ARSwiftUIView.Coordinator: ARSCNViewDelegate { + func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { + let sceneParameters = SceneParameters(renderer: renderer, node: node, anchor: anchor) + Task { @MainActor [onAddNodeAction] in + onAddNodeAction?(sceneParameters) } - - func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) { - let sceneParameters = SceneParameters(renderer: renderer, node: node, anchor: anchor) - Task { [onUpdateNodeAction] in - await MainActor.run { - onUpdateNodeAction?(sceneParameters) - } - } + } + + func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) { + let sceneParameters = SceneParameters(renderer: renderer, node: node, anchor: anchor) + Task { @MainActor [onUpdateNodeAction] in + onUpdateNodeAction?(sceneParameters) } } } +extension ARSwiftUIView.Coordinator: ARSessionDelegate { + func session(_ session: ARSession, didChange geoTrackingStatus: ARGeoTrackingStatus) { + onDidChangeGeoTrackingStatusAction?(session, geoTrackingStatus) + } + + func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) { + onCameraDidChangeTrackingStateAction?(session, camera.trackingState) + } + + func session(_ session: ARSession, didUpdate frame: ARFrame) { + onDidUpdateFrameAction?(session, frame) + } +} + /// A temporary type to workaround this issue: /// https://forums.developer.apple.com/forums/thread/765644 struct SceneParameters: @unchecked Sendable {