# Swift Macros: Understanding Freestanding & Attached Macros

DevFeed: [Swift Macros: Understanding Freestanding & Attached Macros](<https://devfeed.tech/articles/swift-macros-understanding-freestanding-attached-macros-23994.md>)

Original publisher: [Read original article](<https://quickbirdstudios.com/blog/swift-macros/>)

Author: Paul Kraft

Published: 2024-02-19T15:34:28Z

Content type: tutorial

Language: en

Sources: [QuickBird Studios Blog](<https://devfeed.tech/sources/quickbird-studios-blog.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [Code generation](<https://devfeed.tech/topics/code-generation.md>), [Boilerplate](<https://devfeed.tech/topics/boilerplate.md>), [SwiftUI](<https://devfeed.tech/topics/swiftui.md>)

Tags: [code-generation](<https://devfeed.tech/tags/code-generation.md>), [examples](<https://devfeed.tech/tags/examples.md>), [feature](<https://devfeed.tech/tags/feature.md>), [generate](<https://devfeed.tech/tags/generate.md>), [ios](<https://devfeed.tech/tags/ios.md>), [post](<https://devfeed.tech/tags/post.md>), [swift](<https://devfeed.tech/tags/swift.md>)

## AI overview

This tutorial explains Swift macros, including freestanding and attached macros. It describes how macros generate code at compile time and can reduce boilerplate, simplify API usage, and detect some errors before compilation.

## Source excerpt

Swift Macros are here to simplify your code! This new feature lets you generate code at compile time, reducing boilerplate, saving you time, and making your projects cleaner. We take a look at freestanding and attached macros and take a look at some examples. The post Swift Macros: Understanding Freestanding & Attached Macros appeared first on QuickBird Studios.