Production-oriented Swift macros for app development.
swift-app-macros ships AppMacros: SwiftUI redraw
optimization via @Equatable, @SkipEquatable, and EquatableBodyView.
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.
| 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.
// 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"),
]),
]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 |
swift test # 44 tests / 4 suitesCI runs on pull requests (.github/workflows/ci.yml).
Release notes are in CHANGELOG.md.
Contributions are welcome — see CONTRIBUTING.md and the Code of Conduct. For security issues, follow the Security Policy instead of opening a public issue.
MIT — see LICENSE.