Chilkat Software Chilkat Software Chilkat Software
Chilkat Software Chilkat Software

  

  

  

  

  

 

Chilkat iOS Swift Compile and Linking Notes

1) Add a bridging-header to your project.

  1. Add a header file to your project, named [MyProjectName]-Bridging-Header.h. This is the single header file where you import Chilkat Objective-C headers, such as CkoZip.h, CkoEmail.h, etc.
  2. In your project build settings, find Swift Compiler – Code Generation, and next to Objective-C Bridging Header add the path to your bridging header file, from the project’s root folder. For example, it could be MyProject/MyProject-Bridging-Header.h or simply MyProject-Bridging-Header.h if the file is located in the project root folder.

    There should only be one Bridging Header. Add your #import statements to this file, and the Chilkat classes will be available in your Swift code without any extra import statements.

2) Link with the Chilkat static library (libchilkatIos.a)

It is likely you've created a universal static library (libchilkatIos.a) as described here: Building an iOS Universal Chilkat Static Library.

Add libChilkatIos.a to your list of libs for linking. In your project build settings,
find Build Phases - Link Binary with Libraries, select Add Other, navigate to the libChilkatIos.a, and add it.

3) Link with stdc++

The Chilkat library internals are written in C++. Therefore, your Swift application will need to link against the C++ runtime libraries. In your Build Settings, go to the Linking section and add -lstdc++ to the Other Linker Flags

4) Linking may require -lresolv and -lpthread system libraries

Depending on what functionality is used, your application may need to link with these additional system libraries: -lresolv, -lpthread.

Just like for "-lstdc++", in your Build Settings, go to the Linking section and add -lresolv and -lpthread to the Other Linker Flags. Note, when multiple libs are listed in Other Linker Flags, separate with spaces. For example: "-lstd++ -lresolv -lpthread".

Back to Chilkat Cocoa Library Downloads

Back to Chilkat iOS Library Downloads


Privacy Statement. Copyright 2000-2017 Chilkat Software, Inc. All rights reserved.

(Regarding the usage of the Android logo) Portions of this page are reproduced from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

Send feedback to support@chilkatsoft.com


Software components and libraries for Linux, MAC OS X, iOS, Android™, Solaris, RHEL/CentOS, FreeBSD, MinGW
Azure, Windows 10, Windows 8, Windows Server 2012, Windows 7, Vista, XP, 2003 Server, 2008 Server, etc.