Post

Replies

Boosts

Views

Activity

Reply to Swift UI on iOS 14 not assigning new object to @State property
FYI same issue still in xcode 13.4.1 - if it matters im presenting a sheet and the argument for that sheet is an object, which was initialized as a state object but empty. So i had it to default to a sample version of that object if the state object was nil (which it officially starts as), i even thought it was a racing issue since it was basically responding to a list item tap (so in the on tap gesture), i would set the value of that state object, then call the sheet, and in that i was printing the value of the object, it was accurate, but for whatever reason when the sheet took it it was nil so default kicked in, but if i tap on any other list item it works fine, so like the initial tap keeps it nil then it works, super weird. the workaround from @Theohhno works well but still bizarre, fyi im not a full blown dev just do enough to get by so may be missing something but either way thanks for the workaround
Aug ’22