Skip to content

Commit e4379f5

Browse files
committed
PR feedback
1 parent 9b926c8 commit e4379f5

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

Shared/Samples/Display points using clustering feature reduction/DisplayPointsUsingClusteringFeatureReductionView.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ struct DisplayPointsUsingClusteringFeatureReductionView: View {
2121
@State private var map = {
2222
let portalItem = PortalItem(
2323
portal: .arcGISOnline(connection: .anonymous),
24-
id: Item.ID(rawValue: "8916d50c44c746c1aafae001552bad23")!
24+
id: PortalItem.ID("8916d50c44c746c1aafae001552bad23")!
2525
)
2626
return Map(item: portalItem)
2727
}()
2828

2929
/// The power plants feature layer for querying.
30-
@State private var layer: FeatureLayer?
30+
private var layer: FeatureLayer? {
31+
map.operationalLayers.first as? FeatureLayer
32+
}
3133

3234
/// The screen point to perform an identify operation.
3335
@State private var identifyScreenPoint: CGPoint?
@@ -36,13 +38,13 @@ struct DisplayPointsUsingClusteringFeatureReductionView: View {
3638
@State private var popup: Popup?
3739

3840
/// A Boolean value specifying whether the popup view should be shown or not.
39-
@State private var showPopup = false
41+
@State private var showsPopup = false
4042

4143
/// A Boolean value specifying whether the layer's feature reduction is shown.
42-
@State var showsFeatureReduction = true
44+
@State private var showsFeatureReduction = true
4345

4446
/// A Boolean value indicating whether to show an error alert.
45-
@State var isShowingAlert = false
47+
@State private var isShowingAlert = false
4648

4749
/// The error shown in the error alert.
4850
@State var error: Error? {
@@ -56,8 +58,8 @@ struct DisplayPointsUsingClusteringFeatureReductionView: View {
5658
identifyScreenPoint = screenPoint
5759
}
5860
.task(id: identifyScreenPoint) {
59-
guard let identifyScreenPoint = identifyScreenPoint,
60-
let layer = self.layer,
61+
guard let identifyScreenPoint,
62+
let layer,
6163
let identifyResult = try? await proxy.identify(
6264
on: layer,
6365
screenPoint: identifyScreenPoint,
@@ -66,16 +68,16 @@ struct DisplayPointsUsingClusteringFeatureReductionView: View {
6668
let firstPopup = identifyResult.popups.first
6769
else { return }
6870
self.popup = firstPopup
69-
self.showPopup = true
71+
self.showsPopup = true
7072
}
7173
.floatingPanel(
7274
selectedDetent: .constant(.half),
7375
horizontalAlignment: .leading,
74-
isPresented: $showPopup
76+
isPresented: $showsPopup
7577
) {
7678
Group {
7779
if let popup = popup {
78-
PopupView(popup: popup, isPresented: $showPopup)
80+
PopupView(popup: popup, isPresented: $showsPopup)
7981
.showCloseButton(true)
8082
}
8183
}
@@ -93,7 +95,6 @@ struct DisplayPointsUsingClusteringFeatureReductionView: View {
9395
.task {
9496
do {
9597
try await map.load()
96-
layer = map.operationalLayers.first as? FeatureLayer
9798
layer?.featureReduction?.isEnabled = true
9899
} catch {
99100
self.error = error

Shared/Samples/Display points using clustering feature reduction/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Pan and zoom the map to view how clustering is dynamically updated. Toggle clust
1818
2. Get the cluster enabled layer from the map's operational layers.
1919
3. Get the `FeatureReduction` from the feature layer and set `isEnabled` to enable or disable clustering on the feature layer.
2020
4. Use the `onSingleTapGesture` modifier to listen for tap events on the map view.
21-
5. Identify tapped features on the map using `identify(on layer:screenPoint:tolerance:)` on the feature layer and pass in the map screen point location.
21+
5. Identify tapped features on the map using `identify(on:screenPoint:tolerance:returnPopupsOnly:maximumResults:)` on the feature layer and pass in the map screen point location.
2222
6. Get the `Popup` from the resulting `IdentifyLayerResult` and use it to construct a `PopupView`.
2323
7. Use a `FloatingPanel` to display the popup information from the `PopupView`.
2424

@@ -32,7 +32,7 @@ Pan and zoom the map to view how clustering is dynamically updated. Toggle clust
3232

3333
## About the data
3434

35-
This sample uses a [web map](https://www.arcgis.com/home/item.html?id=8916d50c44c746c1aafae001552bad23) that displays the [Esri Global Power](https://www.arcgis.com/home/item.html?id=eb54b44c65b846cca12914b87b315169) Plants feature layer with feature reduction enabled. When enabled, the aggregate features symbology shows the color of the most common power plant type, and a size relative to the average plant capacity of the cluster.
35+
This sample uses a [web map](https://www.arcgis.com/home/item.html?id=8916d50c44c746c1aafae001552bad23) that displays the [Esri Global Power Plants](https://www.arcgis.com/home/item.html?id=eb54b44c65b846cca12914b87b315169) feature layer with feature reduction enabled. When enabled, the aggregate features symbology shows the color of the most common power plant type, and a size relative to the average plant capacity of the cluster.
3636

3737
## Tags
3838

0 commit comments

Comments
 (0)