Issues building with Xcode 10.2 / Swift 5
mpdifran opened this issue ยท 10 comments
I get the following error after updating the project to build with Xcode 10.2 / Swift 5:
objc[21581]: Swift class extensions and categories on Swift classes are not allowed to have +load methods
Program ended with exit code: 9
Does this mean we can't use the load
class method, even if it's written in ObjC? Is the code in the load
method required, or just a nice to have?
load
(or setup
called from there) method are necessary if you need to setup the container before storyboard is initialized (i.e. implicit initialization from the Main.storyboard in iOS projects).
I haven't yet looked into the Xcode 10.2 / Swift 5 compatibility. But if this kind of functionality is problematic, we might consider dropping it. Users would lose some convenience in the initial setup of the UI though.
temporary solution we tried while we face the issue by adding
pod 'SwinjectStoryboard', :git => 'https://github.com/mdyson/SwinjectStoryboard.git', :branch => 'master'
in podfile until the issue solved.
Hi, is it possible to have a new version with this fix?
Or even could you provide the data of next release?
There is something to do?
That blog post is doing exactly what the crashing code doing before my PR (creating a category on the swift NSObject descendent and overriding load from obj-c code). Take a look here: https://github.com/Swinject/SwinjectStoryboard/blob/2.1.0/Sources/SwinjectStoryboard%2BSetUp.m#L24
The problem now is that with swift 5 this will produce a runtime error.