When I try to create a new macro using Xcode, I couldn't see an option to select Swift Testing
Steps followed:
In Xcode, New Package > Macro (template)
Testing System drop down has only XCTest and no Swift Testing
However choosing a different template shows the option to select XCTest and Swift Testing
Questions
Is macro testing possible using Swift Testing?
1.1. If it is possible how do I use Swift Testing for macro?
1.2. If it is possible, would it make sense to add Swift Testing to the drop down?
Is creating macro even possible without creating a Swift Package?
Pardon my ignorance I am just starting to explore Swift macro.
Thanks a lot @soumyamahunt for the detailed response, was very helpful.
Changes for using Swift Testing
Edit the Test file
Change import XCTest to import Testing
Change final class MyMacroTests: XCTest to struct MyMacroTests
Annotate the test functions with @Test
It seems so obvious now :D but I completely missed it
Reason for asking about not using SPM
Reason for asking if macros was possible if Swift macros was possible without SPM was because I was wondering if I can create a macro in my main project without a separate swift package.
As I type I realise that I have to add a dependency to swift-syntax and its best to keep this dependency isolated and its nicer to have the macro in the swift package so that it is tested inside the package and neatly isolated away from the rest of the project.
Thanks a lot for writing the blog post, though I wouldn't be using it with cocoapods it definitely gives a perspective on the dependencies.