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

Initial visionOS support #211

Open
wants to merge 3 commits into
base: master
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
4 changes: 4 additions & 0 deletions Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 12 additions & 2 deletions Toast-Swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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;
};
Expand Down Expand Up @@ -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 = "";
};
Expand Down Expand Up @@ -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 = "";
};
Expand Down
11 changes: 10 additions & 1 deletion Toast/Toast.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down