Skip to content

Commit

Permalink
Merge pull request #249 from Esri/v.next
Browse files Browse the repository at this point in the history
[Release] 200.2.0
  • Loading branch information
yo1995 committed Aug 16, 2023
2 parents b9d5c70 + ba21cd6 commit 82f4479
Show file tree
Hide file tree
Showing 269 changed files with 10,601 additions and 238 deletions.
3 changes: 2 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ disabled_rules:

# Some rules are only opt-in
opt_in_rules:
- anyobject_protocol
- array_init
- attributes
- closure_end_indentation
Expand Down Expand Up @@ -74,6 +73,8 @@ opt_in_rules:
- vertical_whitespace_opening_braces
- yoda_condition

attributes:
attributes_with_arguments_always_on_line_above: false
identifier_name:
min_length:
# Do not flag short identifiers
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ This repository contains Swift sample code demonstrating the capabilities of [Ar

## Requirements

* [ArcGIS Maps SDK for Swift](https://developers.arcgis.com/swift/) 200.1 (or newer)
* [ArcGIS Maps SDK for Swift Toolkit](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit) 200.1 (or newer)
* [ArcGIS Maps SDK for Swift](https://developers.arcgis.com/swift/) 200.2 (or newer)
* [ArcGIS Maps SDK for Swift Toolkit](https://github.com/Esri/arcgis-maps-sdk-swift-toolkit) 200.2 (or newer)
* Xcode 14.1 (or newer)

The *ArcGIS Maps SDK for Swift Samples app* has a *Target SDK* version of *15.0*, meaning that it can run on devices with *iOS 15.0* or newer.
Expand Down
562 changes: 543 additions & 19 deletions Samples.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

48 changes: 37 additions & 11 deletions Scripts/GenerateSampleViewSourceCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import Foundation
private struct SampleMetadata: Decodable {
/// The title of the sample.
let title: String
/// The category of the sample.
let category: String
/// The description of the sample.
let description: String
/// The relative paths to the code snippets.
Expand All @@ -39,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 @@ -55,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 All @@ -71,24 +85,35 @@ let templateURL = URL(fileURLWithPath: arguments[2], isDirectory: false)
let outputFileURL = URL(fileURLWithPath: arguments[3], isDirectory: false)

private let sampleMetadata: [SampleMetadata] = {
let decoder = JSONDecoder()
// Converts snake-case key "offline_data" to camel-case "offlineData".
decoder.keyDecodingStrategy = .convertFromSnakeCase

let fileManager = FileManager.default
do {
// Finds all subdirectories under the root samples directory.
let decoder = JSONDecoder()
// Converts snake-case key "offline_data" to camel-case "offlineData".
decoder.keyDecodingStrategy = .convertFromSnakeCase
// Does a shallow traverse of the top level of samples directory.
return try FileManager.default.contentsOfDirectory(at: samplesDirectoryURL, includingPropertiesForKeys: nil, options: [.skipsHiddenFiles])
return try fileManager.contentsOfDirectory(at: samplesDirectoryURL, includingPropertiesForKeys: nil, options: [.skipsHiddenFiles])
.filter(\.hasDirectoryPath)
.compactMap { url in
// Try to access the metadata file under a subdirectory.
guard let data = try? Data(contentsOf: url.appendingPathComponent("README.metadata.json")) else {
// Gets the metadata JSON under each subdirectory.
let metadataFile = url.appendingPathComponent("README.metadata.json")
guard fileManager.fileExists(atPath: metadataFile.path) else {
// Sometimes when Git switches branches, it leaves an empty directory
// that causes the decoder to throw an error. Here we skip the directories
// that don't have the metadata JSON file.
return nil
}
return try? decoder.decode(SampleMetadata.self, from: data)
do {
let data = try Data(contentsOf: metadataFile)
return try decoder.decode(SampleMetadata.self, from: data)
} catch {
print("error: '\(url.lastPathComponent)' sample couldn’t be decoded.")
exit(1)
}
}
.sorted { $0.title < $1.title }
} catch {
print("Error decoding Samples: \(error.localizedDescription)")
print("error: Decoding Samples: \(error.localizedDescription)")
exit(1)
}
}()
Expand All @@ -100,9 +125,10 @@ private let sampleStructs = sampleMetadata
return """
struct \(sample.structName): Sample {
var name: String { \"\(sample.title)\" }
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 All @@ -127,6 +153,6 @@ do {
.replacingOccurrences(of: "/* structs */", with: sampleStructs)
try content.write(to: outputFileURL, atomically: true, encoding: .utf8)
} catch {
print("Error reading or writing template file: \(error.localizedDescription)")
print("error: Reading or writing template file: \(error.localizedDescription)")
exit(1)
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Analysis-bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Analysis-bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Analysis-icon@1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Analysis-icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Analysis-icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Augmented-Reality-bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Augmented-Reality-bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Augmented-Reality-icon@1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Augmented-Reality-icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Augmented-Reality-icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Cloud-and-Portal-bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Cloud-and-Portal-bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Cloud-and-Portal-icon@1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Cloud-and-Portal-icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Cloud-and-Portal-icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Shared/Assets.xcassets/Categories/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Edit-and-Manage-Data-bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Edit-and-Manage-Data-bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Edit-and-Manage-Data-icon@1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Edit-and-Manage-Data-icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Edit-and-Manage-Data-icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Shared/Assets.xcassets/Categories/Layers-bg.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Layers-bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Layers-bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Layers-icon@1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Layers-icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Layers-icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Shared/Assets.xcassets/Categories/Maps-bg.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Maps-bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Maps-bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

0 comments on commit 82f4479

Please sign in to comment.