Back to Home

Swift 6.3: Android SDK and @c attribute

Swift 6.3 introduces official SDK for Android, @c attribute for export to C, module selectors and new compiler optimizations. The update improves cross-platform capabilities and performance for senior developers.

Swift 6.3 officially on Android with C interop
Advertisement 728x90

# Swift 6.3: Official SDK for Android and New Export Attributes

Swift 6.3 was released at the end of March 2026. Source code is available on GitHub under Apache 2.0. The previous stable release was Swift 6.2 in October 2025, and Swift 6.0 with support for Debian, Fedora, and Ubuntu 24.04 came out in September 2024. Official builds are distributed for Linux, Windows, and macOS.

The update focuses on expanding cross-platform capabilities and compiler tools. The Swift language incorporates features from C and Objective-C while maintaining compatibility with the Objective-C runtime. Swift code is interoperable with C and Objective-C, uses ARC for memory management, and prevents buffer overflows, access to uninitialized memory, and use-after-free errors.

Swift supports generics, closures, lambdas, tuples, dictionary types, efficient collections, and functional constructs. Compilation to machine code via LLVM delivers 30% better performance than Objective-C. Swift Package Manager handles dependencies, building, and linking.

Google AdInline article slot

Swift SDK for Android: Official Release

The first key change is the official Swift SDK for Android. Now mid- and senior-level developers can build native Android apps entirely in Swift or integrate Swift components into existing Java/Kotlin projects.

The SDK has graduated from experimental status thanks to contributions from the Android working group and the community. This simplifies cross-platform development by minimizing barriers between the iOS/macOS and Android ecosystems.

// Example integration Swift in Android project
import Foundation

@objc public class SwiftBridge: NSObject {
    @objc public func greet(name: String) -> String {
        return "Hello, \(name)! From Swift on Android."
    }
}

This code demonstrates basic interoperability: the class is exported for JNI.

Google AdInline article slot

The @c Attribute and C Exports

The new @c attribute exports Swift functions and enums to C. The compiler generates a header file (.h) with the declarations.

@c
public enum ErrorCode: Int32 {
    case none = 0
    case invalidInput = 1
    case networkFailure = 2
}

@c
public func processData(_ data: UnsafePointer<UInt8>, length: Int) -> ErrorCode {
    // Obrabotka data
    return .none
}

The generated module.h:

enum ErrorCode : int32_t {
  ErrorCode_none = 0,
  ErrorCode_invalidInput = 1,
  ErrorCode_networkFailure = 2
};

enum ErrorCode processData(const uint8_t *data, int length);

This is crucial for FFI in systems programming and embedding Swift in C-based projects.

Google AdInline article slot

Module Selectors and Conflict Resolution

Module selectors have been introduced to resolve ambiguities when importing APIs with the same names from multiple modules.

import ModuleA.SomeType
using module(ModuleB) SomeType  // Yavno from ModuleB

let a: ModuleA.SomeType = ...
let b: ModuleB.SomeType = ...

The using module(ModuleB) selector specifies the provenance, preventing linker errors in large projects with overlapping dependencies.

New Compiler Optimization Attributes

Optimization attributes have been expanded for fine-tuning:

  • @specialize: generates monomorphic specializations of generics for hot types (e.g., Array<Int>).
  • @inline: forces inlining of functions to reduce call overhead.
  • @export(implementation): exports ABI-stable implementations to libraries.
@specialize(Array<Int>)
public func sum<T: Numeric>(_ array: [T]) -> T {
    return array.reduce(0, +)
}

@inline(never)
public func debugLog(_ msg: String) {
    print("DEBUG: \(msg)")
}

Swift Build Integration in SwiftPM

An early implementation of Swift Build has been integrated into Swift Package Manager. This speeds up incremental builds, especially in monorepos with thousands of packages.

Key points:

  • Official Swift SDK for Android: full development and integration with Java/Kotlin.
  • @c attribute: automatic C header generation for FFI.
  • Module selectors: resolving naming conflicts without renaming.
  • Optimization attributes: @specialize, @inline, @export(implementation) for performance tuning.
  • Swift Build in SwiftPM: improved build performance.

The update reflects community contributions, especially from the Android group. Swift 6.3 strengthens the language's position in multi-platform development for senior specialists.

— Editorial Team

Advertisement 728x90

Read Next