Re-Exposing a declaration with macros

I am using a func that is coming in as mutating func SetPosition(_ x: Double, _ y: Double, _ z: Double) -> scad.Key

I want to expose swifty version like so
mutating func setPosition(x: Double, y: Double, z: Double)

Is this possible using macros?

I can do it manually something like but I am hoping I can just apply a macro and I can do it across many other functions

extension MyType {
mutating func setPosition(x: Double, y: Double, z: Double)  {
   this.SetPosition(x,y,z)
}


} 

Yes, that’s possible with macros. Have a look into extension and/or member macros. Both allow you to add methods to existing declarations.

However, you need to have access to the declaration defining the SetPosition function. The macro needs to be attached to it.

If you're using an extension macro, you may run into the issue where the contents of the extension will be effectively fileprivate.

I have access to it but that declaration is in a cpp header file (not swift). In effect I want to change the behavior of the swift versions of the cpp declarations by using macros.

Well, I don’t see a way to extend this type with the help of macros then. Macros exclusively work on the syntax of the declaration they are attached to. Your methods are declared in a C++ header file, though. So there is no way for any macro to access them.