Skip to content

Commit 9280aae

Browse files
committed
Merge branch 'v.next' into philium/UtilityNetworkTrace-visionOS-support
2 parents b61619d + 22cb3b1 commit 9280aae

15 files changed

+29
-49
lines changed

Examples/Examples.xcodeproj/project.pbxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
75C37C9227BEDBD800FC9DCE /* BookmarksExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C37C9127BEDBD800FC9DCE /* BookmarksExampleView.swift */; };
1717
75D41B2B27C6F21400624D7C /* ScalebarExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75D41B2A27C6F21400624D7C /* ScalebarExampleView.swift */; };
1818
882899FD2AB5099300A0BDC1 /* FlyoverExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 882899FC2AB5099300A0BDC1 /* FlyoverExampleView.swift */; platformFilter = ios; };
19-
E42BFBE92672BF9500159107 /* SearchExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E42BFBE82672BF9500159107 /* SearchExampleView.swift */; platformFilters = (ios, maccatalyst, ); };
19+
E42BFBE92672BF9500159107 /* SearchExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E42BFBE82672BF9500159107 /* SearchExampleView.swift */; };
2020
E4624A25278CE815000D2A38 /* FloorFilterExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4624A24278CE815000D2A38 /* FloorFilterExampleView.swift */; };
2121
E47ABE442652FE0900FD2FE3 /* ExamplesApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = E47ABE432652FE0900FD2FE3 /* ExamplesApp.swift */; };
2222
E47ABE482652FE0C00FD2FE3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E47ABE472652FE0C00FD2FE3 /* Assets.xcassets */; };

Examples/ExamplesApp/Examples.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ extension ExampleList {
6464
AnyExample("Overview Map", content: OverviewMapExampleView()),
6565
AnyExample("Popup", content: PopupExampleView()),
6666
AnyExample("Scalebar", content: ScalebarExampleView()),
67+
AnyExample("Search", content: SearchExampleView()),
6768
AnyExample("Utility Network Trace", content: UtilityNetworkTraceExampleView())
6869
]
6970
#if !os(visionOS)
7071
examples.append(
7172
contentsOf: [
72-
AnyExample("Feature Form", content: FeatureFormExampleView()),
73-
AnyExample("Search", content: SearchExampleView())
73+
AnyExample("Feature Form", content: FeatureFormExampleView())
7474
] as [any Example]
7575
)
7676
#endif

Sources/ArcGISToolkit/Components/FeatureFormView/FormViewModel.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import SwiftUI
4242

4343
/// Initializes a form view model.
4444
/// - Parameter featureForm: The feature form defining the editing experience.
45-
public init(featureForm: FeatureForm) {
45+
init(featureForm: FeatureForm) {
4646
self.featureForm = featureForm
4747
}
4848

Sources/ArcGISToolkit/Components/Search/LocatorSearchSource.swift

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import Foundation
1818

1919
/// Uses a Locator to provide search and suggest results. Most configuration should be done on the
2020
/// `GeocodeParameters` directly.
21-
@available(visionOS, unavailable)
2221
public class LocatorSearchSource: ObservableObject, SearchSource {
2322
/// Creates a locator search source.
2423
/// - Parameters:
@@ -132,7 +131,6 @@ public class LocatorSearchSource: ObservableObject, SearchSource {
132131
}
133132
}
134133

135-
@available(visionOS, unavailable)
136134
private extension LocatorSearchSource {
137135
func internalSearch(
138136
_ query: String,

Sources/ArcGISToolkit/Components/Search/SearchResult.swift

-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import UIKit.UIImage
1616
import ArcGIS
1717

1818
/// Wraps a search result for display.
19-
@available(visionOS, unavailable)
2019
public struct SearchResult: @unchecked Sendable {
2120
/// Creates a `SearchResult`.
2221
/// - Parameters:
@@ -71,24 +70,20 @@ public struct SearchResult: @unchecked Sendable {
7170

7271
// MARK: Extensions
7372

74-
@available(visionOS, unavailable)
7573
extension SearchResult: Identifiable {}
7674

77-
@available(visionOS, unavailable)
7875
extension SearchResult: Equatable {
7976
public static func == (lhs: SearchResult, rhs: SearchResult) -> Bool {
8077
lhs.id == rhs.id
8178
}
8279
}
8380

84-
@available(visionOS, unavailable)
8581
extension SearchResult: Hashable {
8682
public func hash(into hasher: inout Hasher) {
8783
hasher.combine(id)
8884
}
8985
}
9086

91-
@available(visionOS, unavailable)
9287
extension SearchResult {
9388
init(
9489
geocodeResult: GeocodeResult,

Sources/ArcGISToolkit/Components/Search/SearchSource.swift

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import ArcGIS
1717
/// Defines the contract for a search result provider.
1818
@MainActor
1919
@preconcurrency
20-
@available(visionOS, unavailable)
2120
public protocol SearchSource {
2221
/// Name to show when presenting this source in the UI.
2322
var name: String { get set }

Sources/ArcGISToolkit/Components/Search/SearchSuggestion.swift

-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import Foundation
1616
import ArcGIS
1717

1818
/// Wraps a suggestion for display.
19-
@available(visionOS, unavailable)
2019
public struct SearchSuggestion: @unchecked Sendable {
2120
/// Creates a `SearchSuggestion`.
2221
/// - Parameters:
@@ -63,17 +62,14 @@ public struct SearchSuggestion: @unchecked Sendable {
6362
public let id = UUID()
6463
}
6564

66-
@available(visionOS, unavailable)
6765
extension SearchSuggestion: Identifiable {}
6866

69-
@available(visionOS, unavailable)
7067
extension SearchSuggestion: Equatable {
7168
public static func == (lhs: SearchSuggestion, rhs: SearchSuggestion) -> Bool {
7269
lhs.id == rhs.id
7370
}
7471
}
7572

76-
@available(visionOS, unavailable)
7773
extension SearchSuggestion: Hashable {
7874
public func hash(into hasher: inout Hasher) {
7975
// Note: We're not hashing `suggestResult` as `SearchSuggestion` is
@@ -84,7 +80,6 @@ extension SearchSuggestion: Hashable {
8480
}
8581
}
8682

87-
@available(visionOS, unavailable)
8883
extension SearchSuggestion {
8984
init(suggestResult: SuggestResult, searchSource: SearchSource) {
9085
self.init(

Sources/ArcGISToolkit/Components/Search/SearchView.swift

+12-14
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import ArcGIS
6060
/// To see the `SearchView` in action, and for examples of `Search` customization, check out the [Examples](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/tree/main/Examples/Examples)
6161
/// and refer to [SearchExampleView.swift](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Examples/Examples/SearchExampleView.swift)
6262
/// in the project. To learn more about using the `SearchView` see the <doc:SearchViewTutorial>.
63-
@available(visionOS, unavailable)
6463
public struct SearchView: View {
6564
/// Creates a `SearchView`.
6665
/// - Parameters:
@@ -221,21 +220,23 @@ public struct SearchView: View {
221220
}
222221
Spacer()
223222
if viewModel.isEligibleForRequery {
224-
Button {
225-
viewModel.repeatSearch()
226-
} label: {
227-
Text(
228-
"Repeat Search Here",
223+
Button(
224+
String(
225+
localized: "Repeat Search Here",
229226
bundle: .toolkitModule,
230227
comment: """
231-
A label for button to show when the user has panned the map away
232-
from the original search location. 'Here' is in reference to the
233-
current visible extent of the map or scene.
234-
"""
228+
A label for button to show when the user has panned the map away
229+
from the original search location. 'Here' is in reference to the
230+
current visible extent of the map or scene.
231+
"""
235232
)
233+
) {
234+
viewModel.repeatSearch()
236235
}
236+
#if !os(visionOS)
237237
.buttonStyle(.plain)
238238
.esriBorder()
239+
#endif
239240
}
240241
}
241242
.listStyle(.plain)
@@ -270,7 +271,7 @@ public struct SearchView: View {
270271
}
271272

272273
// MARK: Modifiers
273-
@available(visionOS, unavailable)
274+
274275
extension SearchView {
275276
/// Specifies whether a built-in result view will be shown. If `false`, the result display/selection
276277
/// list is not shown. Set to `false` if you want to define a custom result list. You might use a
@@ -380,7 +381,6 @@ extension SearchView {
380381
}
381382

382383
/// A View displaying the list of search results.
383-
@available(visionOS, unavailable)
384384
struct SearchResultList: View {
385385
/// The array of search results to display.
386386
var searchResults: [SearchResult]
@@ -404,7 +404,6 @@ struct SearchResultList: View {
404404
}
405405

406406
/// A View displaying the list of search suggestion results.
407-
@available(visionOS, unavailable)
408407
struct SearchSuggestionList: View {
409408
/// The array of suggestion results to display.
410409
var suggestionResults: [SearchSuggestion]
@@ -466,7 +465,6 @@ struct ResultRow: View {
466465
}
467466
}
468467

469-
@available(visionOS, unavailable)
470468
extension ResultRow {
471469
/// Creates a `ResultRow` from a search suggestion.
472470
/// - Parameter searchSuggestion: The search suggestion displayed in the row.

Sources/ArcGISToolkit/Components/Search/SearchViewModel.swift

-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import Combine
1717
import SwiftUI
1818

1919
/// Defines how many results to return; one, many, or automatic based on circumstance.
20-
@available(visionOS, unavailable)
2120
public enum SearchResultMode: Sendable {
2221
/// Search should always result in at most one result.
2322
case single
@@ -34,15 +33,13 @@ public enum SearchResultMode: Sendable {
3433
///
3534
/// The `failure` case contains the error (if any) generated by the last search or suggestion
3635
/// operation.
37-
@available(visionOS, unavailable)
3836
public enum SearchOutcome: Sendable {
3937
case results([SearchResult])
4038
case suggestions([SearchSuggestion])
4139
case failure(String)
4240
}
4341

4442
/// Performs searches and manages search state for a search, or optionally without a UI connection.
45-
@available(visionOS, unavailable)
4643
@MainActor final class SearchViewModel: ObservableObject {
4744
/// Creates a `SearchViewModel`.
4845
/// - Parameters:
@@ -245,7 +242,6 @@ public enum SearchOutcome: Sendable {
245242
}
246243
}
247244

248-
@available(visionOS, unavailable)
249245
private extension SearchViewModel {
250246
/// Method to execute an async `repeatSearch` operation.
251247
func doRepeatSearch() async {
@@ -358,7 +354,6 @@ private extension SearchViewModel {
358354
}
359355
}
360356

361-
@available(visionOS, unavailable)
362357
extension SearchViewModel {
363358
/// Returns the search source to be used in geocode operations.
364359
/// - Returns: The search source to use.
@@ -373,7 +368,6 @@ extension SearchViewModel {
373368
}
374369
}
375370

376-
@available(visionOS, unavailable)
377371
private extension SearchViewModel {
378372
func display(searchResults: [SearchResult]) {
379373
guard let resultsOverlay = resultsOverlay else { return }
@@ -419,10 +413,8 @@ private extension SearchViewModel {
419413
}
420414
}
421415

422-
@available(visionOS, unavailable)
423416
extension SearchOutcome: Equatable {}
424417

425-
@available(visionOS, unavailable)
426418
private extension Graphic {
427419
func update(with result: SearchResult) {
428420
if symbol == nil {

Sources/ArcGISToolkit/Components/Search/SmartLocatorSearchSource.swift

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import ArcGIS
1717

1818
/// Extends `LocatorSearchSource` with intelligent search behaviors; adds support for features like
1919
/// type-specific placemarks, repeated search, and more on the world geocode service.
20-
@available(visionOS, unavailable)
2120
public class SmartLocatorSearchSource: LocatorSearchSource {
2221
/// Creates a smart locator search source.
2322
/// - Parameters:

Sources/ArcGISToolkit/Utility/MarkdownView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal import Markdown
2222
/// - Code Block
2323
/// - Emphasis
2424
/// - Heading
25-
/// Horizontal Rule
25+
/// - Horizontal Rule
2626
/// - Image
2727
/// - Inline Code
2828
/// - Link

Sources/ArcGISToolkit/Utility/SearchField.swift

+12-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import SwiftUI
1616

1717
/// A custom view implementing a SearchField. It contains a search button, text field, delete text button,
1818
/// and a button to allow users to hide/show the search results list.
19-
@available(visionOS, unavailable)
2019
public struct SearchField: View {
2120
/// Creates a `SearchField`.
2221
/// - Parameters:
@@ -57,7 +56,10 @@ public struct SearchField: View {
5756
public var body: some View {
5857
HStack {
5958
// Search icon
60-
Image(systemName: "magnifyingglass.circle.fill")
59+
Image(systemName: "magnifyingglass")
60+
#if !os(visionOS)
61+
.symbolVariant(.circle.fill)
62+
#endif
6163
.foregroundStyle(Color.secondary)
6264

6365
// Search text field
@@ -72,6 +74,10 @@ public struct SearchField: View {
7274
)
7375
}
7476
.focused(isFocused)
77+
#if os(visionOS)
78+
.contentShape(.hoverEffect, .rect(cornerRadius: 12))
79+
.hoverEffect()
80+
#endif
7581

7682
// Delete text button
7783
if !query.wrappedValue.isEmpty {
@@ -90,9 +96,13 @@ public struct SearchField: View {
9096
"chevron.down" :
9197
"chevron.up"
9298
)
99+
#if !os(visionOS)
93100
.foregroundStyle(Color.secondary)
101+
#endif
94102
}
103+
#if !os(visionOS)
95104
.buttonStyle(.plain)
105+
#endif
96106
}
97107
}
98108
.esriBorder()

Tests/ArcGISToolkitTests/LocatorSearchSourceTests.swift

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#if !os(visionOS)
1615
import XCTest
1716
import ArcGIS
1817
import ArcGISToolkit
@@ -59,4 +58,3 @@ final class LocatorSearchSourceTests: XCTestCase {
5958
XCTAssertEqual(suggestResults.count, 2)
6059
}
6160
}
62-
#endif

Tests/ArcGISToolkitTests/SearchViewModelTests.swift

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#if !os(visionOS)
1615
import ArcGIS
1716
@testable import ArcGISToolkit
1817
@preconcurrency import Combine
@@ -481,4 +480,3 @@ private extension SearchViewModel {
481480
}
482481
}
483482
}
484-
#endif

Tests/ArcGISToolkitTests/SmartLocatorSearchSourceTests.swift

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#if !os(visionOS)
1615
import XCTest
1716
import ArcGIS
1817
import ArcGISToolkit
@@ -70,4 +69,3 @@ private extension Envelope {
7069
yRange: 7536778.456812576...7559866.706991681
7170
)
7271
}
73-
#endif

0 commit comments

Comments
 (0)