Skip to content

v1.1.0

Latest

Choose a tag to compare

@k-arindam k-arindam released this 02 Jun 17:31
· 3 commits to main since this release

v1.1.0 — Opt-Out Initialization Gating with @SkipInit 🚪

What's New

@SkipInit Macro

Sometimes a method intentionally needs to run before initialization is complete — a health check, a pre-flight ping, or an early teardown path. @SkipInit lets you opt individual methods out of the automatic gating injected by @AutoAwaitInit or @AutoAwaitThrowingInit.

@AutoAwaitInit
actor MyService: Initializable {
    let gate = InitializationGate()

    @SkipInit
    func ping() async -> Bool {
        // Runs immediately — no waiting for initialization
        return true
    }

    func fetchData() async -> [String] {
        // Still automatically gated as before ✅
        return store.all()
    }
}

Compiler-Enforced Rules

@SkipInit is fully guarded at compile time — misuse surfaces as a clear error with a one-click fix-it, never a runtime surprise:

Misuse Diagnostic
Applied to a sync function Error: sync methods are never wrapped anyway → remove @SkipInit
Used without @AutoAwaitInit on the enclosing type Error: @SkipInit has no effect here → remove @SkipInit
Used outside any type Error: must be inside a type declaration → remove @SkipInit

Upgrading

No breaking changes. Drop in v1.1.0 and annotate any methods that should bypass the initialization gate with @SkipInit.

Full Changelog: 1.0.0...1.1.0