Skip to content

Commit 8bb33aa

Browse files
committed
Add Mac Catalyst platform condition to open GitHub repo.
1 parent ee350cd commit 8bb33aa

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Shared/Supporting Files/Views/SampleDetailView.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ struct SampleDetailView: View {
8484
.navigationTitle(sample.name)
8585
.navigationBarTitleDisplayMode(.inline)
8686
.toolbar {
87-
ToolbarItem(placement: .topBarTrailing) {
87+
ToolbarItemGroup(placement: .topBarTrailing) {
88+
#if targetEnvironment(macCatalyst)
89+
Link("View on GitHub", destination: .samplesDirectory.appendingPathComponent(sample.name))
90+
#endif
8891
Button {
8992
isSampleInfoViewPresented = true
9093
} label: {
@@ -109,3 +112,10 @@ struct SampleDetailView: View {
109112
extension SampleDetailView: Identifiable {
110113
var id: String { sample.nameInUpperCamelCase }
111114
}
115+
116+
private extension URL {
117+
/// The URL to the Samples sub-directory on GitHub's main branch.
118+
static let samplesDirectory = URL(
119+
string: "https://github.com/Esri/arcgis-maps-sdk-swift-samples"
120+
)!.appendingPathComponent("tree/main/Shared/Samples")
121+
}

0 commit comments

Comments
 (0)