# Can you conditionally apply a macro?

**URL:** <https://forums.swift.org/t/can-you-conditionally-apply-a-macro/66344>\
**Category:** Using Swift\
**Tags:** macros\
**Created:** [July 25, 2023, 12:26am UTC](https://forums.swift.org/t/can-you-conditionally-apply-a-macro/66344 "2023-07-25T00:26:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon9791410](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@anon9791410](https://forums.swift.org/u/anon9791410)\
**Post date:** [July 25, 2023, 12:26am UTC](https://forums.swift.org/t/can-you-conditionally-apply-a-macro/66344/1 "2023-07-25T00:26:18Z")

</div>

E.g. let's say [you want a linked list to be a `Model`, but only when its `Element` is a `Model`](https://forums.swift.org/t/why-does-a-swiftdata-model-allow-array-how-do-you-really-store-one/66257).

I don't think a `where` clause can accomplish this. Can it? If not, what would you do instead? Normally I might nest something within an offending type, to section it off, but you can't do that with a macro either.
