<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/swift-macros-at-scale-lb9v10har" -->

---
title: Swift Macros at scale | daily.dev
description: Swift Macros, introduced alongside Xcode 15, generate code via the compiler but significantly slow down build times because each macro must compile SwiftSyntax...
canonical: https://daily.dev/posts/swift-macros-at-scale-lb9v10har
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Swift Macros at scale | daily.dev
og:description: Swift Macros, introduced alongside Xcode 15, generate code via the compiler but significantly slow down build times because each macro must compile SwiftSyntax...
og:url: https://daily.dev/posts/swift-macros-at-scale-lb9v10har
og:image: https://api.daily.dev/og/posts/Lb9v10hAr.png
og:image:alt: Swift Macros at scale
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Swift Macros at scale

**[
      Tuist
    ](https://daily.dev/sources/tuist-blog)** · 6 min read · 0 upvotes · 0 comments

## Summary

Swift Macros, introduced alongside Xcode 15, generate code via the compiler but significantly slow down build times because each macro must compile SwiftSyntax and its ten-plus transitive dependencies. Benchmarks on a MacBook Air M2 show a clean release build of a fresh macro package taking roughly 196 seconds. The piece explores why this happens, including SwiftSyntax's lack of API/ABI stability, and outlines three potential fixes: making SwiftSyntax API/ABI stable, compiling macros to WebAssembly via WasmKit for cross-platform binary execution, and fingerprint-based binary caching. Tuist has already implemented binary caching for Swift Macros via its 'tuist cache' command to speed up local and CI builds.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://tuist.dev/blog/2024/08/26/swift-macros>

## Questions this post answers

### Why do Swift Macros make my build times so much slower?

Swift Macros require the compiler to build SwiftSyntax and its more than ten transitive dependencies, then statically link them into a binary executable for each macro. A clean release build of a freshly created macro package takes around 196 seconds on a MacBook Air M2 with 16GB RAM, and adding more macros compounds this cost further.

_daily.dev surfaces practical fixes like these for developers wrestling with slow Swift build pipelines._

### Can I use WebAssembly to speed up Swift Macro compilation?

Yes, this is a proposed approach discussed in the Swift community forums: compiling Swift Macros to .wasm binaries and running them via the WasmKit runtime instead of statically linking SwiftSyntax on every build. This would solve build slowness on Darwin, Windows, and Linux without requiring ABI stability changes, though it is not yet officially adopted by Apple.

_Developers tracking emerging Swift tooling proposals can follow discussions like this on daily.dev._

### How does Tuist cache Swift Macros to speed up Xcode builds?

Tuist extends its binary caching feature to Swift Macros, frameworks, and bundles by fingerprinting them so subsequent builds reuse previously generated binaries instead of recompiling. Running the command 'tuist cache' stores these binaries, and anyone on the team generating an Xcode project afterward benefits from the cached artifacts, avoiding the repeated cost of compiling SwiftSyntax dependencies.

_daily.dev helps teams comparing Swift build caching tools stay on top of tooling changes._

## Similar posts on daily.dev

- [Toss: Building less to ship faster](https://daily.dev/posts/toss-building-less-to-ship-faster-1arhtus0n) · 
      Tuist
     · 3 upvotes · 0 comments
- [Swift 6.4 Released](https://daily.dev/posts/swift-6-4-released-tm86auvxn) · Swift.org · 3 upvotes · 0 comments
- [Just a Few Keystrokes -- Fatbobman's Swift Weekly \#151](https://daily.dev/posts/just-a-few-keystrokes----fatbobman-s-swift-weekly-151-slajtgpn2) · Fatbobman · 0 upvotes · 0 comments

---

Tags: [#swift](https://daily.dev/tags/swift), [#webassembly](https://daily.dev/tags/webassembly)

[View this post on daily.dev](https://daily.dev/posts/swift-macros-at-scale-lb9v10har)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Swift Macros at scale","url":"https://daily.dev/posts/swift-macros-at-scale-lb9v10har","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/swift-macros-at-scale-lb9v10har"},"datePublished":"2026-08-23T12:23:50.443Z","dateModified":"2026-08-23T12:56:10.066Z","description":"Swift Macros, introduced alongside Xcode 15, generate code via the compiler but significantly slow down build times because each macro must compile SwiftSyntax...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/687497183a658f7cd3d04c8d95486cf4?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/687497183a658f7cd3d04c8d95486cf4?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"\n      Tuist\n    ","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"\n      Tuist\n    ","logo":"https://media.daily.dev/image/upload/s--3AYDH23h--/f_auto,q_auto/v1787487506/logos/tuist-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/tuist-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/swift-macros-at-scale-lb9v10har","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"swift,webassembly","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"\n      Tuist\n    ","item":"https://daily.dev/sources/tuist-blog"},{"@type":"ListItem","position":3,"name":"Swift Macros at scale"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/swift-macros-at-scale-lb9v10har#faq","mainEntity":[{"@type":"Question","name":"Why do Swift Macros make my build times so much slower?","acceptedAnswer":{"@type":"Answer","text":"Swift Macros require the compiler to build SwiftSyntax and its more than ten transitive dependencies, then statically link them into a binary executable for each macro. A clean release build of a freshly created macro package takes around 196 seconds on a MacBook Air M2 with 16GB RAM, and adding more macros compounds this cost further. daily.dev surfaces practical fixes like these for developers wrestling with slow Swift build pipelines."}},{"@type":"Question","name":"Can I use WebAssembly to speed up Swift Macro compilation?","acceptedAnswer":{"@type":"Answer","text":"Yes, this is a proposed approach discussed in the Swift community forums: compiling Swift Macros to .wasm binaries and running them via the WasmKit runtime instead of statically linking SwiftSyntax on every build. This would solve build slowness on Darwin, Windows, and Linux without requiring ABI stability changes, though it is not yet officially adopted by Apple. Developers tracking emerging Swift tooling proposals can follow discussions like this on daily.dev."}},{"@type":"Question","name":"How does Tuist cache Swift Macros to speed up Xcode builds?","acceptedAnswer":{"@type":"Answer","text":"Tuist extends its binary caching feature to Swift Macros, frameworks, and bundles by fingerprinting them so subsequent builds reuse previously generated binaries instead of recompiling. Running the command 'tuist cache' stores these binaries, and anyone on the team generating an Xcode project afterward benefits from the cached artifacts, avoiding the repeated cost of compiling SwiftSyntax dependencies. daily.dev helps teams comparing Swift build caching tools stay on top of tooling changes."}}]}
```

