# \#macros

**URL:** https://forums.swift.org/tag/macros/400.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [DepotKit: a type-safe, composable key-value store for Apple platforms](https://forums.swift.org/t/depotkit-a-type-safe-composable-key-value-store-for-apple-platforms/90181)

<div class="topic-metadata">

**Author:** [@FKREISE](https://forums.swift.org/u/FKREISE)\
**Replies:** 3\
**Last updated:** [November 20, 2026, 1:58am UTC](https://forums.swift.org/t/depotkit-a-type-safe-composable-key-value-store-for-apple-platforms/90181 "2026-11-20T01:58:30Z")

</div>

Hi everyone! We've just open-sourced DepotKit, a type-safe, composable key-value store for Apple platforms. My team at Mercedes-Benz built it, and it has stored most of the local data in the Mercedes-Benz iOS app for the…

---

## ["New Codable" prototype available for feedback](https://forums.swift.org/t/new-codable-prototype-available-for-feedback/85186)

<div class="topic-metadata">

**Author:** [@kperryua](https://forums.swift.org/u/kperryua)\
**Replies:** 88\
**Last updated:** [November 11, 2026, 4:30am UTC](https://forums.swift.org/t/new-codable-prototype-available-for-feedback/85186 "2026-11-11T04:30:44Z")

</div>

(Apologies for the re-post. We thought it best to create a new topic for increased visibility since some might not be following the original thread.) Hello again Swift Community! Here we are, almost a full year after m…

---

## [KeyPath to String: Efficient runtime conversion alternatives?](https://forums.swift.org/t/keypath-to-string-efficient-runtime-conversion-alternatives/90456)

<div class="topic-metadata">

**Author:** [@Dmitriy\_Ignatyev](https://forums.swift.org/u/Dmitriy_Ignatyev)\
**Replies:** 9\
**Last updated:** [November 6, 2026, 3:06pm UTC](https://forums.swift.org/t/keypath-to-string-efficient-runtime-conversion-alternatives/90456 "2026-11-06T15:06:53Z")

</div>

Hi everyone, I am working on a library where a dictionary-like data structure consumes instance property values using a list of key-paths. To use these key-paths as keys, I need to convert them into strings. However, I…

---

## [\[Pitch\] @Reasync and @ReasyncMembers macros](https://forums.swift.org/t/pitch-reasync-and-reasyncmembers-macros/86180)

<div class="topic-metadata">

**Author:** [@broken-circle](https://forums.swift.org/u/broken-circle)\
**Replies:** 41\
**Last updated:** [October 27, 2026, 9:11pm UTC](https://forums.swift.org/t/pitch-reasync-and-reasyncmembers-macros/86180 "2026-10-27T21:11:01Z")

</div>

Hello, Swift Evolution! This is a new pitch that would add @Reasync and @ReasyncMembers macros to the standard library, or to an official swiftlang-org package. The macros generate synchronous overloads of async functi…

---

## [PSA: Swift 6.4.0 breaks non-inlined macros from reading from disk on linux](https://forums.swift.org/t/psa-swift-6-4-0-breaks-non-inlined-macros-from-reading-from-disk-on-linux/89862)

<div class="topic-metadata">

**Author:** [@RandomHashTags](https://forums.swift.org/u/RandomHashTags)\
**Replies:** 5\
**Last updated:** [October 13, 2026, 6:59pm UTC](https://forums.swift.org/t/psa-swift-6-4-0-breaks-non-inlined-macros-from-reading-from-disk-on-linux/89862 "2026-10-13T18:59:51Z")

</div>

As the title states, I am observing my macros that read from disk to no longer work as expected on Linux using the 6.4.0 toolchain. However, they do work as expected if I inline the macro and when expanding it. Is this …

---

## [\[Preview\] Swift-Syntax Prebuilts for Macros](https://forums.swift.org/t/preview-swift-syntax-prebuilts-for-macros/80202)

<div class="topic-metadata">

**Author:** [@dschaefer2](https://forums.swift.org/u/dschaefer2)\
**Replies:** 152\
**Last updated:** [September 24, 2026, 11:55am UTC](https://forums.swift.org/t/preview-swift-syntax-prebuilts-for-macros/80202 "2026-09-24T11:55:08Z")

</div>

The introduction of macros to Swift has given developers the ability to create more expressive libraries that can be distributed as a Swift package. Macros can greatly improve the developer ergonomics making Swift packag…

---

## [Exhaust: Cross-platform property-based testing, stateful testing and fuzzing](https://forums.swift.org/t/exhaust-cross-platform-property-based-testing-stateful-testing-and-fuzzing/89402)

<div class="topic-metadata">

**Author:** [@nesevis](https://forums.swift.org/u/nesevis)\
**Replies:** 0\
**Last updated:** [September 7, 2026, 7:04am UTC](https://forums.swift.org/t/exhaust-cross-platform-property-based-testing-stateful-testing-and-fuzzing/89402 "2026-09-07T07:04:36Z")

</div>

Exhaust is a feature-rich, macro-driven testing library that works with both Swift Testing and XCTest. Its aim is to empower you to test the values you didn't think of. It is the library I've wanted to have in Swift for…

---

## [Publishable - synchronous observation of Observable changes through Combine](https://forums.swift.org/t/publishable-synchronous-observation-of-observable-changes-through-combine/79924)

<div class="topic-metadata">

**Author:** [@NSFatalError](https://forums.swift.org/u/NSFatalError)\
**Replies:** 3\
**Last updated:** [September 6, 2026, 2:41pm UTC](https://forums.swift.org/t/publishable-synchronous-observation-of-observable-changes-through-combine/79924 "2026-09-06T14:41:25Z")

</div>

I'm excited to share with you the second package I'm releasing this week - Publishable Excerpts from README: What Problem Publishable Solves? With the introduction of SE-0475: Transactional Observation of Values, Swif…

---

## [SE-0539: Enable Macros to Grant \`self\` Access for Property Initializers](https://forums.swift.org/t/se-0539-enable-macros-to-grant-self-access-for-property-initializers/88713)

<div class="topic-metadata">

**Author:** [@allevato](https://forums.swift.org/u/allevato)\
**Replies:** 37\
**Last updated:** [August 24, 2026, 4:30pm UTC](https://forums.swift.org/t/se-0539-enable-macros-to-grant-self-access-for-property-initializers/88713 "2026-08-24T16:30:10Z")

</div>

Hello, Swift community! The review of SE-0539: Enable Macros to Grant self Access for Property Initializers begins now and runs through August 16th, 2026. Reviews are an important part of the Swift evolution process. A…

---

## [\[Returned for revision\] SE-0539: Enable Macros to Grant \`self\` Access for Property Initializers](https://forums.swift.org/t/returned-for-revision-se-0539-enable-macros-to-grant-self-access-for-property-initializers/89155)

<div class="topic-metadata">

**Author:** [@allevato](https://forums.swift.org/u/allevato)\
**Replies:** 0\
**Last updated:** [August 24, 2026, 4:29pm UTC](https://forums.swift.org/t/returned-for-revision-se-0539-enable-macros-to-grant-self-access-for-property-initializers/89155 "2026-08-24T16:29:37Z")

</div>

Hello, Swift community! The review of SE-0539: Enable Macros to Grant self Access for Property Initializers ended on August 16th, 2026. The Language Steering Group has decided to return this proposal for revision. The …

---

## [Swifty Memoization](https://forums.swift.org/t/swifty-memoization/75182)

<div class="topic-metadata">

**Author:** [@dannflor](https://forums.swift.org/u/dannflor)\
**Replies:** 3\
**Last updated:** [July 31, 2026, 6:50pm UTC](https://forums.swift.org/t/swifty-memoization/75182 "2026-07-31T18:50:18Z")

</div>

I write a lot of React in my day job (not by choice). Before I made my way to this job I was working on iOS and macOS apps in SwiftUI. Ever the good architects, we tried to minimize state that we needed to keep synchroni…

---

## [\[Pitch\] Lazy Accessor Macros](https://forums.swift.org/t/pitch-lazy-accessor-macros/87515)

<div class="topic-metadata">

**Author:** [@dohle](https://forums.swift.org/u/dohle)\
**Replies:** 10\
**Last updated:** [July 28, 2026, 11:06am UTC](https://forums.swift.org/t/pitch-lazy-accessor-macros/87515 "2026-07-28T11:06:11Z")

</div>

Hello, Swift Evolution! Initializer expressions on properties annotated with an accessor macro are subsumed from the original context. The macro is responsible for using the initializer expression in a new context, for …

---

## [@FunctionalProtocol – Zero-cost closure wrappers for SAM protocols](https://forums.swift.org/t/functionalprotocol-zero-cost-closure-wrappers-for-sam-protocols/88280)

<div class="topic-metadata">

**Author:** [@CodebyCR](https://forums.swift.org/u/CodebyCR)\
**Replies:** 2\
**Last updated:** [July 15, 2026, 6:57am UTC](https://forums.swift.org/t/functionalprotocol-zero-cost-closure-wrappers-for-sam-protocols/88280 "2026-07-15T06:57:03Z")

</div>

Hey Swift Community, Based on some other topics: FunctionalProtocols for Swift Anonymous Structs Merging Closure into Protocols I built a ⁠@FunctionalProtocol⁠ macro that generates zero-cost wrapper structur…

---

## [A full-blown "fourCharCode" macro example](https://forums.swift.org/t/a-full-blown-fourcharcode-macro-example/87932)

<div class="topic-metadata">

**Author:** [@CTMacUser](https://forums.swift.org/u/CTMacUser)\
**Replies:** 3\
**Last updated:** [July 3, 2026, 3:04pm UTC](https://forums.swift.org/t/a-full-blown-fourcharcode-macro-example/87932 "2026-07-03T15:04:35Z")

</div>

\[Not sure this is the right place.\] A year ago, I wrote a wrapper that converted strings to FourCharCodevalues at runtime. I later wondered if making a macro version was possible. The answer is yes, because the "Macros"…

---

## [Is it safe to use global variables while implementing macros?](https://forums.swift.org/t/is-it-safe-to-use-global-variables-while-implementing-macros/87936)

<div class="topic-metadata">

**Author:** [@atifdev10](https://forums.swift.org/u/atifdev10)\
**Replies:** 3\
**Last updated:** [July 3, 2026, 7:39am UTC](https://forums.swift.org/t/is-it-safe-to-use-global-variables-while-implementing-macros/87936 "2026-07-03T07:39:49Z")

</div>

I was getting bothered that I needed to give context as a parameter to every function that I implemented. But I got the idea of storing it in a global variable. But is it safe to do this? // Macros are not isolated to a…

---

## [Are string interpolations accepted during a macro?](https://forums.swift.org/t/are-string-interpolations-accepted-during-a-macro/87776)

<div class="topic-metadata">

**Author:** [@CTMacUser](https://forums.swift.org/u/CTMacUser)\
**Replies:** 2\
**Last updated:** [June 30, 2026, 6:19am UTC](https://forums.swift.org/t/are-string-interpolations-accepted-during-a-macro/87776 "2026-06-30T06:19:18Z")

</div>

Here's part of my expression macro code: guard let literal = node.arguments.first?.expression(StringLiteralExprSyntax.self) else { throw .notStringLiteral } guard let string = literal.rep…

---

## [Swift Macros: Build Time Overhead Concerns](https://forums.swift.org/t/swift-macros-build-time-overhead-concerns/70443)

<div class="topic-metadata">

**Author:** [@chiragramani](https://forums.swift.org/u/chiragramani)\
**Replies:** 20\
**Last updated:** [June 28, 2026, 7:25pm UTC](https://forums.swift.org/t/swift-macros-build-time-overhead-concerns/70443 "2026-06-28T19:25:02Z")

</div>

Hello Swift Community, I'm reaching out to share our team's recent experiences with the newly introduced Swift Macros feature, a promising addition we've been eagerly exploring. As part of our ongoing efforts to enhance…

---

## [What's the difference between SimpleStringLiteralExprSyntax and StringLiteralExprSyntax?](https://forums.swift.org/t/whats-the-difference-between-simplestringliteralexprsyntax-and-stringliteralexprsyntax/87721)

<div class="topic-metadata">

**Author:** [@CTMacUser](https://forums.swift.org/u/CTMacUser)\
**Replies:** 1\
**Last updated:** [June 27, 2026, 10:24pm UTC](https://forums.swift.org/t/whats-the-difference-between-simplestringliteralexprsyntax-and-stringliteralexprsyntax/87721 "2026-06-27T22:24:38Z")

</div>

The latter seems a lot more supported publicly than the former. What was its inspiration? What are their differences? Is the simple variant meant for general use? Or should we conditionalize string processing only with S…

---

## [Can a String read in escaped characters?](https://forums.swift.org/t/can-a-string-read-in-escaped-characters/87699)

<div class="topic-metadata">

**Author:** [@CTMacUser](https://forums.swift.org/u/CTMacUser)\
**Replies:** 1\
**Last updated:** [June 25, 2026, 10:28pm UTC](https://forums.swift.org/t/can-a-string-read-in-escaped-characters/87699 "2026-06-25T22:28:44Z")

</div>

I'm trying out macros. Discovered that reading in a string literal with an escaped character in it treats the backslash and code as separate units! Like a string with "\\0" in it will have its parsed form one character th…

---

## [Macro symbol visibility to other macros](https://forums.swift.org/t/macro-symbol-visibility-to-other-macros/87629)

<div class="topic-metadata">

**Author:** [@mbrandonw](https://forums.swift.org/u/mbrandonw)\
**Replies:** 0\
**Last updated:** [June 23, 2026, 1:50pm UTC](https://forums.swift.org/t/macro-symbol-visibility-to-other-macros/87629 "2026-06-23T13:50:57Z")

</div>

While working on this pitch for a new .taskLocal test trait, we butted heads with a limitation of Swift macros. Because @TaskLocal and @Test are both macros, something like this cannot work: @TaskLocal var isEnabled = f…

---

## [How do multiple "@"-style macros compose?](https://forums.swift.org/t/how-do-multiple-style-macros-compose/87463)

<div class="topic-metadata">

**Author:** [@CTMacUser](https://forums.swift.org/u/CTMacUser)\
**Replies:** 1\
**Last updated:** [June 17, 2026, 8:37pm UTC](https://forums.swift.org/t/how-do-multiple-style-macros-compose/87463 "2026-06-17T20:37:46Z")

</div>

I've seen many macro examples. For "#"-style macros, multiple macros either are in series or are nested, so interaction is easy to figure out. The "@"-style macros can do far more extensive things (like multi-line new st…

---

## [Object Parsing: turn natural language strings into Swift objects, declaratively](https://forums.swift.org/t/object-parsing-turn-natural-language-strings-into-swift-objects-declaratively/86759)

<div class="topic-metadata">

**Author:** [@zcohan](https://forums.swift.org/u/zcohan)\
**Replies:** 2\
**Last updated:** [June 12, 2026, 4:57pm UTC](https://forums.swift.org/t/object-parsing-turn-natural-language-strings-into-swift-objects-declaratively/86759 "2026-06-12T16:57:31Z")

</div>

I made a package that defines a @ParsableObject macro to let you parse strings into Swift objects declaratively: import ObjectParsing @ParsableObject struct SalesRecord { let quantity: Int let date: Date } let…

---

## [Accessor Macro With Lazy Initializer](https://forums.swift.org/t/accessor-macro-with-lazy-initializer/85259)

<div class="topic-metadata">

**Author:** [@dohle](https://forums.swift.org/u/dohle)\
**Replies:** 5\
**Last updated:** [June 7, 2026, 11:12pm UTC](https://forums.swift.org/t/accessor-macro-with-lazy-initializer/85259 "2026-06-07T23:12:35Z")

</div>

Hi there, I am trying to implement an accessor macro for a property. The initializer of the property depends on self to be fully initialized. Normally this does not work unless we make the property lazy. Once we add an …

---

## [Introducing SwiftMacrosKit and PermissionKit](https://forums.swift.org/t/introducing-swiftmacroskit-and-permissionkit/86925)

<div class="topic-metadata">

**Author:** [@Damu](https://forums.swift.org/u/Damu)\
**Replies:** 3\
**Last updated:** [May 29, 2026, 9:06am UTC](https://forums.swift.org/t/introducing-swiftmacroskit-and-permissionkit/86925 "2026-05-29T09:06:35Z")

</div>

I’ve recently open-sourced two Swift packages aimed at reducing boilerplate and improving developer ergonomics across Apple platforms. SwiftMacrosKit SwiftMacrosKit provides 100+ Swift macros across multiple categories…

---

## [TypeEraserGenerator: Extensive set of macros for creating type erasers for protocols](https://forums.swift.org/t/typeerasergenerator-extensive-set-of-macros-for-creating-type-erasers-for-protocols/86619)

<div class="topic-metadata">

**Author:** [@atifdev10](https://forums.swift.org/u/atifdev10)\
**Replies:** 0\
**Last updated:** [May 9, 2026, 7:25pm UTC](https://forums.swift.org/t/typeerasergenerator-extensive-set-of-macros-for-creating-type-erasers-for-protocols/86619 "2026-05-09T19:25:56Z")

</div>

Hello swifters, I have been working on an package named TypeEraserGenerator (I know, very creative naming) which has an extensive set of macros for generating type erasers for protocols. It has support for associated t…

---

## [\[Pitch\] First-Class Dependency Injection Support Using Macros and Attributes](https://forums.swift.org/t/pitch-first-class-dependency-injection-support-using-macros-and-attributes/85874)

<div class="topic-metadata">

**Author:** [@pramod-kumar-ios](https://forums.swift.org/u/pramod-kumar-ios)\
**Replies:** 0\
**Last updated:** [April 8, 2026, 7:09am UTC](https://forums.swift.org/t/pitch-first-class-dependency-injection-support-using-macros-and-attributes/85874 "2026-04-08T07:09:55Z")

</div>

Hello Swift community :waving\_hand: I’d like to propose first-class dependency injection support in Swift using macros and attributes. Summary This proposal introduces: @Inject for property injection @AutoInject for …

---

## [Crash with macros and Swift Testing](https://forums.swift.org/t/crash-with-macros-and-swift-testing/85370)

<div class="topic-metadata">

**Author:** [@sgerstacker](https://forums.swift.org/u/sgerstacker)\
**Replies:** 5\
**Last updated:** [March 25, 2026, 7:40pm UTC](https://forums.swift.org/t/crash-with-macros-and-swift-testing/85370 "2026-03-25T19:40:24Z")

</div>

I'm experiencing a crash in Swift Testing. I think it has to do with my own macros and @testable import conflicting. I have a package that defines a protocol (FooProtocol). I then have a series of macros that takes a st…

---

## [PipeKit: Runtime Control Plane for iOS Apps Using Swift Macros (Private Beta)](https://forums.swift.org/t/pipekit-runtime-control-plane-for-ios-apps-using-swift-macros-private-beta/85339)

<div class="topic-metadata">

**Author:** [@AlmoutasemNabil](https://forums.swift.org/u/AlmoutasemNabil)\
**Replies:** 1\
**Last updated:** [March 13, 2026, 11:55pm UTC](https://forums.swift.org/t/pipekit-runtime-control-plane-for-ios-apps-using-swift-macros-private-beta/85339 "2026-03-13T23:55:11Z")

</div>

Hi everyone, I've been building PipeKit, an iOS SDK that gives mobile teams runtime control over production apps; remote function execution, feature flags, and session replay, and I wanted to share it with the Swift com…

---

## [The future of serialization & deserialization APIs](https://forums.swift.org/t/the-future-of-serialization-deserialization-apis/78585)

<div class="topic-metadata">

**Author:** [@kperryua](https://forums.swift.org/u/kperryua)\
**Replies:** 177\
**Last updated:** [March 6, 2026, 7:19pm UTC](https://forums.swift.org/t/the-future-of-serialization-deserialization-apis/78585 "2026-03-06T19:19:44Z")

</div>

Hello Swift Community, I’m happy to announce that I've been hard at work planning a potential future for serialization & deserialization APIs in Swift. It's clear from community adoption and feedback that Codable has ha…

---

## [GSoC: Re-implement Swift Property Wrappers with Macros (Seeking Mentor Guidance)](https://forums.swift.org/t/gsoc-re-implement-swift-property-wrappers-with-macros-seeking-mentor-guidance/85005)

<div class="topic-metadata">

**Author:** [@Renishavaiya](https://forums.swift.org/u/Renishavaiya)\
**Replies:** 1\
**Last updated:** [February 26, 2026, 10:06pm UTC](https://forums.swift.org/t/gsoc-re-implement-swift-property-wrappers-with-macros-seeking-mentor-guidance/85005 "2026-02-26T22:06:25Z")

</div>

Hi everyone, I’m Renish, a recent M.S. Computer Science graduate from UT Arlington (Dec 2025), and I’m very interested in working on the “Re-implement property wrappers with macros” project for GSoC. I’ve been followin…

[Next page](https://forums.swift.org/tag/macros/400.md?match_all_tags=true&page=1&tags%5B%5D=macros)
