Skip to content

v1.0.0

Latest

Choose a tag to compare

@EngOmarElsayed EngOmarElsayed released this 14 Jul 07:36
b7a688a

@Concurrent 1.0.0 — Initial Release 🎉

A Swift macro that automatically applies @concurrent to all async methods in a type.

Features

  • @Concurrent member-attribute macro — attach it to a class, struct, or enum and every async method (including async throws) is annotated with @concurrent automatically.
  • Smart skipping — non-async methods, nonisolated methods, and stored properties are left untouched.
  • Compile-time diagnostics
    • Error (with fix-it) when @Concurrent is applied to an actor, since actor methods are isolated to the actor.
    • Warning (with fix-it) when a method already has an explicit @concurrent annotation.

Requirements

  • Swift 6.2+ (built on swift-syntax 604)
  • macOS 10.15+ / iOS 13+ / tvOS 13+ / watchOS 6+ / macCatalyst 13+ / visionOS 1+

Installation

dependencies: [
    .package(url: "https://github.com/EngOmarElsayed/swift-concurrent-macro.git", from: "1.0.0")
]

Usage

import ConcurrentMacro

@Concurrent
class Service {
    func fetch() async { }   // expands to @concurrent func fetch() async
    func compute() -> Int { 0 } // untouched
}