Apple has introduced a new way of shipping Swift libraries in binary form from Xcode 11, known as Binary Frameworks. And XCFramework is a new supported way to distribute Binary frameworks.
If we want to share a Swift library before Binary framework was introduced, we have to ship it with the source code due to Swift compiler compatibility error. Now, it is not required to share the source code with Binary frameworks.
XCFrameworks: It’s a single variant that can contain binaries for
Module compiled with Swift 4.2 cannot be imported by the Swift 5.1.3 compiler
At some point of time, we would have come across above error statement in Swift. May be with different swift version numbers.
It means, we cannot use a Swift framework compiled in one version in a Swift project compiled in another version.
We will see how and why this happens and solution for it shortly.
This error can easily occur with the following setup.