From 46a63670e560555e275182992222066ffa192e28 Mon Sep 17 00:00:00 2001 From: David Feinzimer Date: Mon, 15 Apr 2024 15:39:06 -0700 Subject: [PATCH] Apply changes --- .../UtilityNetworkTraceExampleView.swift | 15 +++++++------- .../UtilityNetworkTraceStep1.swift | 4 ++-- .../UtilityNetworkTraceStep2.swift | 16 +++++++++++++-- .../UtilityNetworkTraceStep3.swift | 16 +++++++++++++-- .../UtilityNetworkTraceStep4.swift | 16 +++++++++++++-- .../UtilityNetworkTraceStep5.swift | 20 +++++++++++++++---- 6 files changed, 67 insertions(+), 20 deletions(-) diff --git a/Examples/Examples/UtilityNetworkTraceExampleView.swift b/Examples/Examples/UtilityNetworkTraceExampleView.swift index 810275be1..d82888a1e 100644 --- a/Examples/Examples/UtilityNetworkTraceExampleView.swift +++ b/Examples/Examples/UtilityNetworkTraceExampleView.swift @@ -19,24 +19,23 @@ import SwiftUI /// A demonstration of the utility network trace tool which runs traces on a web map published with /// a utility network and trace configurations. struct UtilityNetworkTraceExampleView: View { - @Environment(\.isPortraitOrientation) - private var isPortraitOrientation - - /// The map with the utility networks. - @State private var map = makeMap() + @Environment(\.isPortraitOrientation) private var isPortraitOrientation /// The current detent of the floating panel presenting the trace tool. @State private var activeDetent: FloatingPanelDetent = .half + /// The map with the utility networks. + @State private var map = makeMap() + /// Provides the ability to detect tap locations in the context of the map view. @State private var mapPoint: Point? - /// Provides the ability to detect tap locations in the context of the screen. - @State private var screenPoint: CGPoint? - /// A container for graphical trace results. @State private var resultGraphicsOverlay = GraphicsOverlay() + /// Provides the ability to detect tap locations in the context of the screen. + @State private var screenPoint: CGPoint? + /// The map viewpoint used by the `UtilityNetworkTrace` to pan/zoom the map to selected features. @State private var viewpoint: Viewpoint? diff --git a/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep1.swift b/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep1.swift index d4c278538..f54f96dc4 100644 --- a/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep1.swift +++ b/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep1.swift @@ -7,10 +7,10 @@ struct UtilityNetworkTraceExampleView: View { @State private var mapPoint: Point? - @State private var screenPoint: CGPoint? - @State private var resultGraphicsOverlay = GraphicsOverlay() + @State private var screenPoint: CGPoint? + @State private var viewpoint: Viewpoint? static func makeMap() -> Map { diff --git a/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep2.swift b/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep2.swift index 943eeab79..b02a3243d 100644 --- a/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep2.swift +++ b/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep2.swift @@ -7,10 +7,10 @@ struct UtilityNetworkTraceExampleView: View { @State private var mapPoint: Point? - @State private var screenPoint: CGPoint? - @State private var resultGraphicsOverlay = GraphicsOverlay() + @State private var screenPoint: CGPoint? + @State private var viewpoint: Viewpoint? var body: some View { @@ -35,3 +35,15 @@ struct UtilityNetworkTraceExampleView: View { return Map(item: portalItem) } } + +private extension ArcGISCredential { + static var publicSample: ArcGISCredential { + get async throws { + try await TokenCredential.credential( + for: URL(string: "https://sampleserver7.arcgisonline.com/portal/sharing/rest")!, + username: "viewer01", + password: "I68VGU^nMurF" + ) + } + } +} diff --git a/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep3.swift b/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep3.swift index 378c1b6a1..9ebaad7dd 100644 --- a/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep3.swift +++ b/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep3.swift @@ -7,10 +7,10 @@ struct UtilityNetworkTraceExampleView: View { @State private var mapPoint: Point? - @State private var screenPoint: CGPoint? - @State private var resultGraphicsOverlay = GraphicsOverlay() + @State private var screenPoint: CGPoint? + @State private var viewpoint: Viewpoint? var body: some View { @@ -38,3 +38,15 @@ struct UtilityNetworkTraceExampleView: View { return Map(item: portalItem) } } + +private extension ArcGISCredential { + static var publicSample: ArcGISCredential { + get async throws { + try await TokenCredential.credential( + for: URL(string: "https://sampleserver7.arcgisonline.com/portal/sharing/rest")!, + username: "viewer01", + password: "I68VGU^nMurF" + ) + } + } +} diff --git a/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep4.swift b/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep4.swift index 5d6814350..c29199313 100644 --- a/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep4.swift +++ b/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep4.swift @@ -7,10 +7,10 @@ struct UtilityNetworkTraceExampleView: View { @State private var mapPoint: Point? - @State private var screenPoint: CGPoint? - @State private var resultGraphicsOverlay = GraphicsOverlay() + @State private var screenPoint: CGPoint? + @State private var viewpoint: Viewpoint? var body: some View { @@ -42,3 +42,15 @@ struct UtilityNetworkTraceExampleView: View { return Map(item: portalItem) } } + +private extension ArcGISCredential { + static var publicSample: ArcGISCredential { + get async throws { + try await TokenCredential.credential( + for: URL(string: "https://sampleserver7.arcgisonline.com/portal/sharing/rest")!, + username: "viewer01", + password: "I68VGU^nMurF" + ) + } + } +} diff --git a/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep5.swift b/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep5.swift index 4798563d7..e5472ab3a 100644 --- a/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep5.swift +++ b/Sources/ArcGISToolkit/Documentation.docc/Resources/UtilityNetworkTrace/UtilityNetworkTraceStep5.swift @@ -3,16 +3,16 @@ import ArcGISToolkit import SwiftUI struct UtilityNetworkTraceExampleView: View { - @State private var map = makeMap() - @State private var activeDetent: FloatingPanelDetent = .half - @State private var mapPoint: Point? + @State private var map = makeMap() - @State private var screenPoint: CGPoint? + @State private var mapPoint: Point? @State private var resultGraphicsOverlay = GraphicsOverlay() + @State private var screenPoint: CGPoint? + @State private var viewpoint: Viewpoint? var body: some View { @@ -60,3 +60,15 @@ struct UtilityNetworkTraceExampleView: View { return Map(item: portalItem) } } + +private extension ArcGISCredential { + static var publicSample: ArcGISCredential { + get async throws { + try await TokenCredential.credential( + for: URL(string: "https://sampleserver7.arcgisonline.com/portal/sharing/rest")!, + username: "viewer01", + password: "I68VGU^nMurF" + ) + } + } +}