Temporal is a distributed, scalable, durable, and highly available orchestration engine used to execute asynchronous, long-running business logic in a scalable and resilient way.
- ๐ Swift package for authoring Temporal workflows and activities
- ๐ฆ Compatible with Swift Package Manager
- ๐ฑ Supports Linux (including the static SDK), macOS, iOS
- ๐ง Built with Swift 6.2+ and Xcode 26+
๐ Jump to:
- ๐ Overview
- โ๏ธ Use Cases
- ๐ Getting Started
- ๐ Documentation
- ๐งฐ Release Info
- ๐ ๏ธ Support
The Temporal Swift SDK provides a package for building distributed, durable workflows and activities using Swift's modern concurrency features. Temporal enables you to build reliable applications that recover from failures, scale dynamically, and maintain long-running business processes with confidence.
Key Features:
- ๐ Durable Workflows: Build fault-tolerant workflows that survive infrastructure failures
- ๐๏ธ Scalable Architecture: Distribute workflow execution across multiple workers
- โก Swift Concurrency: Native integration with Swift Structured Concurrency
- ๐ฏ Type Safety: Compile-time type checking for workflow and activity definitions
- ๐ Observability: Built-in support for logging, metrics and tracing
- ๐ง Macro-based APIs: Simple @Workflowand@Activitymacros to avoid boilerplate
- ๐งช Testing Support: Easily test your workflows and activities
The Temporal Swift SDK excels in scenarios requiring reliable, long-running business processes such as:
๐ E-commerce & Payment Processing
- Order fulfillment workflows with inventory, payment, and shipping coordination
- Multi-step payment processing with automatic retry and rollback capabilities
- Subscription billing and recurring payment management
๐ Data Processing & ETL
- Large-scale data transformation pipelines with fault tolerance
- Event-driven data processing with guaranteed delivery
- Batch processing jobs with progress tracking and resumption
๐ข Business Process Automation
- Approval workflows with human-in-the-loop interactions
- Multi-system integration and orchestration
- Document processing and compliance workflows
๐ Monitoring & Operations
- Health check orchestration across distributed systems
- Automated incident response and remediation
- Scheduled maintenance and cleanup tasks
- Swift version: Swift 6.2+
To install/upgrade Swift, see https://www.swift.org/install/
To use the Swift Temporal SDK in your Swift project, add it as a dependency in
your Package.swift file:
dependencies: [
    .package(url: "https://github.com/apple/swift-temporal-sdk.git", upToNextMinor: "0.1.0")
]- 
Clone the repository git clone git@github.com/apple/swift-temporal-sdk.git 
- 
Build the package swift build 
- 
Run tests swift test
- 
Run an example # Install Temporal CLI from https://temporal.io/setup/install-temporal-cli temporal server start-dev cd Examples/Greeting swift run GreetingExample 
Here's a simple example showing how to create a workflow and activity:
import Temporal
import Logging
// Define an activity
@ActivityContainer
struct GreetingActivities {
    @Activity
    func sayHello(input: String) -> String {
        "Hello, \(input)!"
    }
}
// Define a workflow
@Workflow
final class GreetingWorkflow {
    func run(input: String) async throws -> String {
        let greeting = try await Workflow.executeActivity(
            GreetingActivities.Activities.sayHello.self,
            options: ActivityOptions(startToCloseTimeout: .seconds(30)),
            input: input
        )
        return greeting
    }
}
// Create worker and client
@main
struct MyApp {
    static func main() async throws {
        let worker = try TemporalWorker(
            configuration: .init(
                namespace: "default",
                taskQueue: "greeting-queue"
            ),
            target: .ipv4(address: "127.0.0.1", port: 7233),
            transportSecurity: .plaintext,
            activityContainers: GreetingActivities(),
            workflows: [GreetingWorkflow.self],
            logger: Logger(label: "worker")
        )
        
        let client = try TemporalClient(
            target: .ipv4(address: "127.0.0.1", port: 7233),
            transportSecurity: .plaintext,
            logger: Logger(label: "client")
        )
        
        // Execute workflow
        let result = try await client.executeWorkflow(
            GreetingWorkflow.self,
            options: .init(id: "greeting-1", taskQueue: "greeting-queue"),
            input: "World"
        )
        
        print(result) // "Hello, World!"
    }
}- API Documentation - Complete API reference and guides
- Examples
- Sample projects demonstrating various features
 
Note
This SDK is currently under active development.
- Release Cadence: Ad-hoc whenever changes land on main
- Version Compatibility: Swift 6.2+ and macOS 15.0+ only
If you have any questions or need help, feel free to reach out by opening an issue.