I am exploring the usage of Swift Macro in my CocoaPods-integrated project. I have successfully created a custom macro by following the instructions, and it functions properly in the host project. However, in the Pods
project, I am unable to import CustomMacro
for all the frameworks and development pods.
At this point, I am curious if there is a workaround that supports both CocoaPods and Swift Package Macro.
And also I found a Github thread discussing about a similiar topic: https://github.com/CocoaPods/CocoaPods/issues/11942 , but there's no further conclusion.
So please help to give some advises about how to use Swift Macro in CocoaPods project if you have any experience.
If you want to distribute your macro library with CocoaPods, you have to build the macro target as an executable and provide that to the app/user target as:
-load-plugin-executable # Path to an executable compiler plugins and providing module names such as macros
I have written a step-by-step detailed article on this here. You can also see this in action as part of my MetaCodable library.