Skip to content

A hand-curated list of Swift macros. Feel free to contribute!

License

Notifications You must be signed in to change notification settings

artemnovichkov/awesome-swift-macros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Awesome Swift Macros

A hand-curated list of Swift macros. Feel free to contribute!

WWDC23

Macros

// "Stringify" macro turns the expression into a string.
#stringify(x + y)

// "AddBlocker" complains about addition operations. We emit a warning
// so it doesn't block compilation.
#addBlocker(x * y + z)

// "#URL" macro provides compile time checked URL construction. If the URL is
// malformed an error is emitted. Otherwise a non-optional URL is expanded.
#URL("https://swift.org/")
#powerAssert(max(a, b) == c)
             |   |  |  |  |
             7   4  7  |  12
                       false
  • Preview macro (Xcode 15+)
#Preview {
    Button("SwiftUI") {}
}
import SFSymbolsMacro
import SwiftUI

@SFSymbol
enum Symbols: String { ... }

Proposals

About

A hand-curated list of Swift macros. Feel free to contribute!

Topics

Resources

License

Stars

Watchers

Forks