Manual `typealias` declarations enhance type safety for #code interpreters. To automate this process, the #SwiftMacro is necessary.

It's a bit disappointing that a simple solution doesn't work, even though it seemed so obvious to me. 馃槙

#Friday arrived faster than I thought! 馃帀

EDIT: I had to mark it as trusted

I'm trying to define and use my first Swift macro. I added the package to the client project. I type import and Xcode suggests OCHamcrestMacros.

But it complains, "No such module OCHamcrestMacros". What gives? I double-checked that I added the SPM dependency to the correct target. #Swift #SwiftMacro

New release of IdentifiedEnumCases Swift Macro!

Rename generated ID type to `CaseID` which is less likely to collide with existing code.

Use this Swift Macro to generate an ID type for your enum cases, so that you can refer to the enum case itself when they have associated values. Requires Swift 5.9

https://github.com/FullQueueDeveloper/IdentifiedEnumCases/releases/tag/0.3.0

#WWDC23 #WWDC #iOSDev #SwiftLang #SwiftMacro #SwiftDeveloper

Release Rename to `CaseID` 路 FullQueueDeveloper/IdentifiedEnumCases

Better matches the style of CaseIterable CaseID is less likely to collide than ID Thank you for the feedback!

GitHub
#SwiftMacro's sometimes work differently than you'd think because they really exist before the Swift is compiled. E.g. you might think that `#馃惍("1989")` and `#馃惍("19" + "89")` are the same, but they are not for macros which work on the AST, no expression evaluation happens!As an experiment, just to enable t... mastodon.social
#SwiftMacro's sometimes work differently than you'd think because they really exist before the Swift is compiled. E.g. you might think that `#馃惍("1989")` and `#馃惍("19" + "89")` are the same, but they are not for macros which work on the AST, no expression evaluation happens!
As an experiment, just to enable the former, I added an interpreter for just that specific case 馃槵
https://github.com/helje5/MacroCows/blob/main/Sources/MacroCowsMacros/StaticEvaluation.swift
MacroCows/StaticEvaluation.swift at main 路 helje5/MacroCows

A Swift macro plugin that expands Strings into ASCII Cows, right at compile time. - MacroCows/StaticEvaluation.swift at main 路 helje5/MacroCows

GitHub
I'm happy to announce my first #SwiftMacro package: MacroCows. It does something in very high demand, adding ASCII #cows to your #SwiftLang sourcecode. Happy moo'ing! https://github.com/helje5/MacroCows
GitHub - helje5/MacroCows: A Swift macro plugin that expands Strings into ASCII Cows, right at compile time.

A Swift macro plugin that expands Strings into ASCII Cows, right at compile time. - GitHub - helje5/MacroCows: A Swift macro plugin that expands Strings into ASCII Cows, right at compile time.

GitHub

Introducing `StaticMemberIterable` Swift Macro!

Confidently cover all static members in tests or in your UI. Like CaseIterable, this macro creates an array of all the static members of a type. This is useful when a type has a few instances of itself as static members.

https://github.com/FullQueueDeveloper/StaticMemberIterable

#WWDC #SwiftMacro #iOSDev #SwiftLang #SwiftDeveloper #WWDC23

GitHub - FullQueueDeveloper/StaticMemberIterable: Confidently iterate through static members with this Swift Macro

Confidently iterate through static members with this Swift Macro - GitHub - FullQueueDeveloper/StaticMemberIterable: Confidently iterate through static members with this Swift Macro

GitHub
I've used this approach for typesafety of record IDs in my own projects, usually by manually copy-pasting. Now with Swift Macros in Swift 5.9, it's going to be so much easier.
#WWDC #WWDC23 #SwiftMacro #iOSDev #SwiftLang #SwiftDev

When passing strings or integers as IDs, the compiler doesn't tell you if you accidentally used a person ID where a blog post ID. Now with the `UniquelyTypedID`, the compiler will not let you pass the ID of a different model.

And with the power of `ExpressibleByStringLiteral` and `ExpressibleByIntegerLiteral`, very little code will need to change.
#WWDC #WWDC23 #SwiftMacro #iOSDev #SwiftLang #SwiftDev

Introducing UniquelyTypedID, a new Swift Macro!

Use unique types for type-safety when passing IDs around.

Currently supports String, Int, & UUID. The default is UUID.

```swift
struct BlogPost {
@UniquelyTypedID(Int.self) let id: ID
let text: String
}
```

https://github.com/FullQueueDeveloper/UniquelyTypedID

#WWDC #WWDC23 #SwiftMacro #iOSDev #SwiftLang #SwiftDev

GitHub - FullQueueDeveloper/UniquelyTypedID: UniquelyTypedID Swift Macro

UniquelyTypedID Swift Macro. Contribute to FullQueueDeveloper/UniquelyTypedID development by creating an account on GitHub.

GitHub