Delegate methods in child class sometimes not called with Swift 5 compiler

后端 未结 6 1074
野的像风
野的像风 2020-12-24 14:32

EDIT: As sunshinejr pointed out here, this has been fixed and will be released together with the next Xcode/Swift version.


I\'ve seen a lot of

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-24 14:46

    I experienced the same issue only with the release scheme after upgrading to Xcode 10.2. I also tested Xcode 10.3 and it is exactly the same behavior.

    For those who don't want to add @objc everywhere in your delegate implementation.

    The quick solution is to disable the Swift 5 compiler optimisation in the build settings:

    For those who already upgraded to Xcode 10.3, it seems that this build settings option is not visible anymore, but you can still change it directly via the pbxproj file of your project and it should appear in the xcode UI afterward. SWIFT_COMPILATION_MODE = singlefile;

提交回复
热议问题