While it is super easy to build a swift framework and set up the dependency. It is also quite easy to build a swift static library.

This is what you will achieve after this tutorial:

  • You have created a ColorToken library with one simple function.
  • You know how to add the library dependency.

Let’s get started!

In Xcode, go to File ▸ New ▸ ProjectiOSStaticLibraryNext, give ColorToken as Product name and choose Swift as Language then Next Create.

Build and Run.

Add the following code to ColorToken.

Build and Run.

Close the…


with Objective-C and Swift Code…

Creating a Swift framework is easy, creating a hybrid framework with both Objective-C and Swift is just fun. So let’s get started and this is what you will build.

  1. The Most Awesome Framework is called Components.
  2. In the Components, there is a TrackRowCell which is written in Swift.
  3. The TrackRowCell has an image, the image implementation is written in Objective-C.

The section includes the following parts:

  • Creating the framework Components
  • Adding TrackRowCell implementations in Swift

Open Xcode, Create a New Xcode Project ▸ iOSFrameworkNext, give Components as Product name and choose Swift…


Using C, C++ and Objective-C frameworks in Swift apps

I did a talk in try!Swift Tokyo this year about using C, C++ and Objective-C frameworks in Swift apps. The presentation was quite concise, so I decided to write down the content in details to provide more information.

The structure of this article will be divided into:

  • Language connections among C, C++, Objective-C and Swift
  • How to set up dependencies
  • Why wrappers and how to write wrappers

Language connections among C, C++, Objective-C and Swift

Photo credit: Cecilia Humlelu

C to Swift

C is 47 years old, and Swift is a new powerful open source language that has support for C. Even though it can not…


I was watching a comedy the other day and realized that this is still a thing: Some people do not know that in general Chinese and Japanese people do not understand each other if they speak their own native languages.

A lot of people may already know that the Japanese writing system consists of kanji(Chinese characters) and kana(Hiragana, Katakana). The kana was simplified from kanji, which might give the impression that Chinese and Japanese languages are very close, but actually Japanese as a language does not have a genetic relationship with Chinese. This means that Japanese is NOT descended from…


is not tricky if we know the tricks.

TL;DR Swift can not read C++ code directly, but if we wrap the C++ library into an Objective-C module using Objective C++, it will do the trick.

Step One: Create an Objective-C project

Xcode ->New->Project->Cocoa touch framework -> Language:Objective-C -> Next. I named my project CppDependencyTutorial.

Step Two: Set up project dependency

I have a static C framework called ExampleC++Library. Drag the ExampleC++Library.xcodeproj into CppDependencyTutorial project.

Choose target CppDependencyTutorial -> general -> Linked frameworks and libraries -> Add libExampleC++Library.a.


Option 2: using module maps

TL;DR Part 1 describes how to use public header to setup C library dependencies in Swift projects. A even neater way to set up C library dependencies is to use module maps.

Step One: Create a swift project

Xcode ->New->Project->Cocoa touch framework -> Language:Swift -> Next. I named my project CDependencyTutorial2.

Step Two: Set up project dependency

I have a static C framework called ExampleCLibrary. Drag the ExampleCLibrary.xcodeproj into CDependencyTutorial2 project.

Step Three: Setup the C library as a submodule

Choose target CDependencyTutorial2 -> general -> Linked frameworks and libraries -> Add libExampleCLibrary.a.


can be pretty simple.

TL;DR one simple way to set up C library dependencies is to use public header when setting up a swift project in Xcode.

Step One: Create a swift project

Xcode ->New->Project->Cocoa touch framework -> Language:Swift -> Next. I named my project CDependencyTutorial.

Step Two: Set up project dependency

I have a static C framework called ExampleCLibrary. Drag the ExampleCLibrary.xcodeproj into CDependencyTutorial project.

Step Three: Tweak a few project settings

Choose target CDependencyTutorial -> general -> Linked frameworks and libraries -> Add libExampleCLibrary.a.


is difficult…

That is why sharing is caring 😀

TL;DR If you are looking for various places to stay in Japan between 2 weeks and 1 year, this might be interesting for you.

As some of you may heard from different sources, finding a place to stay for a medium to long term in Japan is not easy and it is still true today. This is mainly because of the language barriers but also because there is a lot of other requirements. …

Cecilia Humlelu

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