Fast Version Compatibility for the Library

I distribute libraries for other developers ( http://empiric.al ). I noticed that between fast versions, even from 2.0 to 2.1, I get Module file was created by a (newer/older) version of the compiler.

I need to spread the future way.

How can I make sure that my compiled frameworks can be used by newer versions of Swift in the future, so I don’t need to recompile as soon as Apple releases a new beta version?

+8
ios frameworks xcode sdk swift
source share
2 answers

From the Apple website :

Binary Compatibility and Framework

While compatibility with your applications is ensured, the Swift language itself will continue to evolve, and the binary interface will also change. To be safe, all components of your application must be built using the same version of Xcode and the Swift compiler to make sure they work together.

This means that wireframes must be carefully managed. For example, if your project uses frameworks to share code with a built-in extension, you might want to create frameworks, applications, and extensions together. It would be dangerous to rely on binary structures that use Swift - especially from third parties. As Swift changes, this framework will not be compatible with the rest of your application. When the binary interface stabilizes in a year or two, the Swift runtime will become part of the host OS, and this restriction will no longer exist.

+11
source share

Before Swift ABI (the binary application interface) is stabilized (I guess another year or two), the only way to distribute libraries that will work in different versions of Xcode is to distribute the source code. Cocoa pods and Carthage are good tools to simplify the distribution of libraries, but for Swift code, they will still rely on available source code.

You might have Cocoapod that detects the version of Xcode it starts up with, and then downloads and provides the correct build for your library, but you still need to create libraries for all versions of Xcode that you want to maintain and recompile every time Apple is releasing a new Xcode, but at least the user will not need to download the new version manually.

+2
source share

All Articles