Skip to content

Commit 40cfbfc

Browse files
authored
Merge branch 'v.next' into Ting/FeatureReduction
2 parents 342896f + 4282253 commit 40cfbfc

File tree

54 files changed

+602
-503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+602
-503
lines changed

Samples.xcodeproj/project.pbxproj

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
0005580A2817C51E00224BC6 /* SampleDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 000558092817C51E00224BC6 /* SampleDetailView.swift */; };
11-
00181B462846AD7100654571 /* View+Alert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00181B452846AD7100654571 /* View+Alert.swift */; };
11+
00181B462846AD7100654571 /* View+ErrorAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00181B452846AD7100654571 /* View+ErrorAlert.swift */; };
1212
001C6DE127FE8A9400D472C2 /* AppSecrets.swift.masque in Sources */ = {isa = PBXBuildFile; fileRef = 001C6DD827FE585A00D472C2 /* AppSecrets.swift.masque */; };
1313
00273CF42A82AB5900A7A77D /* SamplesSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00273CF32A82AB5900A7A77D /* SamplesSearchView.swift */; };
1414
00273CF62A82AB8700A7A77D /* SampleRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00273CF52A82AB8700A7A77D /* SampleRow.swift */; };
@@ -202,6 +202,8 @@
202202
D73F8CF42AB1089900CD39DA /* Restaurant.stylx in Resources */ = {isa = PBXBuildFile; fileRef = D73F8CF32AB1089900CD39DA /* Restaurant.stylx */; settings = {ASSET_TAGS = (StyleFeaturesWithCustomDictionary, ); }; };
203203
D73FC0FD2AD4A18D0067A19B /* CreateMobileGeodatabaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D73FC0FC2AD4A18D0067A19B /* CreateMobileGeodatabaseView.swift */; };
204204
D73FC0FE2AD4A19A0067A19B /* CreateMobileGeodatabaseView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D73FC0FC2AD4A18D0067A19B /* CreateMobileGeodatabaseView.swift */; };
205+
D73FCFF72B02A3AA0006360D /* FindAddressWithReverseGeocodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D73FCFF42B02A3AA0006360D /* FindAddressWithReverseGeocodeView.swift */; };
206+
D73FCFFA2B02A3C50006360D /* FindAddressWithReverseGeocodeView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D73FCFF42B02A3AA0006360D /* FindAddressWithReverseGeocodeView.swift */; };
205207
D73FCFFF2B02C7630006360D /* FindRouteAroundBarriersView.Views.swift in Sources */ = {isa = PBXBuildFile; fileRef = D73FCFFE2B02C7630006360D /* FindRouteAroundBarriersView.Views.swift */; };
206208
D73FD0002B02C9610006360D /* FindRouteAroundBarriersView.Views.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D73FCFFE2B02C7630006360D /* FindRouteAroundBarriersView.Views.swift */; };
207209
D742E4922B04132B00690098 /* DisplayWebSceneFromPortalItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D742E48F2B04132B00690098 /* DisplayWebSceneFromPortalItemView.swift */; };
@@ -387,6 +389,7 @@
387389
00B56F7E2B0EBE9C00B68A0D /* AddClusteringFeatureReductionToAPointFeatureLayerView.swift in Copy Source Code Files */,
388390
00B56F7F2B0EBE9C00B68A0D /* AddClusteringFeatureReductionToAPointFeatureLayerView.Model.swift in Copy Source Code Files */,
389391
00B56F802B0EBE9C00B68A0D /* AddClusteringFeatureReductionToAPointFeatureLayerView.SettingsView.swift in Copy Source Code Files */,
392+
D73FCFFA2B02A3C50006360D /* FindAddressWithReverseGeocodeView.swift in Copy Source Code Files */,
390393
D742E4952B04134C00690098 /* DisplayWebSceneFromPortalItemView.swift in Copy Source Code Files */,
391394
D7010EC12B05618400D43F55 /* DisplaySceneFromMobileScenePackageView.swift in Copy Source Code Files */,
392395
D737237B2AF5AE1A00846884 /* FindRouteInMobileMapPackageView.Models.swift in Copy Source Code Files */,
@@ -530,7 +533,7 @@
530533

531534
/* Begin PBXFileReference section */
532535
000558092817C51E00224BC6 /* SampleDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleDetailView.swift; sourceTree = "<group>"; };
533-
00181B452846AD7100654571 /* View+Alert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Alert.swift"; sourceTree = "<group>"; };
536+
00181B452846AD7100654571 /* View+ErrorAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+ErrorAlert.swift"; sourceTree = "<group>"; };
534537
001C6DD827FE585A00D472C2 /* AppSecrets.swift.masque */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AppSecrets.swift.masque; sourceTree = "<group>"; };
535538
00273CF32A82AB5900A7A77D /* SamplesSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SamplesSearchView.swift; sourceTree = "<group>"; };
536539
00273CF52A82AB8700A7A77D /* SampleRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleRow.swift; sourceTree = "<group>"; };
@@ -637,6 +640,7 @@
637640
D73723782AF5ADD700846884 /* FindRouteInMobileMapPackageView.MobileMapView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindRouteInMobileMapPackageView.MobileMapView.swift; sourceTree = "<group>"; };
638641
D73F8CF32AB1089900CD39DA /* Restaurant.stylx */ = {isa = PBXFileReference; lastKnownFileType = file; path = Restaurant.stylx; sourceTree = "<group>"; };
639642
D73FC0FC2AD4A18D0067A19B /* CreateMobileGeodatabaseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateMobileGeodatabaseView.swift; sourceTree = "<group>"; };
643+
D73FCFF42B02A3AA0006360D /* FindAddressWithReverseGeocodeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindAddressWithReverseGeocodeView.swift; sourceTree = "<group>"; };
640644
D73FCFFE2B02C7630006360D /* FindRouteAroundBarriersView.Views.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindRouteAroundBarriersView.Views.swift; sourceTree = "<group>"; };
641645
D742E48F2B04132B00690098 /* DisplayWebSceneFromPortalItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisplayWebSceneFromPortalItemView.swift; sourceTree = "<group>"; };
642646
D744FD162A2112D90084A66C /* CreateConvexHullAroundPointsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateConvexHullAroundPointsView.swift; sourceTree = "<group>"; };
@@ -753,7 +757,7 @@
753757
isa = PBXGroup;
754758
children = (
755759
E08953F02891899600E077CF /* EnvironmentValues+SampleInfoVisibility.swift */,
756-
00181B452846AD7100654571 /* View+Alert.swift */,
760+
00181B452846AD7100654571 /* View+ErrorAlert.swift */,
757761
E0082216287755AC002AD138 /* View+Sheet.swift */,
758762
);
759763
path = Extensions;
@@ -851,6 +855,7 @@
851855
E070A0A1286F3B3400F2B606 /* Download preplanned map area */,
852856
E004A6EE284E4B7A002A1FE6 /* Download vector tiles to local cache */,
853857
1C26ED122A859525009B7721 /* Filter features in scene */,
858+
D73FCFF32B02A3AA0006360D /* Find address with reverse geocode */,
854859
D7705D5F2AFC570700CC0335 /* Find closest facility from point */,
855860
D7705D542AFC244E00CC0335 /* Find closest facility to multiple points */,
856861
D78666A92A21616D00C60110 /* Find nearest vertex */,
@@ -1435,6 +1440,14 @@
14351440
path = "Create mobile geodatabase";
14361441
sourceTree = "<group>";
14371442
};
1443+
D73FCFF32B02A3AA0006360D /* Find address with reverse geocode */ = {
1444+
isa = PBXGroup;
1445+
children = (
1446+
D73FCFF42B02A3AA0006360D /* FindAddressWithReverseGeocodeView.swift */,
1447+
);
1448+
path = "Find address with reverse geocode";
1449+
sourceTree = "<group>";
1450+
};
14381451
D742E48E2B04132B00690098 /* Display web scene from portal item */ = {
14391452
isa = PBXGroup;
14401453
children = (
@@ -2260,7 +2273,7 @@
22602273
D71FCB8A2AD6277F000E517C /* CreateMobileGeodatabaseView.Model.swift in Sources */,
22612274
D752D9462A3A6F80003EB25E /* MonitorChangesToMapLoadStatusView.swift in Sources */,
22622275
E0082217287755AC002AD138 /* View+Sheet.swift in Sources */,
2263-
00181B462846AD7100654571 /* View+Alert.swift in Sources */,
2276+
00181B462846AD7100654571 /* View+ErrorAlert.swift in Sources */,
22642277
00273CF62A82AB8700A7A77D /* SampleRow.swift in Sources */,
22652278
D7ABA2FF2A32881C0021822B /* ShowViewshedFromGeoelementInSceneView.swift in Sources */,
22662279
E0FE32E728747778002C6ACA /* BrowseBuildingFloorsView.swift in Sources */,
@@ -2276,6 +2289,7 @@
22762289
0042E24328E4BF8F001F33D6 /* ShowViewshedFromPointInSceneView.Model.swift in Sources */,
22772290
D7E557682A1D768800B9FB09 /* AddWMSLayerView.swift in Sources */,
22782291
D7497F3C2AC4B4C100167AD2 /* DisplayDimensionsView.swift in Sources */,
2292+
D73FCFF72B02A3AA0006360D /* FindAddressWithReverseGeocodeView.swift in Sources */,
22792293
0005580A2817C51E00224BC6 /* SampleDetailView.swift in Sources */,
22802294
D75C35672AB50338003CD55F /* GroupLayersTogetherView.GroupLayerListView.swift in Sources */,
22812295
4D2ADC6229C5071C003B367F /* ChangeMapViewBackgroundView.Model.swift in Sources */,

Shared/Samples/Add feature layers/AddFeatureLayersView.swift

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,8 @@ import ArcGIS
1616
import SwiftUI
1717

1818
struct AddFeatureLayersView: View {
19-
/// A Boolean value indicating whether to show an alert.
20-
@State private var isShowingAlert = false
21-
22-
/// The error shown in the alert.
23-
@State private var error: Error? {
24-
didSet { isShowingAlert = error != nil }
25-
}
19+
/// The error shown in the error alert.
20+
@State private var error: Error?
2621

2722
/// The current viewpoint of the map view.
2823
@State private var viewpoint: Viewpoint?
@@ -52,7 +47,7 @@ struct AddFeatureLayersView: View {
5247
}
5348
}
5449
}
55-
.alert(isPresented: $isShowingAlert, presentingError: error)
50+
.errorAlert(presentingError: $error)
5651
.onAppear {
5752
// Updates the URL session challenge handler to use the
5853
// specified credentials and tokens for any challenges.

Shared/Samples/Add raster from file/AddRasterFromFileView.swift

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,8 @@ struct AddRasterFromFileView: View {
1919
/// A map with imagery basemap and a raster layer.
2020
@State private var map = Map(basemapStyle: .arcGISImageryStandard)
2121

22-
/// A Boolean value indicating whether to show an alert.
23-
@State private var isShowingAlert = false
24-
25-
/// The error shown in the alert.
26-
@State private var error: Error? {
27-
didSet { isShowingAlert = error != nil }
28-
}
22+
/// The error shown in the error alert.
23+
@State private var error: Error?
2924

3025
/// The current viewpoint of the map view.
3126
@State private var viewpoint: Viewpoint?
@@ -34,7 +29,7 @@ struct AddRasterFromFileView: View {
3429
// Creates a map view with a viewpoint to display the map.
3530
MapView(map: map, viewpoint: viewpoint)
3631
.onViewpointChanged(kind: .centerAndScale) { viewpoint = $0 }
37-
.alert(isPresented: $isShowingAlert, presentingError: error)
32+
.errorAlert(presentingError: $error)
3833
.task {
3934
guard map.operationalLayers.isEmpty else { return }
4035
do {

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,8 @@ struct AnalyzeNetworkWithSubnetworkTraceView: View {
4646
/// A Boolean value indicating whether to include containment features in the trace results.
4747
@State private var includesContainers = true
4848

49-
/// A Boolean value indicating whether to show an alert.
50-
@State private var isPresentingError = false
51-
52-
/// The error shown in the alert.
53-
@State private var error: Error? {
54-
didSet { isPresentingError = error != nil }
55-
}
49+
/// The error shown in the error alert.
50+
@State private var error: Error?
5651

5752
var body: some View {
5853
if !model.isSetUp {
@@ -150,7 +145,7 @@ struct AnalyzeNetworkWithSubnetworkTraceView: View {
150145
.shadow(radius: 50)
151146
}
152147
}
153-
.alert(isPresented: $isPresentingError, presentingError: error)
148+
.errorAlert(presentingError: $error)
154149
}
155150

156151
@ViewBuilder var conditionMenu: some View {

Shared/Samples/Animate 3D graphic/Animate3DGraphicView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct Animate3DGraphicView: View {
4242
StatRow("Roll", value: model.animation.currentFrame.roll.formatted(.angle))
4343
}
4444
.frame(width: 170, height: 100)
45-
.background(Color.white.opacity(0.5))
45+
.background(.ultraThinMaterial)
4646
.cornerRadius(10)
4747
.shadow(radius: 3)
4848
}

Shared/Samples/Augment reality to show tabletop scene/AugmentRealityToShowTabletopSceneView.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@ struct AugmentRealityToShowTabletopSceneView: View {
2020
/// The scene used to create the scene view.
2121
@State private var scene = ArcGIS.Scene()
2222

23-
/// A Boolean value indicating whether to show an error alert.
24-
@State private var isShowingErrorAlert = false
25-
2623
/// The error shown in the error alert.
27-
@State private var error: Error? {
28-
didSet { isShowingErrorAlert = error != nil }
29-
}
24+
@State private var error: Error?
3025

3126
/// The location point of the scene that will be anchored on a physical surface.
3227
private let anchorPoint = Point(
@@ -77,7 +72,7 @@ struct AugmentRealityToShowTabletopSceneView: View {
7772
self.error = error
7873
}
7974
}
80-
.alert(isPresented: $isShowingErrorAlert, presentingError: error)
75+
.errorAlert(presentingError: $error)
8176
}
8277
}
8378

Shared/Samples/Browse building floors/BrowseBuildingFloorsView.swift

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@ import ArcGISToolkit
1717
import SwiftUI
1818

1919
struct BrowseBuildingFloorsView: View {
20-
/// A Boolean value indicating whether to show an alert.
21-
@State private var isShowingAlert = false
22-
23-
/// The error shown in the alert.
24-
@State private var error: Error? {
25-
didSet { isShowingAlert = error != nil }
26-
}
20+
/// The error shown in the error alert.
21+
@State private var error: Error?
2722

2823
/// The current viewpoint of the map.
2924
@State private var viewpoint: Viewpoint?
@@ -46,7 +41,7 @@ struct BrowseBuildingFloorsView: View {
4641
MapView(map: map)
4742
.onViewpointChanged(kind: .centerAndScale) { viewpoint = $0 }
4843
.onNavigatingChanged { isMapNavigating = $0 }
49-
.alert(isPresented: $isShowingAlert, presentingError: error)
44+
.errorAlert(presentingError: $error)
5045
.ignoresSafeArea(.keyboard, edges: .bottom)
5146
.overlay(alignment: .bottomTrailing) {
5247
if isMapLoaded,

Shared/Samples/Create and edit geometries/CreateAndEditGeometriesView.swift

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,15 @@ class GeometryEditorMenuModel: ObservableObject {
265265
/// A Boolean value indicating if the scale mode is uniform.
266266
@Published var shouldUniformScale = false {
267267
didSet {
268-
let scaleMode: GeometryEditorScaleMode = shouldUniformScale ? .uniform : .stretch
269-
let tool = geometryEditor.tool
270-
(tool as? FreehandTool)?.configuration.scaleMode = scaleMode
271-
(tool as? ShapeTool)?.configuration.scaleMode = scaleMode
272-
(tool as? VertexTool)?.configuration.scaleMode = scaleMode
268+
configureGeometryEditorTool(geometryEditor.tool, scaleMode: scaleMode)
273269
}
274270
}
275271

272+
/// The scale mode to be set on the geometry editor.
273+
private var scaleMode: GeometryEditorScaleMode {
274+
shouldUniformScale ? .uniform : .stretch
275+
}
276+
276277
/// Creates the geometry menu with a geometry editor.
277278
/// - Parameter geometryEditor: The geometry editor that the menu should interact with.
278279
/// - Parameter graphicsOverlay: The graphics overlay that is used to save geometries to.
@@ -334,11 +335,29 @@ class GeometryEditorMenuModel: ObservableObject {
334335
}
335336
}
336337

338+
/// Configures the scale mode for the geometry editor tool.
339+
/// - Parameters:
340+
/// - tool: The geometry editor tool.
341+
/// - scaleMode: Preserve the original aspect ratio or scale freely.
342+
func configureGeometryEditorTool(_ tool: GeometryEditorTool, scaleMode: GeometryEditorScaleMode) {
343+
switch tool {
344+
case let tool as FreehandTool:
345+
tool.configuration.scaleMode = scaleMode
346+
case let tool as ShapeTool:
347+
tool.configuration.scaleMode = scaleMode
348+
case let tool as VertexTool:
349+
tool.configuration.scaleMode = scaleMode
350+
default:
351+
fatalError("Unexpected tool type")
352+
}
353+
}
354+
337355
/// Starts editing with the specified tool and geometry type.
338356
/// - Parameters:
339357
/// - tool: The tool to draw with.
340358
/// - geometryType: The type of geometry to draw.
341359
func startEditing(with tool: GeometryEditorTool, geometryType: Geometry.Type) {
360+
configureGeometryEditorTool(tool, scaleMode: scaleMode)
342361
geometryEditor.tool = tool
343362
geometryEditor.start(withType: geometryType)
344363
isStarted = true

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,8 @@ extension CreateAndSaveKMLView {
6060
/// A Boolean value indicating if the file exporter button should be disabled.
6161
@Published var fileExporterButtonIsDisabled = true
6262

63-
/// A Boolean value indicating whether to show an alert.
64-
@Published var isShowingAlert = false
65-
66-
/// The error shown in the alert.
67-
@Published var error: Error? {
68-
didSet { isShowingAlert = error != nil }
69-
}
63+
/// The error shown in the error alert.
64+
@Published var error: Error?
7065

7166
/// Creates the model for this view.
7267
init() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct CreateAndSaveKMLView: View {
2323
var body: some View {
2424
MapView(map: model.map)
2525
.geometryEditor(model.geometryEditor)
26-
.alert(isPresented: $model.isShowingAlert, presentingError: model.error)
26+
.errorAlert(presentingError: $model.error)
2727
.toolbar {
2828
ToolbarItem(placement: .primaryAction) {
2929
HStack {

0 commit comments

Comments
 (0)