Skip to content

Feature template picker #993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: v.next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
be339f9
add file
rolson Dec 27, 2024
379ae7d
update feature template picker
rolson Dec 27, 2024
5333498
fix build errors
rolson Dec 27, 2024
ebc6936
write example
rolson Dec 28, 2024
965e25d
update feature template picker
rolson Dec 28, 2024
aa2955b
add example
rolson Dec 28, 2024
a28912e
add doc
rolson Dec 28, 2024
0a29c98
Apply suggestions from code review
rolson Dec 31, 2024
4997742
fix build
rolson Dec 31, 2024
a274ee4
localization string fix
rolson Dec 31, 2024
c53db51
fix visionOS build
rolson Dec 31, 2024
27101fc
Use same map as old toolkit
rolson Dec 31, 2024
f614346
add tests
rolson Dec 31, 2024
cb4b95a
add tests
rolson Dec 31, 2024
9bf98ad
add tests
rolson Dec 31, 2024
ac020f9
remove unnecessary import
rolson Dec 31, 2024
45c9f1c
fix preamble
rolson Dec 31, 2024
9aedfee
start adding tutorial
rolson Dec 31, 2024
6eb3235
add tutorial
rolson Dec 31, 2024
02617db
fix accidental reversion
rolson Dec 31, 2024
6faa523
add tutorial to TOC
rolson Dec 31, 2024
b217b60
Update Sources/ArcGISToolkit/Components/FeatureTemplatePicker/Feature…
rolson Jan 2, 2025
49f601f
fix crash
rolson Jan 2, 2025
d5f8854
limit how big an icon can be, but not how small
rolson Jan 2, 2025
3ffb37d
fix issues with maximum size
rolson Jan 3, 2025
2d12b46
add PR feedback
rolson Jan 3, 2025
1cf4058
Update Sources/ArcGISToolkit/Documentation.docc/Tutorials/FeatureTemp…
rolson Jan 3, 2025
d3c14c5
implement solution for iOS 16
rolson Jan 3, 2025
6359152
Merge branch 'ryan/featureTemplatePicker' of https://github.com/Esri/…
rolson Jan 3, 2025
b89f775
fix warnings
rolson Jan 3, 2025
57aef47
Update FeatureTemplatePicker.png
dfeinzimer Jan 7, 2025
5f2f894
Update Sources/ArcGISToolkit/Components/FeatureTemplatePicker/Feature…
rolson Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
75C37C9227BEDBD800FC9DCE /* BookmarksExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C37C9127BEDBD800FC9DCE /* BookmarksExampleView.swift */; };
75D41B2B27C6F21400624D7C /* ScalebarExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75D41B2A27C6F21400624D7C /* ScalebarExampleView.swift */; };
882899FD2AB5099300A0BDC1 /* FlyoverExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 882899FC2AB5099300A0BDC1 /* FlyoverExampleView.swift */; };
88A2AF8B2D1F762C006B60DE /* FeatureTemplatePickerExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88A2AF8A2D1F762C006B60DE /* FeatureTemplatePickerExampleView.swift */; };
E42BFBE92672BF9500159107 /* SearchExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E42BFBE82672BF9500159107 /* SearchExampleView.swift */; };
E4624A25278CE815000D2A38 /* FloorFilterExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4624A24278CE815000D2A38 /* FloorFilterExampleView.swift */; };
E47ABE442652FE0900FD2FE3 /* ExamplesApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = E47ABE432652FE0900FD2FE3 /* ExamplesApp.swift */; };
Expand Down Expand Up @@ -55,6 +56,7 @@
75C37C9127BEDBD800FC9DCE /* BookmarksExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksExampleView.swift; sourceTree = "<group>"; };
75D41B2A27C6F21400624D7C /* ScalebarExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScalebarExampleView.swift; sourceTree = "<group>"; };
882899FC2AB5099300A0BDC1 /* FlyoverExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlyoverExampleView.swift; sourceTree = "<group>"; };
88A2AF8A2D1F762C006B60DE /* FeatureTemplatePickerExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureTemplatePickerExampleView.swift; sourceTree = "<group>"; };
E42BFBE82672BF9500159107 /* SearchExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchExampleView.swift; sourceTree = "<group>"; };
E4624A24278CE815000D2A38 /* FloorFilterExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloorFilterExampleView.swift; sourceTree = "<group>"; };
E47ABE402652FE0900FD2FE3 /* Toolkit Examples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Toolkit Examples.app"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -93,6 +95,7 @@
75C37C9127BEDBD800FC9DCE /* BookmarksExampleView.swift */,
75657E4727ABAC8400EE865B /* CompassExampleView.swift */,
75B615012AD76158009D19B6 /* FeatureFormExampleView.swift */,
88A2AF8A2D1F762C006B60DE /* FeatureTemplatePickerExampleView.swift */,
E4AA9315276BF5ED000E6289 /* FloatingPanelExampleView.swift */,
E4624A24278CE815000D2A38 /* FloorFilterExampleView.swift */,
882899FC2AB5099300A0BDC1 /* FlyoverExampleView.swift */,
Expand Down Expand Up @@ -281,6 +284,7 @@
882899FD2AB5099300A0BDC1 /* FlyoverExampleView.swift in Sources */,
E48A73462658227100F5C118 /* ExampleView.swift in Sources */,
E42BFBE92672BF9500159107 /* SearchExampleView.swift in Sources */,
88A2AF8B2D1F762C006B60DE /* FeatureTemplatePickerExampleView.swift in Sources */,
E4C389D526B8A12C002BC255 /* BasemapGalleryExampleView.swift in Sources */,
75D41B2B27C6F21400624D7C /* ScalebarExampleView.swift in Sources */,
);
Expand Down
83 changes: 83 additions & 0 deletions Examples/Examples/FeatureTemplatePickerExampleView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// 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 ArcGIS
import ArcGISToolkit
import SwiftUI

/// Allows a user to select a feature template and displays
/// the name of the template that was selected.
struct FeatureTemplatePickerExampleView: View {
static func makeMap() -> Map {
let map = Map(basemapStyle: .arcGISTopographic)
let featureTable = ServiceFeatureTable(url: URL(string: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0")!)
let featureLayer = FeatureLayer(featureTable: featureTable)
map.addOperationalLayer(featureLayer)
return map
}

/// The `Map` displayed in the `MapView`.
@State private var map = makeMap()

/// A Boolean value indicating if the feature template picker
/// is presented.
@State private var templatePickerIsPresented = false

/// The selection of the feature template picker.
@State private var selection: FeatureTemplateInfo?

var body: some View {
MapView(map: map)
.sheet(isPresented: $templatePickerIsPresented) {
NavigationStack {
FeatureTemplatePicker(
geoModel: map,
selection: $selection,
includeNonCreatableFeatureTemplates: true
)
.onAppear {
// Reset selection when the picker appears.
selection = nil
}
.navigationTitle("Feature Templates")
}
}
.onChange(of: selection) { _ in
// Dismiss the template picker upon selection.
if selection != nil {
templatePickerIsPresented = false
}
}
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button {
templatePickerIsPresented = true
} label: {
Text("Templates")
}
}
}
.safeAreaInset(edge: .top) {
if let selection {
HStack {
if let image = selection.image {
Image(uiImage: image)
}
Text("\(selection.template.name) Template Selected")
}
.font(.subheadline)
}
}
}
}
1 change: 1 addition & 0 deletions Examples/ExamplesApp/Examples.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ extension ExampleList {
AnyExample("Bookmarks", content: BookmarksExampleView()),
AnyExample("Compass", content: CompassExampleView()),
AnyExample("Feature Form", content: FeatureFormExampleView()),
AnyExample("Feature Template Picker", content: FeatureTemplatePickerExampleView()),
AnyExample("Floor Filter", content: FloorFilterExampleView()),
AnyExample("Overview Map", content: OverviewMapExampleView()),
AnyExample("Popup", content: PopupExampleView()),
Expand Down
Loading