-
Notifications
You must be signed in to change notification settings - Fork 17
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
rolson
wants to merge
32
commits into
v.next
Choose a base branch
from
ryan/featureTemplatePicker
base: v.next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
be339f9
add file
rolson 379ae7d
update feature template picker
rolson 5333498
fix build errors
rolson ebc6936
write example
rolson 965e25d
update feature template picker
rolson aa2955b
add example
rolson a28912e
add doc
rolson 0a29c98
Apply suggestions from code review
rolson 4997742
fix build
rolson a274ee4
localization string fix
rolson c53db51
fix visionOS build
rolson 27101fc
Use same map as old toolkit
rolson f614346
add tests
rolson cb4b95a
add tests
rolson 9bf98ad
add tests
rolson ac020f9
remove unnecessary import
rolson 45c9f1c
fix preamble
rolson 9aedfee
start adding tutorial
rolson 6eb3235
add tutorial
rolson 02617db
fix accidental reversion
rolson 6faa523
add tutorial to TOC
rolson b217b60
Update Sources/ArcGISToolkit/Components/FeatureTemplatePicker/Feature…
rolson 49f601f
fix crash
rolson d5f8854
limit how big an icon can be, but not how small
rolson 3ffb37d
fix issues with maximum size
rolson 2d12b46
add PR feedback
rolson 1cf4058
Update Sources/ArcGISToolkit/Documentation.docc/Tutorials/FeatureTemp…
rolson d3c14c5
implement solution for iOS 16
rolson 6359152
Merge branch 'ryan/featureTemplatePicker' of https://github.com/Esri/…
rolson b89f775
fix warnings
rolson 57aef47
Update FeatureTemplatePicker.png
dfeinzimer 5f2f894
Update Sources/ArcGISToolkit/Components/FeatureTemplatePicker/Feature…
rolson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 portalItem = PortalItem( | ||
| portal: .arcGISOnline(connection: .anonymous), | ||
| id: Item.ID("9f3a674e998f461580006e626611f9ad")! | ||
| ) | ||
| return Map(item: portalItem) | ||
| } | ||
|
|
||
| /// The `Map` displayed in the `MapView`. | ||
| @State private var map = makeMap() | ||
|
|
||
| /// A Boolean value indicating if the feature template picker | ||
| /// is being displayed. | ||
| @State private var isShowingTemplates = false | ||
|
|
||
| /// The selection of the feature template picker. | ||
| @State private var selection: FeatureTemplateInfo? | ||
|
|
||
| var body: some View { | ||
| MapView(map: map) | ||
| .sheet(isPresented: $isShowingTemplates) { | ||
| 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 { | ||
| isShowingTemplates = false | ||
| } | ||
| } | ||
| .toolbar { | ||
| ToolbarItem(placement: .topBarTrailing) { | ||
| Button { | ||
| isShowingTemplates = 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) | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.