# How is SwiftUI entry macro possible?

**URL:** <https://forums.swift.org/t/how-is-swiftui-entry-macro-possible/74018>\
**Category:** Macros\
**Created:** [August 18, 2024, 11:05am UTC](https://forums.swift.org/t/how-is-swiftui-entry-macro-possible/74018 "2024-08-18T11:05:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yapryntsev](https://avatars.discourse-cdn.com/v4/letter/y/3ec8ea/32.png) [@yapryntsev](https://forums.swift.org/u/yapryntsev)\
**Post date:** [August 18, 2024, 11:05am UTC](https://forums.swift.org/t/how-is-swiftui-entry-macro-possible/74018/1 "2024-08-18T11:05:22Z")

</div>

Hey everyone! Since the computed property requires explicit type annotation, how is the code produced by SwiftUI Entry macro valid? The result from macro expansion written by hand gets a compiler error.

---

<div class="post-metadata">

**Author:** ![KeithBauerANZ](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/keithbaueranz/32/27897_2.png) [@KeithBauerANZ](https://forums.swift.org/u/KeithBauerANZ)\
**Post date:** [August 19, 2024, 12:06am UTC](https://forums.swift.org/t/how-is-swiftui-entry-macro-possible/74018/2 "2024-08-19T00:06:42Z")

</div>

There's a special case in macros (which really should be documented somewhere) that the compiler will determine the type of the property from the initializer, even if a macro turns the property into a computed property, effectively erasing the initializer.

---

<div class="post-metadata">

**Author:** ![yapryntsev](https://avatars.discourse-cdn.com/v4/letter/y/3ec8ea/32.png) [@yapryntsev](https://forums.swift.org/u/yapryntsev)\
**Post date:** [August 19, 2024, 6:08am UTC](https://forums.swift.org/t/how-is-swiftui-entry-macro-possible/74018/3 "2024-08-19T06:08:53Z")

</div>

Got it, thanks for the explanation!
