I'm trying to create swift macros for initializer. I can't get the members of the inherited class.
How to get super class memberBlocks using Swift Macros?
I can't get the members of the inherited class.
That’s correct.
Macros work on the syntax tree. They don’t have access to type information. Consider this:
class Base {
var baseProperty: Int
}
class Sub: Base {
var subProperty: Int
}
If you apply a macro to Sub
, it only get the syntax tree derived from the last three lines. It does not get access to Base
and thus can’t know anything about baseProperty
.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"