Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift version embedded in external Framework

Tags:

ios

swift

A third part company has provide me a Framework. I would like to check the swift version embedded in the framework (2.2, 2.3 or 3.x) The framework directory include libswift dylib files.

How to check the swift version used in the framework ?

Thanks !

like image 832
lafalex Avatar asked Apr 21 '17 09:04

lafalex


People also ask

What is embedded framework iOS?

A framework is a hierarchical directory that encapsulates a dynamic library, header files, and resources, such as storyboards, image files, and localized strings, into a single package. Apps using frameworks need to embed the framework in the app's bundle.

What are the frameworks available in Swift?

Swift is a multipurpose, multi-paradigm compiled language created by Apple Inc. It is used for macOS, iPadOS, iOS, watchOS, Linux, and tvOS. The team that developed it makes use of an open-source LLVM compiler framework.

What is the best Swift framework?

Kitura. The concept for the App Development with Swift marks its success with these language web services and web framework development called Kitura. Apart from the swift framework, Kitura also uses an HTTP server, making it a faster and reliable way of working with web services.


3 Answers

I used the -Swift.h Header file.

$ cat FrameworkName.framework/Headers/FrameworkName-Swift.h

First line is the information you need:

// Generated by Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
like image 161
btype Avatar answered Oct 18 '22 20:10

btype


You can use otool to print all versions of included binaries in the framework:

otool -l /path/to/your/FrameworkName.framework/Versions/A/FrameworkName
like image 37
Oskar Avatar answered Oct 18 '22 21:10

Oskar


You can use Oskars answer to get the swiftlang version (in your case: 703.0.18).

Now you just have to lookup for the Swift version in the following table:

Swiftlang version            Swift version
-                            -
swiftlang-602.0.49.3         1.2
swiftlang-602.0.49.6         1.2
swiftlang-602.0.53.1         1.2
swiftlang-700.0.59           2.0
swiftlang-700.1.101.6        2.1
swiftlang-700.1.101.15       2.1.1
swiftlang-703.0.18.1         2.2
swiftlang-703.0.18.8         2.2
swiftlang-800.0.46.2         3.0
swiftlang-800.0.58.6         3.0.1
swiftlang-800.0.63           3.0.2
swiftlang-802.0.48           3.1
swiftlang-802.0.51           3.1
swiftlang-802.0.53           3.1

Source: Wikipedia

So 703.0.18 means Swift version 2.2.

like image 36
illaz Avatar answered Oct 18 '22 22:10

illaz