externalMacro(module:type:)
Specifies the module and type name for a macro’s implementation.
Declaration
@freestanding(expression) macro externalMacro<T>(module: String, type: String) -> TParameters
- module:
The module name.
- type:
The type that implements the macro.
Return Value
The macro’s implementation.
Overview
This macro can only be used to define a macro; using it in any other context is an error. The specified type must conform to the protocols that correspond to the roles of the macro being declared. For example:
macro stringify(_ value: T) -> (T, String) =
#externalMacro(module: "ExampleMacros", type: "StringifyMacro")