# Why SwiftUI @State property can be initialized inside \`init\` this OTHER way:

**URL:** <https://forums.swift.org/t/why-swiftui-state-property-can-be-initialized-inside-init-this-other-way/62772>\
**Category:** Using Swift\
**Created:** [January 24, 2023, 5:50pm UTC](https://forums.swift.org/t/why-swiftui-state-property-can-be-initialized-inside-init-this-other-way/62772 "2023-01-24T17:50:52Z")\
**Posts on this page:** 1\
**Showing post:** 31

<div class="post-metadata">

**Author:** ![young](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/young/32/7878_2.png) [@young](https://forums.swift.org/u/young)\
**Post date:** [January 27, 2023, 1:25am UTC](https://forums.swift.org/t/why-swiftui-state-property-can-be-initialized-inside-init-this-other-way/62772/31 "2023-01-27T01:25:38Z")

</div>

That’s because the T? @State var sometimes are not auto initialized to nil and so later inside init the var can be assigned and you are saying this should be an init. Either ways, something odd is happening that allow a T? to init,table inside init. This should be allowed and you should use Optional as type.

See [SwiftUI @State PW exact same code different result if another optional is added!? :=( - #11 by young](https://forums.swift.org/t/swiftui-state-pw-exact-same-code-different-result-if-another-optional-is-added/62789/11)

---

_[View the full topic](https://forums.swift.org/t/why-swiftui-state-property-can-be-initialized-inside-init-this-other-way/62772)._
