From 059d3c978d0d8543c73bd23b6c630e831e9b490f Mon Sep 17 00:00:00 2001 From: Ernesto Rivera Date: Wed, 17 Jan 2024 12:04:53 -0400 Subject: [PATCH 1/3] Make code visionOS-compatible and fix deprecation warning for iOS --- Toast/Toast.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Toast/Toast.swift b/Toast/Toast.swift index 5b4dd05..60ea214 100644 --- a/Toast/Toast.swift +++ b/Toast/Toast.swift @@ -332,7 +332,16 @@ public extension UIView { activityView.layer.shadowOffset = style.shadowOffset } - let activityIndicatorView = UIActivityIndicatorView(style: .whiteLarge) + #if !os(visionOS) + let activityIndicatorView: UIActivityIndicatorView + if #available(iOS 13.0, *) { + activityIndicatorView = UIActivityIndicatorView(style: .large) + } else { + activityIndicatorView = UIActivityIndicatorView(style: .whiteLarge) + } + #else + let activityIndicatorView = UIActivityIndicatorView(style: .large) + #endif activityIndicatorView.center = CGPoint(x: activityView.bounds.size.width / 2.0, y: activityView.bounds.size.height / 2.0) activityView.addSubview(activityIndicatorView) activityIndicatorView.color = style.activityIndicatorColor From 4d7e48904c29bb5efc5ecc066183a2ac1e8c6827 Mon Sep 17 00:00:00 2001 From: Ernesto Rivera Date: Wed, 17 Jan 2024 12:05:11 -0400 Subject: [PATCH 2/3] Add visionOS destination to targets --- Toast-Swift.xcodeproj/project.pbxproj | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Toast-Swift.xcodeproj/project.pbxproj b/Toast-Swift.xcodeproj/project.pbxproj index bddd9f3..15cab15 100644 --- a/Toast-Swift.xcodeproj/project.pbxproj +++ b/Toast-Swift.xcodeproj/project.pbxproj @@ -384,6 +384,9 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.scalessec.Toast-Swift"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; + TARGETED_DEVICE_FAMILY = "1,7"; }; name = Debug; }; @@ -403,8 +406,11 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.scalessec.Toast-Swift"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,7"; }; name = Release; }; @@ -432,7 +438,9 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.scalessec.Toast-Swift-Framework"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2,7"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -462,9 +470,11 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.scalessec.Toast-Swift-Framework"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; From 9ce969da272e36e8a3a4212f1a283bc68f4689ef Mon Sep 17 00:00:00 2001 From: Ernesto Rivera Date: Wed, 17 Jan 2024 12:05:24 -0400 Subject: [PATCH 3/3] Make demo app visionOS-compatible --- Example/AppDelegate.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Example/AppDelegate.swift b/Example/AppDelegate.swift index ff46e59..3a90097 100644 --- a/Example/AppDelegate.swift +++ b/Example/AppDelegate.swift @@ -28,7 +28,11 @@ import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { + #if !os(visionOS) lazy var window: UIWindow? = UIWindow(frame: UIScreen.main.bounds) + #else + lazy var window: UIWindow? = UIWindow() + #endif func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { let viewController = ViewController(style: .plain)