GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

Alternate Solution to Codable/Observable Incompatibility

Forums > SwiftUI

Paul provided the correct "pre Apple fixing their own problem" fix to this problem but I have many fields and I am lazy so decided to try an alternate solution.

-- I made a new (codable) struct mimicing the salient portion of the (observable/published) class and separated the concerns. --

It was fairly easy to create and (for me) less worry for maintenance. That "less worry" statement might come back to nibble at me but it works nicely : ). Yes, it is inefficient, but for small datasets does not cause a performance issue and saves some coding time. Apple needs to make this problem and kuldge disappear.

3      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's all new Paywall Editor allow you to remotely configure your paywall view without any code changes or app updates.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.