Photo by Nick Fewings on Unsplash

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.

What problem does it solve?

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

  • Devices and Simulator
  • All platforms: iOS / MacOS / tvOS / watchOS
  • Mac apps using AppKit and UIKit


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.

How it happens?

This error can easily occur with the following setup.

  1. Create Swift framework (let’s say ShapeMaker.framework) in Xcode 10.0, which has Swift version 4.2
  2. Create Single View app (let’s say Shapes.xcodeproj) in Xcode…

Anand Elumalai

iOS Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store