Skip to content

Commit e0df276

Browse files
committed
Move extension to Sample.
See #362 (comment)
1 parent 26f88d4 commit e0df276

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
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: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct SampleDetailView: View {
8686
.toolbar {
8787
ToolbarItemGroup(placement: .topBarTrailing) {
8888
#if targetEnvironment(macCatalyst)
89-
Link("View on GitHub", destination: .samplesDirectory.appendingPathComponent(sample.name))
89+
Link("View on GitHub", destination: sample.gitHubURL)
9090
#endif
9191
Button {
9292
isSampleInfoViewPresented = true
@@ -112,10 +112,3 @@ struct SampleDetailView: View {
112112
extension SampleDetailView: Identifiable {
113113
var id: String { sample.nameInUpperCamelCase }
114114
}
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/tree/main/Shared/Samples"
120-
)!
121-
}

0 commit comments

Comments
 (0)