# iOS (Swift) SDK: Modern Analytics for Apple Platforms


The new [iOS (Swift) SDK]({{< ref "sources/event-streams/sdks/swift-sdk/" >}}) replaces the legacy [iOS (Obj-C) SDK]({{< ref "sources/event-streams/sdks/rudderstack-ios-sdk/" >}}) with a modern architecture designed for today's Apple development practices. Built with async-await, it introduces a runtime-flexible plugin system, multi-instance support, and expands platform coverage to include macOS alongside iOS, tvOS, and watchOS.

{{< announcement >}}
RudderStack recommends using the iOS (Swift) SDK for all new Apple platform implementations. The legacy iOS (Obj-C) SDK continues to receive maintenance updates but no new features.
{{< /announcement >}}

## Why we built this

The legacy iOS SDK was built in Objective-C when it was the dominant language for Apple development. As Swift has matured and become the standard, developers expect type-safe APIs, structured concurrency, and modern language features that Objective-C cannot provide.

The legacy iOS (Obj-C) SDK locked integrations at configuration time, making runtime modifications impossible. Customers who needed custom event processing or filtering had to request SDK changes, creating bottlenecks and slowing their implementation timelines.

The iOS (Swift) SDK addresses these limitations with native Swift concurrency, a dynamic plugin system for runtime customization, and expanded platform support including macOS. It lets you use a single SDK across Apple platforms.

## Key benefits

This section lists some key benefits of using the iOS (Swift) SDK.

### Developer experience

- **Modern Swift concurrency**: Built with async-await and structured concurrency for non-blocking operations and better app responsiveness
- **Enhanced identity access**: Type-safe direct property access to `anonymousId`, `userId`, `traits`, and `sessionId`
- **macOS support**: Native support for macOS 12.0+ alongside iOS 15.0+, tvOS 15.0+, and watchOS 8.0+

### Extensibility

- **Plugin architecture**: Dynamic plugin management lets you add, remove, and modify event processing without waiting for SDK updates
- **Multi-instance support**: Create multiple isolated analytics instances with independent state, storage, and configuration

### Stability

- **Shutdown API**: Explicitly shut down and clean up SDK resources with event persistence across restarts

### Maintainability

- **Cleaner payloads**: Removed redundant identity fields from `context.traits` for smaller, consistent event data

## How to use the SDK

For installation, initialization, and API usage, see the [iOS (Swift) SDK Quickstart]({{< ref "sources/event-streams/sdks/swift-sdk/quickstart.md" >}}). For configuration options, see [SDK Configuration Options]({{< ref "sources/event-streams/sdks/swift-sdk/configuration-options.md" >}}).

## New and improved features

**New features**

- [Plugin architecture]({{< ref "sources/event-streams/sdks/client-side-features/plugin-architecture/" >}}): Add, remove, and customize plugins at runtime
- [Multiple instances]({{< ref "sources/event-streams/sdks/client-side-features/multiple-instance-support.md" >}}): Run separate SDK instances for different data sources
- [Shutdown API]({{< ref "sources/event-streams/sdks/mobile-sdk-apis/shutdown.md" >}}): Clean up SDK resources during runtime with `analytics.shutdown()`

See [New Features in iOS (Swift) SDK]({{< ref "sources/event-streams/sdks/swift-sdk/new-features/_index.md" >}}) for more information.

**Improved features**

- **Flexible reset API**: Reset specific identity values (`anonymousId`, `userId`, `traits`, `session`) individually instead of all-or-nothing
- **Enhanced custom context**: Pass any JSON value type (strings, arrays, nested objects, booleans) to `customContext`, not just dictionaries
- **Flexible integration options**: Pass configuration objects to integrations instead of just boolean toggles
- **ExternalId on all event types**: Set `externalId` on track, screen, and group events—not just identify
- **Direct destination instance access**: Access destination plugin instances anytime with `getDestinationInstance()` instead of waiting for callbacks
- **Custom logger**: Configure centralized logging with pluggable implementations via `LoggerAnalytics.setLogger()`

See the [Improved Features in iOS (Swift) SDK]({{< ref "sources/event-streams/sdks/swift-sdk/new-features/improved-features.md" >}}) guide for more information.

## Migrate from legacy iOS (Obj-C) SDK

{{< success >}}
The legacy iOS (Obj-C) SDK continues to work and receive maintenance updates, so you can migrate at your own pace.
{{< /success >}}

The iOS (Swift) SDK introduces API and payload changes from the legacy iOS (Obj-C) SDK. For example, event payloads remove redundant identity fields such as `context.traits.anonymousId`, `context.traits.userId`, and `context.traits.id`.

{{< warning >}}
If your downstream systems rely on these removed fields, update your transformations before migrating.
{{< /warning >}}

See the following guides for detailed API differences and migration steps:

- [Breaking Changes in iOS (Swift) SDK]({{< ref "sources/event-streams/sdks/swift-sdk/breaking-changes/" >}})
- [Migration Guide]({{< ref "sources/event-streams/sdks/swift-sdk/migration-guide/" >}}): Migrate persisted user data (`anonymousId`, `userId`, traits, and so on)

## Platform requirements

| Platform | Minimum version |
| --- | --- |
| iOS | 15.0+ |
| macOS | 12.0+ |
| tvOS | 15.0+ |
| watchOS | 8.0+ |

## Resources

See the following resources for learning more about the iOS (Swift) SDK:

- [iOS (Swift) SDK Overview]({{< ref "sources/event-streams/sdks/swift-sdk/" >}})
- [New Features in iOS (Swift) SDK]({{< ref "sources/event-streams/sdks/swift-sdk/new-features/_index.md" >}})
- [Plugin Architecture]({{< ref "sources/event-streams/sdks/client-side-features/plugin-architecture/" >}})
- [Improved Features]({{< ref "sources/event-streams/sdks/swift-sdk/new-features/improved-features.md" >}})
- [Breaking Changes in iOS (Swift) SDK]({{< ref "sources/event-streams/sdks/swift-sdk/breaking-changes/" >}})

The following guides will help you get started with the iOS (Swift) SDK:

- [Quickstart Guide]({{< ref "sources/event-streams/sdks/swift-sdk/quickstart.md" >}})
- [SDK Configuration Options]({{< ref "sources/event-streams/sdks/swift-sdk/configuration-options.md" >}})
- [Migration Guide]({{< ref "sources/event-streams/sdks/swift-sdk/migration-guide/" >}})

