Post

Replies

Boosts

Views

Activity

Incorrect swiftinterface generated for UIView subclass
I have a customized view like below: import UIKit public class TestView: UIView { public struct Preference { } public static var global: Preference = Preference() public class func show(preference: Preference = TestView.global) { } } I used xcodebuild archive and xcodebuild -create-xcframework to create a xcframework. However, when I embeded it to my host project, there is an error: Main actor-isolated static property 'global' can not be referenced from a non-isolated context, which is in the ***.private.swiftinterface file. The content of this file is as below: // swift-interface-format-version: 1.0 // swift-compiler-version: Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51) // swift-module-flags: -target x86_64-apple-ios16.1-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -Onone -module-name SDK // swift-module-flags-ignorable: -enable-bare-slash-regex import Foundation @_exported import SDK import Swift import UIKit import _Concurrency import _StringProcessing @objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class TestView : UIKit.UIView { public struct Preference { } @_Concurrency.MainActor(unsafe) public static var global: SDK.TestView.Preference @_Concurrency.MainActor(unsafe) public class func show(preference: SDK.TestView.Preference = TestView.global) @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreFoundation.CGRect) @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder) @objc deinit } Is it a bug for Xcode? Now my workaround is to avoid static properties in the method declaration.
0
0
1.2k
Jun ’23