Making Use of Split SDK User Consent Features in Your WatchOS App

Learn how Split equips you to adhere to data privacy protection laws by giving you full control over usage data using Split iOS SDK’s user consent features.

With very recent new laws on data privacy coming into effect, user consent is gaining momentum. Since the far-reaching General Data Protection Regulation (GDPR) took force on May 25, 2018, companies that cater to or track EU citizens must demonstrate compliance with its data protection and accountability principles. In 2019, the French national data protection authority CNIL used the GDPR to take an immense bite out of Google’s revenues: Oh là là!

Even if you don’t dine with fine wine, or even if Europe may not be your cup of tea, there is a significant need for awareness also in North America and globally. The California Consumer Privacy Act (CCPA) went into effect Jan 1, 2020, with additional protections effective Jan 1, 2023. There are also the Canadian Consumer Privacy Protection Act (CPPA), the Australian Privacy Act reforms, and others on the horizon.

The trend is evident. It’s time to learn to ride the wave. If you are a dev, then you are already out on the water. Surf’s up, so let’s see how Split helps you catch the momentum, pop up and fly.

In this article, we will show you how to use Split SDK’s user consent capabilities, newly available in iOS, to stay on top of the game. You can clone our demo project on GitHub, coded with Swift 5 in Xcode 14.2, supporting iOS 15.0+, and watchOS 8.0+. This tutorial builds on the earlier code example in Setting Up Event Tracking in Your WatchOS App.

How to Make Use of Split’s User Consent Features

Let’s use Split’s new support for user consent to control what data is sent to Split Cloud easily. Specifically, the Split SDK allows you to start with an unknown, granted or denied state for user consent. The user consent can then be toggled between granted or denied. If user consent is granted, the Split SDK will send encrypted tracked events and feature flag evaluation information to a private data center. If user consent is denied, this data will not be cached nor sent out.

In our SplitWrapper class initializer, we will set the new userConsent property of the SplitClientConfig class to unknown.

let config = SplitClientConfig()
config.userConsent = UserConsent.unknownCode language: Arduino (arduino)

We next pass the UserConsent.unknown value to the Split factory.

factory = DefaultSplitFactoryBuilder().setConfig(config)Code language: Arduino (arduino)

This unknown user consent value sets up the Split SDK to create feature flag evaluation and event data and initially cache this data only on the watch (on the physical device). Note that the information is not sent to Split Cloud, and if the app is terminated in this state, this locally cached data is permanently deleted.

We also define a private @Published variable to make use of the Combine reactive programming framework to update the views when the user makes a choice.

@Published private var userConsentValue: Bool?Code language: Delphi (delphi)

Now, we can expose the ability to set user consent values in the Split SDK using the following two property definitions for isUserConsentUnknown and isUserConsentGranted.

public var isUserConsentUnknown: Bool {
  get {
    return UserConsent.unknown == factory.userConsent

public var isUserConsentGranted: Bool {
  get {
    return UserConsent.granted == factory.userConsent
  set {
    factory.setUserConsent(enabled: newValue)
    DispatchQueue.main.async {
      self.userConsentValue = newValue
}Code language: C# (cs)

These changes in our SplitWrapper.swift class equip us to set up a prompt to request consent to store the user’s workout choices, giving the user full control of the event data generated in the app.

In our accompanying code example, our prompt is defined in SplitUserConsentView.swift, and looks like this.

Great progress so far! Now, at this point in your coding, you will need to familiarize yourself with the privacy laws that you are aiming to meet. This will determine how you will persist and display the user consent value. For example, the GDPR requires that the user can view and modify the app’s data collection and usage settings at any time. This means you will need to add these settings to an accompanying iOS app, and then listen for changes to these settings in your watchOS app. Though this is not covered here, you can learn how to do this by looking up the WatchKit Settings Bundle.


Split iOS SDK’s user consent capabilities give you perfect control over user data, including pseudonymous data, that may be stored in Swift cloud or passed to third parties. Now you can widen your horizons geographically and reach out to the ocean of possibilities before you, while you skillfully comply with regulations set forth by the relevant data protection authorities.

Split provides the equipment you need to get ahead of the swell and, dude, you’ll be ripping up the waves.

Check out the full code on GitHub, with a shaka thrown to Javier Avrudsky on the Split SDK Team for some great code reviews.

Learn what Split’s new support for watchOS can do for you, and the motivation and benefits behind data-driven development.

The best feature toggling tools and platforms are built with in-app SDKs. Learn why this unique architecture is beneficial for software teams.

Learn how to create a basic CRUD app using Spring Boot and Angular to release features to production quickly and safely.

Deliver Features That Matter, Faster with Split

Split is a feature management platform that attributes insightful data to everything you release. Whether your team is looking to test in production, perform gradual rollouts, or experiment with new features–Split ensures your efforts are safe, visible, and highly impactful. What a Release. Get going with a free account today, Schedule a demo to learn more, or contact us for further questions and support.