Skip to content

Commit

Permalink
Merge pull request #146 from onevcat/feature/vision-os-support
Browse files Browse the repository at this point in the history
Feature visionOS support
  • Loading branch information
onevcat committed Mar 18, 2024
2 parents 8f798ab + 0d7e8d4 commit 947947c
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/APNGKit.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1530"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 1 addition & 0 deletions APNGKit.podspec
Expand Up @@ -21,6 +21,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = "12.0"
s.osx.deployment_target = "10.14"
s.tvos.deployment_target = "12.0"
s.visionos.deployment_target = "1.0"

s.source = { :git => "https://github.com/onevcat/APNGKit.git", :tag => s.version }

Expand Down
12 changes: 9 additions & 3 deletions Demo/Demo.xcodeproj/project.pbxproj
Expand Up @@ -577,7 +577,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1310;
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1530;
TargetAttributes = {
4B5ECBC8272E29B9003930D4 = {
CreatedOnToolsVersion = 13.1;
Expand Down Expand Up @@ -920,6 +920,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -981,6 +982,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down Expand Up @@ -1024,11 +1026,13 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.onevcat.APNGKitDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = Debug;
};
Expand Down Expand Up @@ -1057,11 +1061,13 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.onevcat.APNGKitDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = Release;
};
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1530"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Demo/Demo.xcodeproj/xcshareddata/xcschemes/Demo.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1530"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Package@swift-5.9.swift
Expand Up @@ -3,7 +3,7 @@ import PackageDescription

let package = Package(
name: "APNGKit",
platforms: [.macOS(.v10_14), .iOS(.v12), .tvOS(.v12)],
platforms: [.macOS(.v10_14), .iOS(.v12), .tvOS(.v12), .visionOS(.v1)],
products: [
.library(name: "APNGKit", targets: ["APNGKit"])
],
Expand Down
8 changes: 7 additions & 1 deletion Source/APNGKit/CrossPlatform.swift
Expand Up @@ -12,7 +12,13 @@ import UIKit
public typealias PlatformDrivingTimer = DisplayTimer
public typealias PlatformView = UIView
public typealias PlatformImage = UIImage
var screenScale: CGFloat { UIScreen.main.scale }
var screenScale: CGFloat {
#if os(visionOS)
UITraitCollection.current.displayScale
#else
UIScreen.main.scale
#endif
}

extension Notification.Name {
static var applicationDidBecomeActive = UIApplication.didBecomeActiveNotification
Expand Down
5 changes: 4 additions & 1 deletion Tests/APNGKitTests/APNGImageViewTests.swift
Expand Up @@ -23,8 +23,11 @@ class ViewControllerStub {
func setupViewController(_ input: UIViewController) -> UIViewController {

input.loadViewIfNeeded()

#if os(visionOS)
window = UIWindow(frame: .init(x: 0, y: 0, width: 800, height: 600))
#else
window = UIWindow(frame: UIScreen.main.bounds)
#endif
window.rootViewController = input
window.makeKeyAndVisible()
return input
Expand Down

0 comments on commit 947947c

Please sign in to comment.