Introducing the New Braze Swift SDK

Published on March 01, 2023/Last edited on March 01, 2023/5 min read

Introducing the New Braze Swift SDK
AUTHOR
Benjamin Kasman
Product Manager, Braze

Back in 2011, Braze (then known as Appboy) released our first SDK for iOS, which was also our very first mobile SDK of any kind. Over the past 12 years, this library—which leverages Objective-C, long the main language of iOS app development—has helped apps around the world power first-party brand interactions for over three billion devices. Today, we're excited to announce that this SDK's more modern and performant successor, the new Braze Swift SDK, is now available to all Braze customers.

Swift SDK Improvements and Benefits

In recent years, the ecosystem for developing iOS apps has evolved rapidly, with new frameworks and best practices springing up that can provide additional value for brands and their users alike. By launching our Swift SDK, we're making it possible for Braze customers to take advantage of modern app tooling and an improved developer experience, supporting both performance improvements for your app and a simplified integration process for developers.

Objective-C (AppboyKit)

Swift SDK

App Performance

Processing is done on the main thread of your application.

✅ Processing is done on background threads, which can result in more robust performance and improved app loading times.

UI Customization

Customization must be done by subclasses. This requires knowledge of Braze UI internals even for small design updates.

✅ Easier customization is available via the attributes struct API, which allows single properties to be modified.

Subclassing is still supported for more advanced customization.

OS Support for Messaging

  • iOS
  • macCatalyst
  • iOS
  • tvOS
  • macCatalyst
  • Allows for future OS expansion

See versioning support for more details.

Event Handling

Event handlers are registered separately, which requires increased integration effort.

✅ Centralized to a single BrazeDelegate.

Separate handlers are still supported.

Third-Party Dependencies

Requires SDWebImage for image support on in-app messages, Content Cards, and News Feed.

✅ No third-party dependencies.

Your choice of any library (internal or external) can be used for GIF support.

IDFV Collection

IDFV is always used as the Device ID.

✅ IDFV is now optionally collected (see documentation).

Location Analytics

Required as part of app build.

✅ Optional Location Library (BrazeLocation), which allows for more precise App Store category classification.

Important: As of the date of this blog post, new features associated with apps for Apple devices will only be added to the Swift SDK, including no-code push primers, which was released last year.

Migrating from AppboyKit to Braze Swift SDK

To simplify the migration from AppboyKit to the Swift SDK, we're excited to announce two new compatibility libraries: BrazeKitCompat and BrazeUICompat, as well as a thoroughly documented migration guide.

The new Objective-C Compatibility Libraries allow you to upgrade to the Swift SDK in incremental steps, rather than forcing one big project rewrite. These libraries provide backward compatibility and include warnings for Xcode to help guide you through the Objective-C to Swift migration. These warning messages provide a way to easily migrate your code (see Fig. 1 below), and some corrections can be made for you just by clicking the "Fix" button.

Fig. 1

rich image block

BrazeKitCompat can be imported alongside your AppboyKit integration to start the migration to Swift with little to no changes to existing integration code.

BrazeUICompat is a separate framework that provides a migration path for any customized UI components (Content Cards, in-app messages, News Feed).

The migration guide also allows for two different migration scenarios, a Minimal Migration and a Full Migration:

  • The Minimal Migration is a complete drop-in replacement to quickly get your application compiling with the Swift SDK. There are no code changes required other than updating import statements: import BrazeKitCompat / import BrazeUICompat.
  • The Full Migration is designed to replace all Appboy instances with Braze, and enables all deprecation warnings in your application. This allows you to migrate each feature one by one to the new APIs.

tvOS Support

An additional benefit of our new Swift SDK is the added support for messaging on the tvOS platform. This means you can show messaging (in-app messages, Content Cards, background push) to users on larger TV experiences. See our documentation to learn more about integrating tvOS.

Deprecation of Objective-C SDK

"AppboyKit", our Objective-C iOS SDK—as of the date of the blog post—is supported but is no longer in active development by Braze (i.e. it will not receive any new features). Going forward, we will only release updates for security and critical bug fixes as we shift our focus and efforts towards our new Swift SDK.

With our Swift SDK's compatibility layer, support for Objective-C host apps, and the migration guide, all apps are now eligible to upgrade to the new SDK to enjoy the benefits mentioned above. For a breakdown of which cross-platform SDKs are supported by the Swift SDK, please review our documentation.

As of or around March 1, 2024, Braze intends to no longer support the Objective-C SDK and compatibility layer. At that point the SDK will no longer receive bug fixes, security updates, or technical support. Features specific to the Objective-C SDK will also no longer be supported, but messaging and analytics on older SDK versions will continue to function as usual. Therefore, in order to ensure that you’re able to take advantage of all the improvements that the Swift SDK provides, including access to the latest iOS features, performance updates, and bug fixes, we strongly recommend migrating prior to March 2024.

Anything Else?

If you have questions about our new Swift SDK or feedback that you want to share, feel free to open a support ticket or open a new issue on Github to get in touch with our team.

Related Content

View the Blog

Join the movement to journey orchestration.

The move to highly-intelligent, always-on journey orchestration is happening. And much of it is happening on our platform. Join brands of all sizes who are taking the craft of customer engagement to the next level.