Swift is Apple's newest programming language, designed as a replacement for Objective-C, which was originally the main programming language available across all Apple's platforms (iOS, tvOS, watchOS, macOS). Swift brings with it a host of improvements, and is designed from the ground up to be a safer environment in which to write apps, resulting in better-performing and more robust code, and better end-user experiences. App vendors are increasingly migrating to Swift to take advantage of these new features, and to make it really easy to use Tealium with Swift, we have created a brand new library, to make it as easy as possible to implement our products in your Swift apps.
Swift and Objective-C code can peacefully co-exist and is fully interoperable within the same app, so migration is relatively easy.
Our Swift library is fully compatible with apps running pure Swift, Objective-C, or any combination of the two. Since it is the newest and most up-to-date library, we strongly recommend implementing the Swift library if possible. The Objective-C library is still fully supported, but the Swift library will generally be updated faster and have the newest features. There are, however, some differences between the 2 libraries, so you should check the comparison table below to figure out which one is most suitable for your needs.
Additionally, Swift has the widest compatibility of all Tealium libraries, and can even support server-side Swift environments.
The Swift library was built from scratch on a completely new codebase to the Objective-C library (https://github.com/Tealium/tealium-ios), and there are some subtle differences between the two libraries in terms of the current feature set. Below, we have compared the different features of both libraries. If you have requests for new features, feel free to open an issue on our GitHub page, or contact your account manager.
X - Present, / - Not Available, P - Partial Support (see notes)
|Multiton pattern||X||/||Enables support for multiple Tealium instances (profiles) running in the same app.||May be added to Swift in a future release. Not a widely-used feature of the Objective-C library. Most customers do not need this feature.|
|Auto Tracking||/||X||Automatically tracks UIViews and Events||Present in Swift, but will not be added to Objective-C|
|Lifecycle Tracking||X||X||Tracks App lifecycle events.|
|Tag Management||X||X||Allows use of Tealium iQ through a non-rendered web view|
|Tealium Collect||X||X||Sends data to Tealium's UDH using a native HTTPS request|
|Offline functionality/queuing||X||P||Automatically queues events if the device is online, and transmits when the device is online again||In the iOS (Objective-C) library, queued events were persisted across app launches. This feature will be added to Swift in the next release. Current functionality is that any queued data is lost when the app is closed (swiped away) by the user.|
|Remote Mobile Publish Settings (MPS)||X||/||Allows remote configuration of certain library settings||May be added to Swift in a future release. Current method of configuration is by the TealiumConfig object only, and must be set at compile time.|
|Volatile Data||X||X||Stores data for the current session (until app is terminated)|
|Persistent Data||X||X||Stores data between app launches|
|Remote Commands||X||X||Allows triggering of specified native code blocks from Tealium iQ|
|Apple Search Ads Support||/||X||Adds support for the Apple Search Ads API to collect attribution data automatically||Not planning to port to Objective-C|
|Optimizely Experiment Tracking||X||/||Tracks Optimizely experiment data automatically||May port to Swift in future, but not currently planned.|
|CocoaPods Support||X||X||Support for the CocoaPods dependency manager|
|Carthage Support||/||X||Support for the Carthage dependency manager|
|Source Code Available||/||X||May assist with debugging|
This document contains a comparison of the variable differences between Swift and Objective-C.