XCode 10.2 Swift Universal Framework does not work for Objective-C

Swift Universal Framework Build

I am team lead of SDK development team.

Our team developed iOS SDK by Swift in 3 years. (I am one of first members of this service and I decided to use Swift to develop SDK, and make simple SDK to proceed project).

iOS 10.2 was released, and support Swift 5. And our team tried to support Swift 5 for customers as usual.

What happens?

Every time, Apple releases new Swift or XCode, we build new SDK for customers (Swift compatible issues mainly)

My team engineer noticed that cannot call Swift from Objective-C (from framework) when we changed SDK for Objective-C sample App. (Our team create and open Sample App both Swift and Objective-C for customers).

We tried to call Swift from Objective-C directly (not from framework), it’s working.

Compiler does not seem to understand swift from Objective-C (there are a lot of not resolved messages)

Problem is from?

Apple XCode 10.2 Release Note

From This Apple Release note, lipo to merge Simulator binary and Device binary is not working correctly to merge Swift Header.

Objective-C uses XXXXX-Swift.h to call Swift from Swift dynamic framework.

How to fix?

It’s not difficult.

Actually, copy intermediate build headers (both Simulator and Device) and merge by hand and copy into final framework Or add copy and create new headers using Mac command.

#if TARGET_OS_SIMULATOR
<contents of original iOS Simulator/Framework.framework/Framework-Swift.h>
#else
<contents of original iOS/Framework.framework/Framework-Swift.h>
#endif

コメント