Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added workaround for mac catalyst & supported mac catalyst. #50

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

/* Begin PBXFileReference section */
188460622C37EDE2005C370A /* LicenseList */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = LicenseList; path = ..; sourceTree = "<group>"; };
188707F02CF5882D00E5A6CF /* ExamplesForSwiftUI.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ExamplesForSwiftUI.entitlements; sourceTree = "<group>"; };
18FCC4412C37E4550052500D /* ExamplesForSwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ExamplesForSwiftUI.app; sourceTree = BUILT_PRODUCTS_DIR; };
18FCC4432C37E4550052500D /* ExamplesForSwiftUIApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExamplesForSwiftUIApp.swift; sourceTree = "<group>"; };
18FCC4452C37E4550052500D /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -81,6 +82,7 @@
18FCC4422C37E4550052500D /* ExamplesForSwiftUI */ = {
isa = PBXGroup;
children = (
188707F02CF5882D00E5A6CF /* ExamplesForSwiftUI.entitlements */,
18FCC4432C37E4550052500D /* ExamplesForSwiftUIApp.swift */,
18FCC4452C37E4550052500D /* ContentView.swift */,
18FCC4472C37E4560052500D /* Assets.xcassets */,
Expand Down Expand Up @@ -394,10 +396,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = ExamplesForSwiftUI/ExamplesForSwiftUI.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"ExamplesForSwiftUI/Preview Content\"";
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = VHY32ZU4KA;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand All @@ -413,12 +416,12 @@
PRODUCT_BUNDLE_IDENTIFIER = com.cybozu.swiftui.examples;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,3";
TARGETED_DEVICE_FAMILY = "1,2,3";
};
name = Debug;
};
Expand All @@ -427,10 +430,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = ExamplesForSwiftUI/ExamplesForSwiftUI.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"ExamplesForSwiftUI/Preview Content\"";
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = VHY32ZU4KA;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand All @@ -446,12 +450,12 @@
PRODUCT_BUNDLE_IDENTIFIER = com.cybozu.swiftui.examples;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,3";
TARGETED_DEVICE_FAMILY = "1,2,3";
};
name = Release;
};
Expand Down
10 changes: 10 additions & 0 deletions Examples/ExamplesForSwiftUI/ExamplesForSwiftUI.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ let package = Package(
name: "LicenseList",
platforms: [
.iOS(.v15),
.macCatalyst(.v15),
.tvOS(.v17),
],
products: [
Expand Down
13 changes: 11 additions & 2 deletions Plugins/PrepareLicenseList/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,19 @@ struct PrepareLicenseList: BuildToolPlugin {

// This command works with the plugin specified in `Package.swift`.
func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
let sourcePackagesPath = try sourcePackages(context.pluginWorkDirectory)
// Workaround for Mac Catalyst
let debugMacCatalystPath = sourcePackagesPath.removingLastComponent()
.appending(["Build", "Products", "Debug-maccatalyst"])
let executablePath: Path = if FileManager.default.fileExists(atPath: debugMacCatalystPath.string) {
debugMacCatalystPath.appending(["spp"])
} else {
try context.tool(named: "spp").path
}
return [
makeBuildCommand(
executablePath: try context.tool(named: "spp").path,
sourcePackagesPath: try sourcePackages(context.pluginWorkDirectory),
executablePath: executablePath,
sourcePackagesPath: sourcePackagesPath,
outputPath: context.pluginWorkDirectory
)
]
Expand Down