From 783d3512e7e32aff2399d5bfad3012b0e7db14e7 Mon Sep 17 00:00:00 2001 From: banjun Date: Mon, 30 Oct 2023 14:38:39 +0900 Subject: [PATCH 1/2] add support for visionos --- .../SwiftHotReloadExample.xcodeproj/project.pbxproj | 10 ++++++---- .../SwiftHotReload.xcodeproj/project.pbxproj | 10 ++++++---- Sources/Env.swift | 10 +++++++--- SwiftHotReload.podspec | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Example/SwiftHotReloadExample.xcodeproj/project.pbxproj b/Example/SwiftHotReloadExample.xcodeproj/project.pbxproj index c5fbc62..3b4a045 100644 --- a/Example/SwiftHotReloadExample.xcodeproj/project.pbxproj +++ b/Example/SwiftHotReloadExample.xcodeproj/project.pbxproj @@ -317,10 +317,11 @@ PRODUCT_BUNDLE_IDENTIFIER = jp.banjun.SwiftHotReloadExample; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; }; name = Debug; }; @@ -354,10 +355,11 @@ PRODUCT_BUNDLE_IDENTIFIER = jp.banjun.SwiftHotReloadExample; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; }; name = Release; }; diff --git a/FrameworkTarget/SwiftHotReload.xcodeproj/project.pbxproj b/FrameworkTarget/SwiftHotReload.xcodeproj/project.pbxproj index c4b5eb7..59cf025 100644 --- a/FrameworkTarget/SwiftHotReload.xcodeproj/project.pbxproj +++ b/FrameworkTarget/SwiftHotReload.xcodeproj/project.pbxproj @@ -311,11 +311,12 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = auto; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; }; name = Debug; }; @@ -350,10 +351,11 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = auto; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; }; name = Release; }; diff --git a/Sources/Env.swift b/Sources/Env.swift index c34628c..9bec662 100644 --- a/Sources/Env.swift +++ b/Sources/Env.swift @@ -79,9 +79,13 @@ public struct Env { /// arm64-apple-ios14.0-simulator /// arm64-apple-macos13.0 public var estimatedTargetTriple: String? { - guard let os = (DTPlatformName?.contains("iphone") == true ? "ios" - : DTPlatformName?.contains("macosx") == true ? "macos" - : nil) else { return nil } + #if os(iOS) + let os = "ios" + #elseif os(macOS) + let os = "macos" + #elseif os(visionOS) + let os = "xros" + #endif let isSimulator = DTPlatformName?.contains("simulator") == true return [estimatedArch, "apple", os + estimatedDeploymentOSVersion!, isSimulator ? "simulator" : nil] .compactMap { $0 }.joined(separator: "-") diff --git a/SwiftHotReload.podspec b/SwiftHotReload.podspec index fc86ee4..93912b3 100644 --- a/SwiftHotReload.podspec +++ b/SwiftHotReload.podspec @@ -12,7 +12,7 @@ Pod::Spec.new do |spec| spec.osx.deployment_target = "11.0" # spec.watchos.deployment_target = "2.0" # spec.tvos.deployment_target = "9.0" - # spec.visionos.deployment_target = "1.0" + spec.visionos.deployment_target = "1.0" spec.source = { :git => "https://github.com/banjun/SwiftHotReload.git", :tag => "#{spec.version}" } spec.source_files = "Sources/**/*.swift" spec.swift_version = "5.1" From e715119f4fb6c2faae63464f1944d201770c87c5 Mon Sep 17 00:00:00 2001 From: banjun Date: Mon, 30 Oct 2023 19:17:30 +0900 Subject: [PATCH 2/2] add visionOS to Package.swift --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 74e81e0..fbfca02 100644 --- a/Package.swift +++ b/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( name: "SwiftHotReload", - platforms: [.iOS(.v14), .macOS(.v13)], + platforms: [.iOS(.v14), .macOS(.v13), .visionOS(.v1)], products: [ .library(name: "SwiftHotReload", targets: ["SwiftHotReload"]), ],