Skip to content

Commit 9e041ab

Browse files
authored
Merge pull request #362 from Esri/Ting/Setup-GitHubButtonMore
[Setup] Add link to open GitHub repo
2 parents f7c2fb7 + e0df276 commit 9e041ab

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Shared/Supporting Files/Models/Sample.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ protocol Sample {
4141
// MARK: Computed Variables
4242

4343
extension Sample {
44+
/// The URL to a sample's sub-directory on GitHub main branch.
45+
var gitHubURL: URL {
46+
URL(string: "https://github.com/Esri/arcgis-maps-sdk-swift-samples/tree/main/Shared/Samples")!
47+
.appendingPathComponent(name)
48+
}
49+
4450
/// The URL to a sample's `README.md` file.
4551
var readmeURL: URL {
4652
Bundle.main.url(forResource: name, withExtension: "md", subdirectory: "READMEs")!

Shared/Supporting Files/Views/SampleDetailView.swift

Lines changed: 4 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: sample.gitHubURL)
90+
#endif
8891
Button {
8992
isSampleInfoViewPresented = true
9093
} label: {

0 commit comments

Comments
 (0)