From 2daebd061776f24bda2b57298598573a4105fb26 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 28 Jul 2026 23:05:40 +0800 Subject: [PATCH 1/5] Remove duplicate declarations across UI modules Use the OpenSwiftUICore declarations for shared event, style context, and view debug types so the modules can safely share an ABI namespace. --- .../KeyboardShortcut/EventModifiers.swift | 19 +------ .../OpenSwiftUI/View/Control/EnabledKey.swift | 50 ------------------- .../CustomViewDebugValueConvertible.swift | 11 ---- Sources/OpenSwiftUI/View/List/ListStyle.swift | 2 - 4 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 Sources/OpenSwiftUI/View/Control/EnabledKey.swift delete mode 100644 Sources/OpenSwiftUI/View/Debug/TODO/CustomViewDebugValueConvertible.swift diff --git a/Sources/OpenSwiftUI/Event/InputEvent/KeyboardShortcut/EventModifiers.swift b/Sources/OpenSwiftUI/Event/InputEvent/KeyboardShortcut/EventModifiers.swift index fb7cbb4ea..5ccce2911 100644 --- a/Sources/OpenSwiftUI/Event/InputEvent/KeyboardShortcut/EventModifiers.swift +++ b/Sources/OpenSwiftUI/Event/InputEvent/KeyboardShortcut/EventModifiers.swift @@ -5,24 +5,7 @@ // Audited for 3.5.2 // Status: Complete -@frozen public struct EventModifiers: OptionSet { - public let rawValue: Int - public init(rawValue: Int) { - self.rawValue = rawValue - } - - public static let capsLock = EventModifiers(rawValue: 1) // 0x1 - public static let shift = EventModifiers(rawValue: 1 << 1) // 0x2 - public static let control = EventModifiers(rawValue: 1 << 2) // 0x4 - public static let option = EventModifiers(rawValue: 1 << 3) // 0x8 - public static let command = EventModifiers(rawValue: 1 << 4) // 0x10 - public static let numericPad = EventModifiers(rawValue: 1 << 5) // 0x20 - @available(*, deprecated, message: "Function modifier is reserved for system applications") - public static let function = EventModifiers(rawValue: 1 << 6) // 0x40 - public static let all = [capsLock, shift, control, option, command, numericPad] // 0x3F -} - -extension EventModifiers: Sendable {} +import OpenSwiftUICore #if os(iOS) || os(visionOS) || os(tvOS) import UIKit diff --git a/Sources/OpenSwiftUI/View/Control/EnabledKey.swift b/Sources/OpenSwiftUI/View/Control/EnabledKey.swift deleted file mode 100644 index 7f1dc0103..000000000 --- a/Sources/OpenSwiftUI/View/Control/EnabledKey.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// EnabledKey.swift -// OpenSwiftUI -// -// Audited for 3.5.2 -// Status: Complete -// ID: 6C7FC77DDFF6AC5E011A44B5658DAD66 - -private struct EnabledKey: EnvironmentKey { - static var defaultValue: Bool { true } -} - -extension EnvironmentValues { - /// A Boolean value that indicates whether the view associated with this - /// environment allows user interaction. - /// - /// The default value is `true`. - public var isEnabled: Bool { - get { self[EnabledKey.self] } - set { self[EnabledKey.self] = newValue } - } -} - -extension View { - /// Adds a condition that controls whether users can interact with this - /// view. - /// - /// The higher views in a view hierarchy can override the value you set on - /// this view. In the following example, the button isn't interactive - /// because the outer `disabled(_:)` modifier overrides the inner one: - /// - /// HStack { - /// Button(Text("Press")) {} - /// .disabled(false) - /// } - /// .disabled(true) - /// - /// - Parameter disabled: A Boolean value that determines whether users can - /// interact with this view. - /// - /// - Returns: A view that controls whether users can interact with this - /// view. - @inlinable - public func disabled(_ disabled: Bool) -> some View { - modifier(_EnvironmentKeyTransformModifier( - keyPath: \.isEnabled, - transform: { $0 = $0 && !disabled } - )) - } -} diff --git a/Sources/OpenSwiftUI/View/Debug/TODO/CustomViewDebugValueConvertible.swift b/Sources/OpenSwiftUI/View/Debug/TODO/CustomViewDebugValueConvertible.swift deleted file mode 100644 index 8df64ce78..000000000 --- a/Sources/OpenSwiftUI/View/Debug/TODO/CustomViewDebugValueConvertible.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// CustomViewDebugValueConvertible.swift -// -// -// - -protocol CustomViewDebugValueConvertible { - var viewDebugData: Any { get } -} - -//extension diff --git a/Sources/OpenSwiftUI/View/List/ListStyle.swift b/Sources/OpenSwiftUI/View/List/ListStyle.swift index 8fa7b2772..f2268db78 100644 --- a/Sources/OpenSwiftUI/View/List/ListStyle.swift +++ b/Sources/OpenSwiftUI/View/List/ListStyle.swift @@ -21,8 +21,6 @@ struct GroupedFormTextFieldStyleContext: StyleContext {} struct RadioGroupStyleContext: StyleContext {} -struct ToolbarStyleContext: StyleContext {} - struct ColumnarLabeledContentStyle: LabeledContentStyle { func makeBody(configuration: Configuration) -> some View { _openSwiftUIUnimplementedFailure() From a83e3e5992dde99bf6497181e79385b9a72acb18 Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 29 Jul 2026 01:39:08 +0800 Subject: [PATCH 2/5] Fix default style modifier protocol descriptor --- Sources/OpenSwiftUI_SPI/Util/ProtocolDescriptor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/OpenSwiftUI_SPI/Util/ProtocolDescriptor.c b/Sources/OpenSwiftUI_SPI/Util/ProtocolDescriptor.c index a2e4d0bb7..3eda44575 100644 --- a/Sources/OpenSwiftUI_SPI/Util/ProtocolDescriptor.c +++ b/Sources/OpenSwiftUI_SPI/Util/ProtocolDescriptor.c @@ -44,7 +44,7 @@ OPENSWIFTUI_EXPORT const void *$s15OpenSwiftUICore20DefaultStyleModifierMp; const void *_OpenSwiftUI_defaultStyleModifierProtocolDescriptor(void) { - return &$s15OpenSwiftUICore15GestureModifierMp; + return &$s15OpenSwiftUICore20DefaultStyleModifierMp; } OPENSWIFTUI_EXPORT From 69f02cf561e9d252f1b1c5799dd7c5d71ebfcead Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 29 Jul 2026 01:39:27 +0800 Subject: [PATCH 3/5] Update SPI references for the shared ABI namespace --- Sources/OpenSwiftUI_SPI/Util/Interpose.c | 8 ++--- .../OpenSwiftUI_SPI/Util/ProtocolDescriptor.c | 32 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Sources/OpenSwiftUI_SPI/Util/Interpose.c b/Sources/OpenSwiftUI_SPI/Util/Interpose.c index 28d1144e8..7073a2076 100644 --- a/Sources/OpenSwiftUI_SPI/Util/Interpose.c +++ b/Sources/OpenSwiftUI_SPI/Util/Interpose.c @@ -100,10 +100,10 @@ static inline CFStringRef _interpose_protocol_description(const void *protocol) // MARK: - Color.Resolved Nominal Type Descriptor extern const void $s7SwiftUI5ColorV8ResolvedVN; -extern const void *$s15OpenSwiftUICore5ColorV8ResolvedVN; +extern const void *$s11OpenSwiftUI5ColorV8ResolvedVN; const void *_OpenSwiftUI_ColorResolvedNTD(void) { - return &$s15OpenSwiftUICore5ColorV8ResolvedVN; + return &$s11OpenSwiftUI5ColorV8ResolvedVN; } // MARK: - swift_dynamicCast @@ -142,10 +142,10 @@ static bool my_swift_dynamicCast(void *dest, void *src, const void *srcType, con // MARK: - PlatformDrawable Protocol Descriptor extern const void $s7SwiftUI16PlatformDrawableMp; -extern const void $s15OpenSwiftUICore16PlatformDrawableMp; +extern const void $s11OpenSwiftUI16PlatformDrawableMp; const void *_OpenSwiftUI_PlatformDrawablePD(void) { - return &$s15OpenSwiftUICore16PlatformDrawableMp; + return &$s11OpenSwiftUI16PlatformDrawableMp; } // MARK: - swift_conformsToProtocol2 diff --git a/Sources/OpenSwiftUI_SPI/Util/ProtocolDescriptor.c b/Sources/OpenSwiftUI_SPI/Util/ProtocolDescriptor.c index 3eda44575..463e90f5f 100644 --- a/Sources/OpenSwiftUI_SPI/Util/ProtocolDescriptor.c +++ b/Sources/OpenSwiftUI_SPI/Util/ProtocolDescriptor.c @@ -13,57 +13,57 @@ void _OpenSwiftUI_callVisitViewType(void *visitor_value, const void *view_pwt); OPENSWIFTUI_EXPORT -const void *$s15OpenSwiftUICore4ViewMp; +const void *$s11OpenSwiftUI4ViewMp; const void *_OpenSwiftUI_viewProtocolDescriptor(void) { - return &$s15OpenSwiftUICore4ViewMp; + return &$s11OpenSwiftUI4ViewMp; } OPENSWIFTUI_EXPORT -const void *$s15OpenSwiftUICore12ViewModifierMp; +const void *$s11OpenSwiftUI12ViewModifierMp; const void *_OpenSwiftUI_viewModifierProtocolDescriptor(void) { - return &$s15OpenSwiftUICore12ViewModifierMp; + return &$s11OpenSwiftUI12ViewModifierMp; } OPENSWIFTUI_EXPORT -const void *$s15OpenSwiftUICore7GestureMp; +const void *$s11OpenSwiftUI7GestureMp; const void *_OpenSwiftUI_gestureProtocolDescriptor(void) { - return &$s15OpenSwiftUICore7GestureMp; + return &$s11OpenSwiftUI7GestureMp; } OPENSWIFTUI_EXPORT -const void *$s15OpenSwiftUICore15GestureModifierMp; +const void *$s11OpenSwiftUI15GestureModifierMp; const void *_OpenSwiftUI_gestureModifierProtocolDescriptor(void) { - return &$s15OpenSwiftUICore15GestureModifierMp; + return &$s11OpenSwiftUI15GestureModifierMp; } OPENSWIFTUI_EXPORT -const void *$s15OpenSwiftUICore20DefaultStyleModifierMp; +const void *$s11OpenSwiftUI20DefaultStyleModifierMp; const void *_OpenSwiftUI_defaultStyleModifierProtocolDescriptor(void) { - return &$s15OpenSwiftUICore20DefaultStyleModifierMp; + return &$s11OpenSwiftUI20DefaultStyleModifierMp; } OPENSWIFTUI_EXPORT -const void *$s15OpenSwiftUICore21StyleOverrideModifierMp; +const void *$s11OpenSwiftUI21StyleOverrideModifierMp; const void *_OpenSwiftUI_styleOverrideModifierProtocolDescriptor(void) { - return &$s15OpenSwiftUICore21StyleOverrideModifierMp; + return &$s11OpenSwiftUI21StyleOverrideModifierMp; } OPENSWIFTUI_EXPORT -const void *$s15OpenSwiftUICore27StyleWriterOverrideModifierMp; +const void *$s11OpenSwiftUI27StyleWriterOverrideModifierMp; const void *_OpenSwiftUI_styleWriterOverrideModifierProtocolDescriptor(void) { - return &$s15OpenSwiftUICore27StyleWriterOverrideModifierMp; + return &$s11OpenSwiftUI27StyleWriterOverrideModifierMp; } OPENSWIFTUI_EXPORT -const void *$s15OpenSwiftUICore12StyleContextMp; +const void *$s11OpenSwiftUI12StyleContextMp; const void *_OpenSwiftUI_styleContextProtocolDescriptor(void) { - return &$s15OpenSwiftUICore12StyleContextMp; + return &$s11OpenSwiftUI12StyleContextMp; } From 4eb9503a0b4afc1f92d68e0483789545ad3514d7 Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 29 Jul 2026 01:49:27 +0800 Subject: [PATCH 4/5] Use OpenSwiftUI as the core ABI module name --- Example/Tuist/Package.swift | 1 + Package.swift | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Example/Tuist/Package.swift b/Example/Tuist/Package.swift index ce5b7ceae..557657613 100644 --- a/Example/Tuist/Package.swift +++ b/Example/Tuist/Package.swift @@ -72,6 +72,7 @@ let openSwiftUITargetSettings: SettingsDictionary = [ let openSwiftUICoreTargetSettings: SettingsDictionary = [ "DYLIB_INSTALL_NAME_BASE": "@rpath", "OTHER_LDFLAGS": "$(inherited) -ObjC", + "OTHER_SWIFT_FLAGS": "$(inherited) -module-abi-name OpenSwiftUI", ] var packageProductTypes: [String: ProjectDescription.Product] = [ diff --git a/Package.swift b/Package.swift index ce960b95a..2d6039e6c 100644 --- a/Package.swift +++ b/Package.swift @@ -586,7 +586,9 @@ let openSwiftUICoreTarget = Target.target( ] + (swiftUIRenderCondition && symbolLocatorCondition ? ["OpenSwiftUISymbolDualTestsSupport"] : []), cSettings: sharedCSettings, cxxSettings: sharedCxxSettings, - swiftSettings: sharedSwiftSettings, + swiftSettings: sharedSwiftSettings + [ + .unsafeFlags(["-module-abi-name", "OpenSwiftUI"]), + ], linkerSettings: computeCondition ? [ .linkedLibrary("c++", .when(platforms: .darwinPlatforms)), ] : [] @@ -969,6 +971,7 @@ let openSwiftUITargetSettings: SettingsDictionary = [ let openSwiftUICoreTargetSettings: SettingsDictionary = [ "DYLIB_INSTALL_NAME_BASE": "@rpath", "OTHER_LDFLAGS": "$(inherited) -ObjC", + "OTHER_SWIFT_FLAGS": "$(inherited) -module-abi-name OpenSwiftUI", ] let packageSettings = PackageSettings( From 77f0d706594c7fc276f30e0177bdb20758c46478 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 1 Aug 2026 16:31:51 +0800 Subject: [PATCH 5/5] Normalize SwiftUI module names in compatibility tests --- .../Animation/AnimationCompatibilityTests.swift | 6 +----- .../StringHelper.swift | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 Tests/OpenSwiftUICompatibilityTests/StringHelper.swift diff --git a/Tests/OpenSwiftUICompatibilityTests/Animation/Animation/AnimationCompatibilityTests.swift b/Tests/OpenSwiftUICompatibilityTests/Animation/Animation/AnimationCompatibilityTests.swift index 1beb5f419..cb3e38013 100644 --- a/Tests/OpenSwiftUICompatibilityTests/Animation/Animation/AnimationCompatibilityTests.swift +++ b/Tests/OpenSwiftUICompatibilityTests/Animation/Animation/AnimationCompatibilityTests.swift @@ -9,11 +9,7 @@ struct AnimationCompatibilityTests { func description() { let animation = Animation.default #expect(animation.description == "DefaultAnimation()") - #if OPENSWIFTUI - #expect(animation.debugDescription == "AnyAnimator(OpenSwiftUICore.DefaultAnimation())") - #else - #expect(animation.debugDescription == "AnyAnimator(SwiftUI.DefaultAnimation())") - #endif + #expect(animation.debugDescription == "AnyAnimator(OpenSwiftUI.DefaultAnimation())".normalizeSwiftUI) #expect(animation.customMirror.description == "Mirror for Animation") } } diff --git a/Tests/OpenSwiftUICompatibilityTests/StringHelper.swift b/Tests/OpenSwiftUICompatibilityTests/StringHelper.swift new file mode 100644 index 000000000..e9c06a14b --- /dev/null +++ b/Tests/OpenSwiftUICompatibilityTests/StringHelper.swift @@ -0,0 +1,15 @@ +// +// StringHelper.swift +// OpenSwiftUICompatibilityTests + +import Foundation + +extension String { + package var normalizeSwiftUI: String { + #if OPENSWIFTUI + self + #else + replacingOccurrences(of: "OpenSwiftUI", with: "SwiftUI") + #endif + } +}