ObjC default inits appear in a xcframework


I struggling with Objective-C default initializers poped up in xcframework while we don’t have such initializers in the framework code. It looks like this in the xcframework interface file

@objc override dynamic public init()

So if I use this framework not as xcframework but as Swift Package with source code then Xcode doesn’t allow to me to use this init() inherited from NSObject. But in a xcframework this init() appears and allows to me to use it and then crashes because there is no such init in this object. I found this article there https://github.com/bielikb/xcframeworks#Testing-&-Troubleshooting (Testing and Troubleshooting section) and it says that it's a known issue and I need to provide public init for all these cases. But how can I maintain all my code and find all such cases in the framework? And what if I dont want to or can’t provide this initializer?

So for example I have some MyStackView in a framework which is subclass of UIStackView. And I have my initializer like init(withParameter: … ). But I can use default initializers of UIStackView like init(frame: after conversion to xcframework. And it crashes

let myStackView = MyStackView(frame: ) // compiler is OK but it crashes

How I can coup with it in a right way?

Terms of Service

Privacy Policy

Cookie Policy