Skip to content
Merged
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
74 changes: 42 additions & 32 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@
);
/Localized/Main.storyboard = (
ios,
xros,
);
SceneDelegate.swift = (
ios,
xros,
);
};
target = 27D49DF72BA604FB00F6E2E2 /* HostingExample */;
Expand Down Expand Up @@ -530,9 +532,10 @@
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
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;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = OpenSwiftUIDebug;
};
Expand All @@ -559,12 +562,13 @@
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = NO;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
XROS_DEPLOYMENT_TARGET = 2.0;
};
name = OpenSwiftUIDebug;
};
Expand Down Expand Up @@ -633,10 +637,10 @@
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = SwiftUIDebug;
};
Expand Down Expand Up @@ -702,11 +706,11 @@
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = SwiftUIRelease;
};
Expand Down Expand Up @@ -772,11 +776,11 @@
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = OpenSwiftUIDebug;
};
Expand Down Expand Up @@ -842,11 +846,11 @@
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = OpenSwiftUIRelease;
};
Expand Down Expand Up @@ -935,9 +939,10 @@
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
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;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = SwiftUIRelease;
};
Expand All @@ -964,12 +969,13 @@
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = NO;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
XROS_DEPLOYMENT_TARGET = 2.0;
};
name = SwiftUIRelease;
};
Expand Down Expand Up @@ -1058,9 +1064,10 @@
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
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;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = OpenSwiftUIRelease;
};
Expand All @@ -1087,12 +1094,13 @@
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = NO;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
XROS_DEPLOYMENT_TARGET = 2.0;
};
name = OpenSwiftUIRelease;
};
Expand All @@ -1112,10 +1120,10 @@
PRODUCT_BUNDLE_IDENTIFIER = org.OpenSwiftUI.OpenSwiftUIUITests;
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 = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestingHost.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TestingHost";
};
name = SwiftUIDebug;
Expand All @@ -1134,10 +1142,10 @@
PRODUCT_BUNDLE_IDENTIFIER = org.OpenSwiftUI.OpenSwiftUIUITests;
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 = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestingHost.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TestingHost";
};
name = SwiftUIRelease;
Expand All @@ -1156,10 +1164,10 @@
PRODUCT_BUNDLE_IDENTIFIER = org.OpenSwiftUI.OpenSwiftUIUITests;
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 = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestingHost.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TestingHost";
};
name = OpenSwiftUIDebug;
Expand All @@ -1178,10 +1186,10 @@
PRODUCT_BUNDLE_IDENTIFIER = org.OpenSwiftUI.OpenSwiftUIUITests;
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 = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestingHost.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TestingHost";
};
name = OpenSwiftUIRelease;
Expand Down Expand Up @@ -1271,9 +1279,10 @@
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
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;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = SwiftUIDebug;
};
Expand All @@ -1300,12 +1309,13 @@
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = NO;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
XROS_DEPLOYMENT_TARGET = 2.0;
};
name = SwiftUIDebug;
};
Expand Down
6 changes: 3 additions & 3 deletions Example/Example/BenchmarkApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import OpenSwiftUI
import SwiftUI
#endif

#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit
#endif

Expand All @@ -24,7 +24,7 @@ struct BenchmarkApp {
])
}
}
#if os(iOS)
#if os(iOS) || os(visionOS)
extension UIHostingController: _Test where Content == AnyView {}
extension UIHostingController: _ViewTest where Content == AnyView {
public func initRootView() -> AnyView {
Expand All @@ -46,7 +46,7 @@ struct PerformanceTest: _PerformanceTest {
}

func runTest(host: _BenchmarkHost, options: [AnyHashable : Any]) {
#if os(iOS)
#if os(iOS) || os(visionOS)
let test = _makeUIHostingController(view) as! UIHostingController<AnyView>
test.setUpTest()
test.render()
Expand Down
2 changes: 1 addition & 1 deletion Example/HostingExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Kyle on 2024/3/17.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import UIKit

Expand Down
2 changes: 1 addition & 1 deletion Example/HostingExample/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Kyle on 2024/3/17.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import UIKit

Expand Down
4 changes: 2 additions & 2 deletions Example/HostingExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import OpenSwiftUI
import SwiftUI
#endif

#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit
#elseif os(macOS)
import AppKit
#endif

#if os(iOS)
#if os(iOS) || os(visionOS)
class ViewController: UINavigationController {
override func viewDidAppear(_ animated: Bool) {
pushViewController(EntryViewController(), animated: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import Testing
import SnapshotTesting

#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit
typealias PlatformViewControllerRepresentable = UIViewControllerRepresentable
#elseif os(macOS)
Expand All @@ -19,7 +19,7 @@ struct PlatformViewControllerRepresentableUITests {
@Test
func plainColorView() {
struct PlainColorView: PlatformViewControllerRepresentable {
#if os(iOS)
#if os(iOS) || os(visionOS)
func makeUIViewController(context: Context) -> some UIViewController {
let vc = UIViewController()
vc.view.backgroundColor = .red
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import Testing
import SnapshotTesting

#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit
typealias PlatformViewRepresentable = UIViewRepresentable
#elseif os(macOS)
Expand All @@ -19,7 +19,7 @@ struct PlatformViewRepresentableUITests {
@Test
func plainColorView() {
struct PlainColorView: PlatformViewRepresentable {
#if os(iOS)
#if os(iOS) || os(visionOS)
func makeUIView(context: Context) -> some UIView {
let v = UIView()
v.backgroundColor = .red
Expand Down
4 changes: 2 additions & 2 deletions Example/SharedExample/Extension/Color+Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import OpenSwiftUI
import SwiftUI
#endif

#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit
typealias PlatformColor = UIColor
#elseif os(macOS)
Expand All @@ -21,7 +21,7 @@ typealias PlatformColor = NSColor

extension Color {
init(platformColor: PlatformColor) {
#if os(iOS)
#if os(iOS) || os(visionOS)
self.init(uiColor: platformColor)
#elseif os(macOS)
self.init(nsColor: platformColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import OpenSwiftUI
import SwiftUI
#endif

#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit
typealias PlatformViewRepresentable = UIViewRepresentable
typealias PlatformViewControllerRepresentable = UIViewControllerRepresentable
Expand All @@ -19,7 +19,7 @@ typealias PlatformViewControllerRepresentable = NSViewControllerRepresentable
#endif

struct ColorViewRepresentableExample: PlatformViewRepresentable {
#if os(iOS)
#if os(iOS) || os(visionOS)
func makeUIView(context: Context) -> some UIView {
let v = UIView()
v.backgroundColor = .red
Expand All @@ -40,7 +40,7 @@ struct ColorViewRepresentableExample: PlatformViewRepresentable {
}

struct ColorViewControllerRepresentableExample: PlatformViewControllerRepresentable {
#if os(iOS)
#if os(iOS) || os(visionOS)
func makeUIViewController(context: Context) -> some UIViewController {
let vc = UIViewController()
vc.view.backgroundColor = .red
Expand Down
Loading