How to resolve the "Declaration name is not covered by macro" error

In XCode, open your Swift Macro and in the Macro definition, set the names to "arbitrary".

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 08/16/2024 at 13:11
Last Updated on 08/16/2024 at 13:49
<p>Two flowers that represents SwiftUI and XCode side by side with the text “Declaration name is not covered by macro error” beneath it.</p>

In XCode, open your Swift Macro and in the Macro definition, set the names to "arbitrary".

SubscribeDownload Open Source SwiftUI Starter Project
<p>A screenshot of the error that XCode produces informing you that Declaration name "sample" is not covered by macro.</p>

To resolve the error above, open the macro and navigate to the definition.

<p>A screenshot of XCode showing a declaration for a member macro. The names are defined using "named(init))".</p>

Replace names: named(init) with names: arbitrary.

<p>A screenshot of XCode showing a declaration for a member macro. The names are defined using "arbitrary".</p>

This will resolve your issue.

<p>A screenshot of Xcode showing how the issue has been resolved.</p>

Looking to learn more about SwiftUI, Swift, Design and Technology?

Search our blog to learn more about Swift, SwiftUI, design and technology.

Search our Blog

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe