swift-app-macros

0.1.0

Production-oriented Swift macros for app development: @Equatable, @SkipEquatable, and EquatableBodyView for SwiftUI redraw optimization
9uiLe/swift-app-macros

What's New

0.1.0

2026-07-09T17:20:58Z

Initial public release of AppMacros — production-oriented Swift macros for SwiftUI redraw optimization.

Highlights

  • @Equatable — generates Equatable conformance from stored properties and automatically picks the generation form (nonisolated static func == member for View / global-actor types, or an extension otherwise). Auto-excludes computed properties, body, closures, and environment-derived dynamic properties (in .nonisolated form). @State is intentionally compared.
  • @SkipEquatable — excludes a specific stored property from the generated comparison.
  • EquatableBodyView — bakes .equatable() into the view definition so call sites can't silently forget it; content goes in equatableBody.
  • Diagnostics that reject unsafe usage.

Requirements

Swift tools 6.3 (Xcode 26.4+), iOS 26+, macOS 26+, swift-syntax 603.0.2.

Install

.package(url: "https://github.com/9uiLe/swift-app-macros.git", from: "0.1.0"),

See the CHANGELOG and docs.

AppMacros

Production-oriented Swift macros for app development.

swift-app-macros ships AppMacros: SwiftUI redraw optimization via @Equatable, @SkipEquatable, and EquatableBodyView.

Quick start

import AppMacros
import SwiftUI

@Equatable
struct CounterRow: EquatableBodyView {
    let value: Int

    var equatableBody: some View {
        Text("\(value)")
    }
}

// No `.equatable()` at call sites — baked into EquatableBodyView.
CounterRow(value: 1)

For intermediate views, use @Equatable and apply .equatable() at the call site.

Compatibility

Requirement Version
Swift tools 6.3 (swiftLanguageModes: [.v6])
Platforms iOS 26+, macOS 26+
swift-syntax 603.0.2 (exact pin)

This is an early package targeting the latest Apple SDKs. Older OS / Swift versions are not supported.

Installation

// Package.swift
dependencies: [
    .package(url: "https://github.com/9uiLe/swift-app-macros.git", from: "0.1.0"),
],
targets: [
    .target(name: "YourFeature", dependencies: [
        .product(name: "AppMacros", package: "swift-app-macros"),
    ]),
]

Documentation

The three APIs and the reasoning behind them are documented in docs/:

Topic Summary
Rationale Why an Equatable macro — the SwiftUI / Swift 6 pitfalls it removes
@Equatable Generated conformance: generation form, auto-exclusions, generics, examples
@SkipEquatable Exclude a specific stored property from comparison
EquatableBodyView Bake .equatable() into the view definition
Adoption guide Safe adoption checklist and known limitations

Testing

swift test   # 44 tests / 4 suites

CI runs on pull requests (.github/workflows/ci.yml).

Changelog

Release notes are in CHANGELOG.md.

Contributing

Contributions are welcome — see CONTRIBUTING.md and the Code of Conduct. For security issues, follow the Security Policy instead of opening a public issue.

License

MIT — see LICENSE.

Description

  • Swift Tools 6.3.0
View More Packages from this Author

Dependencies

Last updated: Sun Jul 12 2026 06:03:13 GMT-0900 (Hawaii-Aleutian Daylight Time)