Skip to content

Commit 7ab2654

Browse files
authored
Merge pull request #93 from Esri/Ting/Add-MacCatalyst
[Update] Add Mac Catalyst support
2 parents 189b69e + a1f1954 commit 7ab2654

File tree

9 files changed

+49
-19
lines changed

9 files changed

+49
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The *ArcGIS Maps SDK for Swift Samples app* has a *Target SDK* version of *15.0*
1515
1. **Fork** and then **clone** the repository
1616
1. **Configure** the Swift API locally following the instructions in internal Swift API repo, section `Adding the ArcGIS library to your App`
1717
1. **Open** the `Samples.xcodeproj` **project** file
18-
1. **Run** the `Samples (iOS)` app target
18+
1. **Run** the `Samples` app target
1919

2020
## Configuring API Keys
2121

Samples.entitlements

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.network.client</key>
8+
<true/>
9+
<key>com.apple.security.personal-information.location</key>
10+
<true/>
11+
</dict>
12+
</plist>

Samples.xcodeproj/project.pbxproj

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
0042E24728E50EE4001F33D6 /* ShowViewshedFromPointInSceneView.Model.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 0042E24228E4BF8F001F33D6 /* ShowViewshedFromPointInSceneView.Model.swift */; };
3737
0042E24828E50EE4001F33D6 /* ShowViewshedFromPointInSceneView.ViewshedSettingsView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 0042E24428E4F82B001F33D6 /* ShowViewshedFromPointInSceneView.ViewshedSettingsView.swift */; };
3838
0067F5AA29242F4600215F5D /* ArcGISToolkit in Frameworks */ = {isa = PBXBuildFile; productRef = 0067F5A929242F4600215F5D /* ArcGISToolkit */; };
39-
0067F5AB29242F7600215F5D /* arcgis-maps-sdk-swift-toolkit in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0067F5A729242F1E00215F5D /* arcgis-maps-sdk-swift-toolkit */; };
4039
006C835528B40682004AEB7F /* BrowseBuildingFloorsView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = E0FE32E628747778002C6ACA /* BrowseBuildingFloorsView.swift */; };
4140
006C835628B40682004AEB7F /* DisplayMapFromMobileMapPackageView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = F111CCC0288B5D5600205358 /* DisplayMapFromMobileMapPackageView.swift */; };
4241
0074ABBF28174BCF0037244A /* DisplayMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0074ABBE28174BCF0037244A /* DisplayMapView.swift */; };
@@ -134,7 +133,6 @@
134133
dstPath = "";
135134
dstSubfolderSpec = 10;
136135
files = (
137-
0067F5AB29242F7600215F5D /* arcgis-maps-sdk-swift-toolkit in Embed Frameworks */,
138136
);
139137
name = "Embed Frameworks";
140138
runOnlyForDeploymentPostprocessing = 0;
@@ -194,6 +192,7 @@
194192
0074ABC128174F430037244A /* Sample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sample.swift; sourceTree = "<group>"; };
195193
0074ABCA2817B8DB0037244A /* SamplesApp+Samples.swift.tache */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "SamplesApp+Samples.swift.tache"; sourceTree = "<group>"; };
196194
0086F3FD28E3770900974721 /* ShowViewshedFromPointInSceneView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowViewshedFromPointInSceneView.swift; sourceTree = "<group>"; };
195+
00ACF554293E6C6A0059B2A9 /* Samples.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Samples.entitlements; sourceTree = "<group>"; };
197196
00B04272282EC59E0072E1B4 /* AboutView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
198197
00B042E5282EDC690072E1B4 /* SetBasemapView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetBasemapView.swift; sourceTree = "<group>"; };
199198
00B04FB4283EEBA80026C882 /* DisplayOverviewMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayOverviewMapView.swift; sourceTree = "<group>"; };
@@ -451,6 +450,7 @@
451450
00E5401427F3CCA200CF66D5 /* Products */,
452451
003D7C332821EBCC009DDFD2 /* Scripts */,
453452
00E5400B27F3CCA100CF66D5 /* Shared */,
453+
00ACF554293E6C6A0059B2A9 /* Samples.entitlements */,
454454
);
455455
sourceTree = "<group>";
456456
};
@@ -664,17 +664,17 @@
664664
/* End PBXGroup section */
665665

666666
/* Begin PBXNativeTarget section */
667-
00E5401227F3CCA200CF66D5 /* Samples (iOS) */ = {
667+
00E5401227F3CCA200CF66D5 /* Samples */ = {
668668
isa = PBXNativeTarget;
669-
buildConfigurationList = 00E5402427F3CCA200CF66D5 /* Build configuration list for PBXNativeTarget "Samples (iOS)" */;
669+
buildConfigurationList = 00E5402427F3CCA200CF66D5 /* Build configuration list for PBXNativeTarget "Samples" */;
670670
buildPhases = (
671671
001C6DDC27FE5CE800D472C2 /* Create .secrets File If It Does Not Exist */,
672672
00CCB8A3285BA2FD00BBAB70 /* Download Portal Item Data */,
673673
00E5402B27F77A5A00CF66D5 /* Lint Sources */,
674674
00E5400F27F3CCA200CF66D5 /* Sources */,
675+
00144B5E280634840090DD5D /* Embed Frameworks */,
675676
00E5401027F3CCA200CF66D5 /* Frameworks */,
676677
00E5401127F3CCA200CF66D5 /* Resources */,
677-
00144B5E280634840090DD5D /* Embed Frameworks */,
678678
0039A4E82885C4E300592C86 /* Copy Source Code Files */,
679679
0039A4E72885C45200592C86 /* Copy README.md Files For Source Code View */,
680680
);
@@ -684,7 +684,7 @@
684684
);
685685
dependencies = (
686686
);
687-
name = "Samples (iOS)";
687+
name = Samples;
688688
packageProductDependencies = (
689689
0067F5A929242F4600215F5D /* ArcGISToolkit */,
690690
);
@@ -726,7 +726,7 @@
726726
projectDirPath = "";
727727
projectRoot = "";
728728
targets = (
729-
00E5401227F3CCA200CF66D5 /* Samples (iOS) */,
729+
00E5401227F3CCA200CF66D5 /* Samples */,
730730
);
731731
};
732732
/* End PBXProject section */
@@ -788,7 +788,7 @@
788788
);
789789
runOnlyForDeploymentPostprocessing = 0;
790790
shellPath = /bin/sh;
791-
shellScript = "echo $BUILT_PRODUCTS_DIR\n\n# Directory to which the readmes will be copied.\nREADMES_DIR=${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/READMEs\nmkdir -p \"${READMES_DIR}\"\n\n# Root readme for the project to skip.\nDEFAULT_README=$SRCROOT/README.md\n\n# Find all README.md files in the project.\nfind ${SRCROOT} -name \"README.md\" | while read file\ndo\n # Skip the root readme for project.\n if [ \"$file\" = \"$DEFAULT_README\" ]\n then\n echo $BUILT_PRODUCTS_DIR\n continue\n fi\n \n # Extract the folder name from the path.\n FILE_PATH=$(dirname \"$file\")\n FOLDER_NAME=$(basename \"$FILE_PATH\")\n \n cp \"${file}\" \"${READMES_DIR}/${FOLDER_NAME}.md\"\ndone\n";
791+
shellScript = "echo $BUILT_PRODUCTS_DIR\n\n# Directory to which the readmes will be copied.\nREADMES_DIR=${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/READMEs\nmkdir -p \"${READMES_DIR}\"\n\n# Root readme for the project to skip.\nDEFAULT_README=$SRCROOT/README.md\n\n# Find all README.md files in the project.\nfind ${SRCROOT} -name \"README.md\" | while read file\ndo\n # Skip the root readme for project.\n if [ \"$file\" = \"$DEFAULT_README\" ]\n then\n echo $BUILT_PRODUCTS_DIR\n continue\n fi\n \n # Extract the folder name from the path.\n FILE_PATH=$(dirname \"$file\")\n FOLDER_NAME=$(basename \"$FILE_PATH\")\n \n cp \"${file}\" \"${READMES_DIR}/${FOLDER_NAME}.md\"\ndone\n";
792792
};
793793
00CCB8A3285BA2FD00BBAB70 /* Download Portal Item Data */ = {
794794
isa = PBXShellScriptBuildPhase;
@@ -1000,11 +1000,14 @@
10001000
buildSettings = {
10011001
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
10021002
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
1003+
CODE_SIGN_ENTITLEMENTS = Samples.entitlements;
1004+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
10031005
CODE_SIGN_STYLE = Automatic;
10041006
CURRENT_PROJECT_VERSION = 1;
10051007
EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES;
10061008
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist";
10071009
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
1010+
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 15.0;
10081011
LD_RUNPATH_SEARCH_PATHS = (
10091012
"$(inherited)",
10101013
"@executable_path/Frameworks",
@@ -1013,6 +1016,9 @@
10131016
PRODUCT_BUNDLE_IDENTIFIER = "com.esri.arcgis-swift-sdk-samples";
10141017
PRODUCT_NAME = Samples;
10151018
SDKROOT = iphoneos;
1019+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
1020+
SUPPORTS_MACCATALYST = YES;
1021+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
10161022
SWIFT_EMIT_LOC_STRINGS = YES;
10171023
SWIFT_VERSION = 5.0;
10181024
TARGETED_DEVICE_FAMILY = "1,2";
@@ -1024,11 +1030,14 @@
10241030
buildSettings = {
10251031
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
10261032
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
1033+
CODE_SIGN_ENTITLEMENTS = Samples.entitlements;
1034+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
10271035
CODE_SIGN_STYLE = Automatic;
10281036
CURRENT_PROJECT_VERSION = 1;
10291037
EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES;
10301038
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist";
10311039
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
1040+
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 15.0;
10321041
LD_RUNPATH_SEARCH_PATHS = (
10331042
"$(inherited)",
10341043
"@executable_path/Frameworks",
@@ -1037,6 +1046,9 @@
10371046
PRODUCT_BUNDLE_IDENTIFIER = "com.esri.arcgis-swift-sdk-samples";
10381047
PRODUCT_NAME = Samples;
10391048
SDKROOT = iphoneos;
1049+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
1050+
SUPPORTS_MACCATALYST = YES;
1051+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
10401052
SWIFT_EMIT_LOC_STRINGS = YES;
10411053
SWIFT_VERSION = 5.0;
10421054
TARGETED_DEVICE_FAMILY = "1,2";
@@ -1056,7 +1068,7 @@
10561068
defaultConfigurationIsVisible = 0;
10571069
defaultConfigurationName = Release;
10581070
};
1059-
00E5402427F3CCA200CF66D5 /* Build configuration list for PBXNativeTarget "Samples (iOS)" */ = {
1071+
00E5402427F3CCA200CF66D5 /* Build configuration list for PBXNativeTarget "Samples" */ = {
10601072
isa = XCConfigurationList;
10611073
buildConfigurations = (
10621074
00E5402527F3CCA200CF66D5 /* Debug */,

Samples.xcodeproj/xcshareddata/xcschemes/Samples (iOS).xcscheme renamed to Samples.xcodeproj/xcshareddata/xcschemes/Samples.xcscheme

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
BuildableIdentifier = "primary"
1717
BlueprintIdentifier = "00E5401227F3CCA200CF66D5"
1818
BuildableName = "Samples.app"
19-
BlueprintName = "Samples (iOS)"
19+
BlueprintName = "Samples"
2020
ReferencedContainer = "container:Samples.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
@@ -46,7 +46,7 @@
4646
BuildableIdentifier = "primary"
4747
BlueprintIdentifier = "00E5401227F3CCA200CF66D5"
4848
BuildableName = "Samples.app"
49-
BlueprintName = "Samples (iOS)"
49+
BlueprintName = "Samples"
5050
ReferencedContainer = "container:Samples.xcodeproj">
5151
</BuildableReference>
5252
</BuildableProductRunnable>
@@ -63,7 +63,7 @@
6363
BuildableIdentifier = "primary"
6464
BlueprintIdentifier = "00E5401227F3CCA200CF66D5"
6565
BuildableName = "Samples.app"
66-
BlueprintName = "Samples (iOS)"
66+
BlueprintName = "Samples"
6767
ReferencedContainer = "container:Samples.xcodeproj">
6868
</BuildableReference>
6969
</BuildableProductRunnable>

Shared/Samples/Cut geometry/CutGeometryView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct CutGeometryView: View {
8585

8686
private extension Geometry {
8787
/// A polygon representing the area of Lake Superior.
88-
static var lakeSuperiorPolygon: Polygon {
88+
static var lakeSuperiorPolygon: ArcGIS.Polygon {
8989
Polygon(
9090
points: [
9191
Point(x: -10254374.668616, y: 5908345.076380),

Shared/Samples/Display overview map/DisplayOverviewMapView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct DisplayOverviewMapView: View {
2727
)
2828

2929
/// The visible area marked with a red rectangle on the overview map.
30-
@State private var visibleArea: Polygon?
30+
@State private var visibleArea: ArcGIS.Polygon?
3131

3232
/// Creates a map.
3333
private static func makeMap() -> Map {

Shared/Samples/Show result of spatial relationships/ShowResultOfSpatialRelationshipsView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct ShowResultOfSpatialRelationshipsView: View {
8787
Relationship(between: polylineGeometry, and: pointGeometry),
8888
Relationship(between: polylineGeometry, and: polygonGeometry)
8989
]
90-
case is Polygon:
90+
case is ArcGIS.Polygon:
9191
return [
9292
Relationship(between: polygonGeometry, and: pointGeometry),
9393
Relationship(between: polygonGeometry, and: polylineGeometry)
@@ -222,7 +222,7 @@ private extension Geometry {
222222
switch self {
223223
case is Point: return "Point"
224224
case is Polyline: return "Polyline"
225-
case is Polygon: return "Polygon"
225+
case is ArcGIS.Polygon: return "Polygon"
226226
default: return "Unknown"
227227
}
228228
}

Shared/Samples/Style graphics with renderer/StyleGraphicsWithRendererView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private extension StyleGraphicsWithRendererView {
142142
/// - center: The center of the square that contains the heart shape.
143143
/// - sideLength: The side length of the square.
144144
/// - Returns: A heart-shaped polygon.
145-
static func makeHeartPolygon(center: Point, sideLength: Double) -> Polygon? {
145+
static func makeHeartPolygon(center: Point, sideLength: Double) -> ArcGIS.Polygon? {
146146
guard sideLength > 0 else { return nil }
147147
let spatialReference = center.spatialReference
148148
// Defines the x and y coordinates to simplify the calculation.

Shared/SamplesApp.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ struct SamplesApp: App {
2323

2424
var body: some SwiftUI.Scene {
2525
WindowGroup {
26-
ContentView(samples: Self.samples)
26+
ContentView(
27+
samples: Self.samples
28+
#if targetEnvironment(macCatalyst)
29+
// On-demand resources aren't available on Mac Catalyst yet.
30+
.filter { !$0.hasDependencies }
31+
#endif
32+
)
2733
}
2834
}
2935
}

0 commit comments

Comments
 (0)