Skip to content
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

[Update] Improve Sample Viewer search #228

Merged
merged 34 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fa7d112
Update sample search functionality.
CalebRas Jul 19, 2023
acf201a
Update comments.
CalebRas Jul 20, 2023
f0f6598
Add bolded query text.
CalebRas Jul 20, 2023
76dce08
Update search text.
CalebRas Jul 27, 2023
4cd0684
Update search section names.
CalebRas Jul 28, 2023
ee03f36
Update section headers.
CalebRas Jul 31, 2023
ad833a9
Apply suggestions from code review.
CalebRas Aug 2, 2023
71bcbff
Add temporary results.
CalebRas Aug 2, 2023
786ed77
Apply suggestions from code review.
CalebRas Aug 2, 2023
f292a59
Update search methods.
CalebRas Aug 2, 2023
c0802f6
Remove returns from methods.
CalebRas Aug 3, 2023
f187a74
Add newValue to onChange.
CalebRas Aug 3, 2023
cc3de81
Update bold text.
CalebRas Aug 3, 2023
fc79817
Add string extension.
CalebRas Aug 4, 2023
47626b4
Update code generation.
CalebRas Aug 4, 2023
4e849ee
Update set operations.
CalebRas Aug 4, 2023
2c05af4
Merge pull request #235 from Esri/Caleb/Fix-RemoveRelevantAPIsFromTags
CalebRas Aug 4, 2023
ba8edfa
Apply suggestions from code review.
yo1995 Aug 7, 2023
569ce4e
Address feedback from code review.
yo1995 Aug 8, 2023
2b6c5d3
Adjust newlines.
yo1995 Aug 8, 2023
528a95d
Add files to project file.
yo1995 Aug 8, 2023
fee4d34
Update content display logics.
yo1995 Aug 8, 2023
a98173f
Update comments in code generation script.
yo1995 Aug 8, 2023
4792c37
Fix the script.
yo1995 Aug 8, 2023
17ac880
Apply suggestions from code review.
yo1995 Aug 9, 2023
ab11d91
Update Shared/Supporting Files/Views/SampleRow.swift
yo1995 Aug 9, 2023
d7e652f
Update Scripts/GenerateSampleViewSourceCode.swift.
yo1995 Aug 9, 2023
b96f96b
Rename views and add `Sidebar`.
yo1995 Aug 9, 2023
9e3106c
Address feedback from code review.
yo1995 Aug 10, 2023
16224c0
Use sidebar as before.
yo1995 Aug 10, 2023
9311c82
Remove unneeded property.
yo1995 Aug 10, 2023
0dc8ff2
Reorder properties in ContentView.
yo1995 Aug 11, 2023
3f8c221
Make properties non-private.
yo1995 Aug 11, 2023
62e0b96
Merge branch 'v.next' into Caleb/Update-SampleViewerSearchBar
yo1995 Aug 11, 2023
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
33 changes: 16 additions & 17 deletions Samples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
0005580A2817C51E00224BC6 /* SampleDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 000558092817C51E00224BC6 /* SampleDetailView.swift */; };
00181B462846AD7100654571 /* View+Alert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00181B452846AD7100654571 /* View+Alert.swift */; };
001C6DE127FE8A9400D472C2 /* AppSecrets.swift.masque in Sources */ = {isa = PBXBuildFile; fileRef = 001C6DD827FE585A00D472C2 /* AppSecrets.swift.masque */; };
00273CF42A82AB5900A7A77D /* SamplesSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00273CF32A82AB5900A7A77D /* SamplesSearchView.swift */; };
00273CF62A82AB8700A7A77D /* SampleRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00273CF52A82AB8700A7A77D /* SampleRow.swift */; };
0039A4E92885C50300592C86 /* AddSceneLayerFromServiceView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = E066DD3F28610F55004D3D5B /* AddSceneLayerFromServiceView.swift */; };
0039A4EA2885C50300592C86 /* ClipGeometryView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = E000E75F2869E33D005D87C5 /* ClipGeometryView.swift */; };
0039A4EB2885C50300592C86 /* CreatePlanarAndGeodeticBuffersView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = E004A6EC2849556E002A1FE6 /* CreatePlanarAndGeodeticBuffersView.swift */; };
Expand Down Expand Up @@ -51,6 +53,7 @@
00B042E8282EDC690072E1B4 /* SetBasemapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00B042E5282EDC690072E1B4 /* SetBasemapView.swift */; };
00B04FB5283EEBA80026C882 /* DisplayOverviewMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00B04FB4283EEBA80026C882 /* DisplayOverviewMapView.swift */; };
00C43AED2947DC350099AE34 /* ArcGISToolkit in Frameworks */ = {isa = PBXBuildFile; productRef = 00C43AEC2947DC350099AE34 /* ArcGISToolkit */; };
00C7993B2A845AAF00AFE342 /* Sidebar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00C7993A2A845AAF00AFE342 /* Sidebar.swift */; };
00C94A0D28B53DE1004E42D9 /* raster-file in Resources */ = {isa = PBXBuildFile; fileRef = 00C94A0C28B53DE1004E42D9 /* raster-file */; settings = {ASSET_TAGS = (AddRasterFromFile, ); }; };
00CB9138284814A4005C2C5D /* SearchWithGeocodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00CB9137284814A4005C2C5D /* SearchWithGeocodeView.swift */; };
00CCB8A5285BAF8700BBAB70 /* OnDemandResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00CCB8A4285BAF8700BBAB70 /* OnDemandResource.swift */; };
Expand Down Expand Up @@ -132,10 +135,7 @@
88F93CC129C3D59D0006B28E /* SketchOnMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88F93CC029C3D59C0006B28E /* SketchOnMapView.swift */; };
88F93CC229C4D3480006B28E /* SketchOnMapView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 88F93CC029C3D59C0006B28E /* SketchOnMapView.swift */; };
D701D72C2A37C7F7006FF0C8 /* bradley_low_3ds in Resources */ = {isa = PBXBuildFile; fileRef = D701D72B2A37C7F7006FF0C8 /* bradley_low_3ds */; settings = {ASSET_TAGS = (ShowViewshedFromGeoelementInScene, ); }; };
D70BE5792A5624A80022CA02 /* CategoryGridView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70BE5782A5624A80022CA02 /* CategoryGridView.swift */; };
D70BE57F2A5753B70022CA02 /* SampleListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70BE57E2A5753B70022CA02 /* SampleListView.swift */; };
D70BE5832A5766CA0022CA02 /* CategoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70BE5822A5766C90022CA02 /* CategoryView.swift */; };
D70BE5882A5787530022CA02 /* CategoryView+Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70BE5872A5787530022CA02 /* CategoryView+Search.swift */; };
D70BE5792A5624A80022CA02 /* CategoriesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70BE5782A5624A80022CA02 /* CategoriesView.swift */; };
D710996D2A27D9210065A1C1 /* DensifyAndGeneralizeGeometryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D710996C2A27D9210065A1C1 /* DensifyAndGeneralizeGeometryView.swift */; };
D710996E2A27D9B30065A1C1 /* DensifyAndGeneralizeGeometryView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D710996C2A27D9210065A1C1 /* DensifyAndGeneralizeGeometryView.swift */; };
D71099702A2802FA0065A1C1 /* DensifyAndGeneralizeGeometryView.SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D710996F2A2802FA0065A1C1 /* DensifyAndGeneralizeGeometryView.SettingsView.swift */; };
Expand Down Expand Up @@ -377,6 +377,8 @@
000558092817C51E00224BC6 /* SampleDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleDetailView.swift; sourceTree = "<group>"; };
00181B452846AD7100654571 /* View+Alert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Alert.swift"; sourceTree = "<group>"; };
001C6DD827FE585A00D472C2 /* AppSecrets.swift.masque */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AppSecrets.swift.masque; sourceTree = "<group>"; };
00273CF32A82AB5900A7A77D /* SamplesSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SamplesSearchView.swift; sourceTree = "<group>"; };
00273CF52A82AB8700A7A77D /* SampleRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleRow.swift; sourceTree = "<group>"; };
003D7C342821EBCC009DDFD2 /* masquerade */ = {isa = PBXFileReference; lastKnownFileType = text; path = masquerade; sourceTree = "<group>"; };
003D7C352821EBCC009DDFD2 /* GenerateSampleViewSourceCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerateSampleViewSourceCode.swift; sourceTree = "<group>"; };
0042E24228E4BF8F001F33D6 /* ShowViewshedFromPointInSceneView.Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowViewshedFromPointInSceneView.Model.swift; sourceTree = "<group>"; };
Expand All @@ -394,6 +396,7 @@
00B04272282EC59E0072E1B4 /* AboutView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
00B042E5282EDC690072E1B4 /* SetBasemapView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetBasemapView.swift; sourceTree = "<group>"; };
00B04FB4283EEBA80026C882 /* DisplayOverviewMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayOverviewMapView.swift; sourceTree = "<group>"; };
00C7993A2A845AAF00AFE342 /* Sidebar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar.swift; sourceTree = "<group>"; };
00C94A0C28B53DE1004E42D9 /* raster-file */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "raster-file"; sourceTree = "<group>"; };
00CB9137284814A4005C2C5D /* SearchWithGeocodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchWithGeocodeView.swift; sourceTree = "<group>"; };
00CCB8A2285AAD7D00BBAB70 /* DowloadPortalItemData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DowloadPortalItemData.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -441,10 +444,7 @@
883C121429C9136600062FF9 /* DownloadPreplannedMapAreaView.MapPicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DownloadPreplannedMapAreaView.MapPicker.swift; sourceTree = "<group>"; };
88F93CC029C3D59C0006B28E /* SketchOnMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SketchOnMapView.swift; sourceTree = "<group>"; };
D701D72B2A37C7F7006FF0C8 /* bradley_low_3ds */ = {isa = PBXFileReference; lastKnownFileType = folder; path = bradley_low_3ds; sourceTree = "<group>"; };
D70BE5782A5624A80022CA02 /* CategoryGridView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryGridView.swift; sourceTree = "<group>"; };
D70BE57E2A5753B70022CA02 /* SampleListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleListView.swift; sourceTree = "<group>"; };
D70BE5822A5766C90022CA02 /* CategoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryView.swift; sourceTree = "<group>"; };
D70BE5872A5787530022CA02 /* CategoryView+Search.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CategoryView+Search.swift"; sourceTree = "<group>"; };
D70BE5782A5624A80022CA02 /* CategoriesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoriesView.swift; sourceTree = "<group>"; };
D710996C2A27D9210065A1C1 /* DensifyAndGeneralizeGeometryView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DensifyAndGeneralizeGeometryView.swift; sourceTree = "<group>"; };
D710996F2A2802FA0065A1C1 /* DensifyAndGeneralizeGeometryView.SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DensifyAndGeneralizeGeometryView.SettingsView.swift; sourceTree = "<group>"; };
D722BD212A420DAD002C2087 /* ShowExtrudedFeaturesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowExtrudedFeaturesView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -519,12 +519,13 @@
isa = PBXGroup;
children = (
00B04272282EC59E0072E1B4 /* AboutView.swift */,
D70BE5782A5624A80022CA02 /* CategoryGridView.swift */,
D70BE5822A5766C90022CA02 /* CategoryView.swift */,
D70BE5782A5624A80022CA02 /* CategoriesView.swift */,
00E5400D27F3CCA100CF66D5 /* ContentView.swift */,
000558092817C51E00224BC6 /* SampleDetailView.swift */,
E041ABD6287DB04D0056009B /* SampleInfoView.swift */,
D70BE57E2A5753B70022CA02 /* SampleListView.swift */,
00273CF52A82AB8700A7A77D /* SampleRow.swift */,
00273CF32A82AB5900A7A77D /* SamplesSearchView.swift */,
00C7993A2A845AAF00AFE342 /* Sidebar.swift */,
E041ABBF287CA9F00056009B /* WebView.swift */,
);
path = Views;
Expand All @@ -533,7 +534,6 @@
00181B442846AD3900654571 /* Extensions */ = {
isa = PBXGroup;
children = (
D70BE5872A5787530022CA02 /* CategoryView+Search.swift */,
E08953F02891899600E077CF /* EnvironmentValues+SampleInfoVisibility.swift */,
00181B452846AD7100654571 /* View+Alert.swift */,
E0082216287755AC002AD138 /* View+Sheet.swift */,
Expand Down Expand Up @@ -1561,7 +1561,6 @@
79B7B80A2A1BF8EC00F57C27 /* CreateAndSaveKMLView.swift in Sources */,
7573E81C29D6134C00BEED9C /* TraceUtilityNetworkView.Enums.swift in Sources */,
7573E81A29D6134C00BEED9C /* TraceUtilityNetworkView.Model.swift in Sources */,
0005580C28185C0600224BC6 /* SampleList.swift in Sources */,
1C3B7DC82A5F64FC00907443 /* AnalyzeNetworkWithSubnetworkTraceView.Model.swift in Sources */,
D752D9402A39154C003EB25E /* ManageOperationalLayersView.swift in Sources */,
D7ABA2F92A32579C0021822B /* MeasureDistanceInSceneView.swift in Sources */,
Expand All @@ -1578,11 +1577,10 @@
D752D9462A3A6F80003EB25E /* MonitorChangesToMapLoadStatusView.swift in Sources */,
E0082217287755AC002AD138 /* View+Sheet.swift in Sources */,
00181B462846AD7100654571 /* View+Alert.swift in Sources */,
00273CF62A82AB8700A7A77D /* SampleRow.swift in Sources */,
D7ABA2FF2A32881C0021822B /* ShowViewshedFromGeoelementInSceneView.swift in Sources */,
E0FE32E728747778002C6ACA /* BrowseBuildingFloorsView.swift in Sources */,
D70BE5882A5787530022CA02 /* CategoryView+Search.swift in Sources */,
D752D95F2A3BCE06003EB25E /* DisplayMapFromPortalItemView.swift in Sources */,
D70BE5832A5766CA0022CA02 /* CategoryView.swift in Sources */,
1CAB8D4B2A3CEAB0002AA649 /* RunValveIsolationTraceView.Model.swift in Sources */,
E070A0A3286F3B6000F2B606 /* DownloadPreplannedMapAreaView.swift in Sources */,
D77570C02A2942F800F490CD /* AnimateImagesWithImageOverlayView.swift in Sources */,
Expand Down Expand Up @@ -1611,6 +1609,7 @@
E041ABC0287CA9F00056009B /* WebView.swift in Sources */,
E088E1572862579D00413100 /* SetSurfacePlacementModeView.swift in Sources */,
1CAF831F2A20305F000E1E60 /* ShowUtilityAssociationsView.swift in Sources */,
00C7993B2A845AAF00AFE342 /* Sidebar.swift in Sources */,
E004A6C128414332002A1FE6 /* SetViewpointRotationView.swift in Sources */,
883C121529C9136600062FF9 /* DownloadPreplannedMapAreaView.MapPicker.swift in Sources */,
1C9B74C929DB43580038B06F /* ShowRealisticLightAndShadowsView.swift in Sources */,
Expand All @@ -1620,7 +1619,7 @@
108EC04129D25B2C000F35D0 /* QueryFeatureTableView.swift in Sources */,
00B04FB5283EEBA80026C882 /* DisplayOverviewMapView.swift in Sources */,
D7CC33FF2A31475C00198EDF /* ShowLineOfSightBetweenPointsView.swift in Sources */,
D70BE5792A5624A80022CA02 /* CategoryGridView.swift in Sources */,
D70BE5792A5624A80022CA02 /* CategoriesView.swift in Sources */,
4D2ADC5D29C4F612003B367F /* ChangeMapViewBackgroundView.SettingsView.swift in Sources */,
75DD739529D38B1B0010229D /* NavigateRouteView.swift in Sources */,
D75362D22A1E886700D83028 /* ApplyUniqueValueRendererView.swift in Sources */,
Expand All @@ -1644,7 +1643,6 @@
00B042E8282EDC690072E1B4 /* SetBasemapView.swift in Sources */,
E004A6E62846A61F002A1FE6 /* StyleGraphicsWithSymbolsView.swift in Sources */,
E088E1742863B5F800413100 /* GenerateOfflineMapView.swift in Sources */,
D70BE57F2A5753B70022CA02 /* SampleListView.swift in Sources */,
0074ABC428174F430037244A /* Sample.swift in Sources */,
00A7A14A2A2FC5B700F035F7 /* DisplayContentOfUtilityNetworkContainerView.Model.swift in Sources */,
E004A6F0284E4B9B002A1FE6 /* DownloadVectorTilesToLocalCacheView.swift in Sources */,
Expand All @@ -1654,6 +1652,7 @@
1C19B4F52A578E46001D2506 /* CreateLoadReportView.Model.swift in Sources */,
0042E24528E4F82C001F33D6 /* ShowViewshedFromPointInSceneView.ViewshedSettingsView.swift in Sources */,
1C9B74D929DB54560038B06F /* ChangeCameraControllerView.swift in Sources */,
00273CF42A82AB5900A7A77D /* SamplesSearchView.swift in Sources */,
D78666AD2A2161F100C60110 /* FindNearestVertexView.swift in Sources */,
D744FD172A2112D90084A66C /* CreateConvexHullAroundPointsView.swift in Sources */,
00CB9138284814A4005C2C5D /* SearchWithGeocodeView.swift in Sources */,
Expand Down
14 changes: 13 additions & 1 deletion Scripts/GenerateSampleViewSourceCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ private struct SampleMetadata: Decodable {
let offlineData: [String]?
/// The tags and relevant APIs of the sample.
let keywords: [String]
/// The relevant APIs of the sample.
let relevantApis: [String]
}

extension SampleMetadata {
Expand All @@ -57,6 +59,16 @@ extension SampleMetadata {
// E.g., DisplayMapView -> DisplayMap
viewName.dropLast(4)
}

/// The tags of a sample.
/// - Note: See common-samples/wiki/README.metadata.json#keywords.
/// The keywords in the sample metadata combines Tags and Relevant APIs
/// from the README. This is done in Scripts/CI/common.py by appending the
/// relevant APIs to the tags. Therefore, dropping the relevant APIs will
/// give the tags.
var tags: Array<String>.SubSequence {
keywords.dropLast(relevantApis.count)
}
}

// MARK: Script Entry
Expand Down Expand Up @@ -116,7 +128,7 @@ private let sampleStructs = sampleMetadata
var category: String { \"\(sample.category)\" }
var description: String { \"\(sample.description)\" }
var snippets: [String] { \(sample.snippets) }
var tags: Set<String> { \(sample.keywords) }
var tags: Set<String> { \(sample.tags) }
\(portalItemIDs.isEmpty ? "" : "var hasDependencies: Bool { true }\n")
func makeBody() -> AnyView { .init(\(sample.viewName)()) }
}
Expand Down
27 changes: 0 additions & 27 deletions Shared/Supporting Files/Extensions/CategoryView+Search.swift

This file was deleted.

2 changes: 1 addition & 1 deletion Shared/Supporting Files/Models/Sample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protocol Sample {
/// The relative paths to the code snippets.
var snippets: [String] { get }

/// The tags and relevant APIs of the sample.
/// The tags of the sample.
var tags: Set<String> { get }

/// A Boolean value that indicates whether a sample has offline data dependencies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import SwiftUI

struct CategoryGridView: View {
struct CategoriesView: View {
/// All samples that will be shown in the categories.
private let samples: [Sample]

Expand All @@ -38,7 +38,7 @@ struct CategoryGridView: View {
LazyVGrid(columns: columns) {
ForEach(categories, id: \.self) { category in
NavigationLink {
SampleListView(samples: samples.filter { $0.category == category })
CategoryList(samples: samples.filter { $0.category == category })
.navigationTitle(category)
} label: {
CategoryTitleView(category: category)
Expand All @@ -49,12 +49,29 @@ struct CategoryGridView: View {
.buttonStyle(.plain)
}
}
.padding(8)
.padding()
}
}
}

private extension CategoryGridView {
private extension CategoriesView {
struct CategoryList: View {
/// The samples in a category.
let samples: [Sample]

var body: some View {
List(samples, id: \.name) { sample in
NavigationLink {
SampleDetailView(sample: sample)
.id(sample.name)
} label: {
SampleRow(sample: sample, query: "")
yo1995 marked this conversation as resolved.
Show resolved Hide resolved
}
}
.listStyle(.sidebar)
}
}

struct CategoryTitleView: View {
/// The category name used to load the images from assets.
let category: String
Expand Down
10 changes: 5 additions & 5 deletions Shared/Supporting Files/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
import SwiftUI

struct ContentView: View {
/// All samples retrieved from the Samples directory.
let samples: [Sample]

/// The search query in the search bar.
@State private var query = ""

/// All samples retrieved from the Samples directory.
let samples: [Sample]

yo1995 marked this conversation as resolved.
Show resolved Hide resolved
var body: some View {
if #available(iOS 16, *) {
NavigationSplitView {
Expand All @@ -39,8 +39,8 @@ struct ContentView: View {
}

var sidebar: some View {
CategoryView(samples: samples, query: $query)
.searchable(text: $query, prompt: "Search By Sample Name")
Sidebar(samples: samples, query: query)
.searchable(text: $query)
}

var detail: some View {
Expand Down
Loading
Loading