Breaking Changes in iOS (Swift) SDK

Learn about the breaking changes introduced in the iOS (Swift) SDK when migrating from the legacy iOS SDK v2.

This document outlines the breaking changes introduced in the iOS (Swift) SDK when migrating from the legacy iOS SDK v2.

Package & import changes

The SDK has been renamed from Rudder to RudderStackAnalytics. Update your package dependencies and import statements throughout your codebase.

Initialization

The singleton pattern (RSClient.sharedInstance()) has been replaced with an instance-based approach.

Public classes renamed

All public classes have been renamed to remove the RS prefix in favor of clearer, more descriptive names. Find and replace all references in your codebase.

OldNew
RSClientAnalytics
RSConfigConfiguration
RSOptionRudderOption
RSMessageEvent
RSPluginPlugin
RSEventPluginEventPlugin
RSDestinationPluginIntegrationPlugin
RSLogLevelLogLevel

API method signatures

All tracking methods now use explicit named parameters for better code readability and Swift conventions. The first parameter is no longer anonymous, and option has been renamed to options.

MethodiOS SDK v2 — LegacyiOS (Swift)
Tracktrack(_:properties:option:)track(name:properties:options:)
Identifyidentify(_:traits:option:)identify(userId:traits:options:)
Screenscreen(_:category:properties:option:)screen(screenName:category:properties:options:)
Groupgroup(_:traits:option:)group(groupId:traits:options:)
Aliasalias(_:option:)alias(newId:previousId:options:)
Resetreset()reset(options:)

Type changes

Several numeric types have changed to UInt64 for consistency and to support larger values. Note that flush interval units changed from seconds to milliseconds for finer control.

FieldiOS SDK v2 — LegacyiOS (Swift)
Session IDIntUInt64
Session timeoutInt
Milliseconds
UInt64
Milliseconds
Flush intervalInt
Seconds
UInt64
Milliseconds

An example for session management is shown below:

// Old
RSClient.sharedInstance().startSession(1234567890)  // Int

// New
analytics.startSession(sessionId: 1234567890)  // UInt64

Plugin execution stages

Plugin execution stages have been renamed to better describe their purpose in the event processing pipeline. The .after stage has been removed — use .terminal or .utility instead.

iOS SDK v2 — LegacyiOS (Swift)
.before.preProcess
.enrichment.onProcess
.destination.terminal
.afterRemoved
.utility.utility

Configuration mappings

The builder pattern (RSConfig().method().method()) has been replaced with a standard Swift initializer. Session-related settings are now grouped in a separate SessionConfiguration object.

Use the below table as a reference when updating your configuration code:

iOS SDK v2 — Legacy (RSConfig)iOS (Swift) SDK (Configuration)
writeKeywriteKey
dataPlaneURL(_:)dataPlaneUrl
controlPlaneURL(_:)controlPlaneUrl
loglevel(_:)Handled via LoggerAnalytics class
trackLifecycleEvents(_:)trackApplicationLifecycleEvents
recordScreenViews(_:)Not available. User can handle via custom plugins
flushQueueSize(_:)CountFlushPolicy
sleepTimeOut(_:)Handled via FrequencyFlushPolicy
dbCountThreshold(_:)Handled via CountFlushPolicy
autoSessionTracking(_:)Handled via SessionConfiguration.automaticSessionTracking
sessionTimeout(_:)Handled via SessionConfiguration.sessionTimeoutInMillis

Removed features

The following features are removed in the iOS (Swift) SDK:

  • MessageContext and context call are no longer available.
  • CocoaPods is not supported — only Swift Package Manager is supported.

Migration from iOS v2 SDK

See the Migration Guide for detailed instructions on migrating from the legacy iOS SDK v2 to the iOS (Swift) SDK.



Questions? Contact us by Email or on Slack