Skip to content

Commit 7fd68be

Browse files
committed
Add feature layer property.
#528 (comment)
1 parent 13af9f3 commit 7fd68be

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Shared/Samples/Edit features using feature forms/EditFeaturesUsingFeatureFormsView.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ struct EditFeaturesUsingFeatureFormsView: View {
5959
}
6060
}
6161

62+
/// The feature layer on the map.
63+
private var featureLayer: FeatureLayer {
64+
map.operationalLayers.first as! FeatureLayer
65+
}
66+
6267
var body: some View {
6368
MapViewReader { mapViewProxy in
6469
MapView(map: map)
@@ -71,10 +76,7 @@ struct EditFeaturesUsingFeatureFormsView: View {
7176
}
7277
.task(id: tapPoint) {
7378
// Identifies the feature at the tapped point and creates a feature form from it.
74-
guard let tapPoint,
75-
let featureLayer = map.operationalLayers.first as? FeatureLayer else {
76-
return
77-
}
79+
guard let tapPoint else { return }
7880
defer { self.tapPoint = nil }
7981

8082
do {
@@ -166,9 +168,7 @@ struct EditFeaturesUsingFeatureFormsView: View {
166168
/// Closes the feature form panel and resets the feature selection.
167169
private func endEditing() {
168170
isShowingFeatureForm = false
169-
170-
let featureLayer = map.operationalLayers.first as? FeatureLayer
171-
featureLayer?.clearSelection()
171+
featureLayer.clearSelection()
172172
}
173173

174174
/// Applies the edits made in the feature form to the feature service.

0 commit comments

Comments
 (0)