iOS Tutorial Swift libraries


Staff member
Licensed User
B4i supports libraries written in Swift and compiled as frameworks.
Note that adding swift frameworks makes the compilation process considerably more complicated and it is recommended to avoid swift libraries if there is an alternative.

The B4i wrapper is written in Objective C. You can see an example here: (note the ~dependson attribute).

Using a Swift library is not different than using an Objective C library. There are however a couple nuances that you should be familiar with:
1. Swift runtime libraries - All applications with Swift code depend on Swift runtime libraries. They are added automatically during compilation. The runtime size is about 8mb.
Note that the size of the ipa file, when you compile with a store provision profile in release mode, will be about 35mb. Still the app size when installed on the device will be around 8mb.

2. Simulator not supported for now.

3. If using a local Mac then you need to make sure to use B4i build server v6.51+ and you need to follow these instructions:
Last edited:


Well-Known Member
Licensed User
Thank you for this important feature.
3. Simulator not supported for now
After creating a framework with both architectures it seems to be possible (see attached picture).




Staff member
Licensed User
I will clarify the simulator issue.

If you use a "fat" framework, that is a framework that includes binaries for i386 as well as the arm binaries, then the ipa file will be rejected when you try to submit it. The reason is that swift libraries are dynamic libraries and unlike regular static libraries they are embedded as-is in the app. The app store verification process rejects non-arm binaries.

You can use a fat framework during development and switch to an arm only framework before submitting it to the store.

In the future the B4i builder will automatically strip fat dynamic frameworks when you create a store build.