swift-temporal-sdk

1.0.0-alpha

Swift SDK for Temporal
apple/swift-temporal-sdk

What's New

1.0.0-alpha

2026-04-09T14:46:04Z

This is the first alpha release of the Swift Temporal SDK. During the initial pre-releases we have learned a lot, filled important gaps and made the SDK safer to use. We plan on tagging a full release in the next few weeks.

What's Changed

Breaking changes

โš ๏ธ This release includes a few breaking changes including:

SemVer Minor

SemVer Patch

  • Add support for Temporal Cloud API key based authentication by @FranzBusch in #63
  • Check for Void value instead of underlying type by @snprajwal in #64
  • Introduce proto renamer tool and regenerate protos by @FranzBusch in #72
  • Ensure we respect access modifiers for Activity Container generation by @bauer-andreas in #104
  • Fix overflow crash in duration conversion by @FranzBusch in #112

Other Changes

  • Use latest version in the README by @bauer-andreas in #60
  • Document reusable auto-release workflow by @inductor in #61
  • Set write permissions on the job level by @FranzBusch in #65
  • Audit the artifact bundles for the Core SDK by @FranzBusch in #46
  • Add TestFailureError to fix flaky signal tests by @RalucaP in #68
  • Fix flaky asyncCompletionSucceeds test by increasing timeout by @RalucaP in #69
  • Enable dependabot and switch GHA references to tags by @czechboy0 in #71
  • Ensure contents: read permission are set on every workflow by @FranzBusch in #73
  • Fix flaky signal error tests by increasing timeout by @RalucaP in #76
  • Bump actions/upload-artifact from 6 to 7 by @dependabot[bot] in #80
  • Bump actions/download-artifact from 7 to 8 by @dependabot[bot] in #81
  • Bump swiftlang/github-workflows/.github/workflows/soundness.yml from 0.0.7 to 0.0.8 by @dependabot[bot] in #87
  • Fix clone URL format in README by @johankool in #98
  • Enable Swift 6.3 jobs in CI by @rnro in #109
  • Bump swiftlang/github-workflows/.github/workflows/soundness.yml from 0.0.8 to 0.0.9 by @dependabot[bot] in #121

New Contributors

Full Changelog: 0.6.0...1.0.0-alpha

Temporal Swift SDK

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

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, with struct-based workflows providing additional safety guarantees (queries can't mutate state, validators can't mutate state)
  • ๐Ÿ“Š Observability: Built-in support for logging, metrics and tracing
  • ๐Ÿ”ง Macro-based APIs: Simple @Workflow and @Activity macros to avoid boilerplate
  • ๐Ÿงช Testing Support: Easily test your workflows and activities

โš™๏ธ Use Cases

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

๐Ÿ Getting Started

Prerequisites

  • Swift version: Swift 6.2+

To install/upgrade Swift, see https://www.swift.org/install/

Adding as a dependency

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(from: "0.6.0"))
]

Running the project

  1. Clone the repository

    git clone git@github.com:apple/swift-temporal-sdk.git
  2. Build the package

    swift build
  3. Run tests

    swift test
  4. Run an example

    # Install Temporal CLI from https://temporal.io/setup/install-temporal-cli
    temporal server start-dev
    cd Examples/Greeting
    swift run GreetingExample

Usage

Here's a simple example showing how to create a workflow and activity:

import GRPCNIOTransportHTTP2Posix
import Logging
import Temporal

// Define an activity
@ActivityContainer
struct GreetingActivities {
    @Activity
    func sayHello(input: String) -> String {
        "Hello, \(input)!"
    }
}

// Define a workflow
@Workflow
struct GreetingWorkflow {
    mutating func run(context: WorkflowContext<Self>, input: String) async throws -> String {
        let greeting = try await context.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",
                instrumentation: .init(serverHostname: "127.0.0.1")
            ),
            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,
            configuration: .init(instrumentation: .init(serverHostname: "127.0.0.1")),
            logger: Logger(label: "client")
        )

        try await withThrowingTaskGroup { group in
            group.addTask {
                try await worker.run()
            }

            group.addTask {
                try await client.run()
            }

            // Wait for the worker and client to run
            try await Task.sleep(for: .seconds(1))

            // Execute workflow
            print("Executing workflow")
            let result = try await client.executeWorkflow(
                type: GreetingWorkflow.self,
                options: .init(id: "greeting-1", taskQueue: "greeting-queue"),
                input: "World"
            )

            print(result) // "Hello, World!"

            // Cancel the client and worker
            group.cancelAll()
        }
    }
}

๐Ÿ“˜ Documentation

๐Ÿงฐ Release Info

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

๐Ÿ› ๏ธ Support

If you have any questions or need help, feel free to reach out by opening an issue.

Description

  • Swift Tools 6.2.0
View More Packages from this Author

Dependencies

Last updated: Mon Apr 27 2026 06:56:04 GMT-0900 (Hawaii-Aleutian Daylight Time)