TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

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 Blaze.

SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!

Reserve your 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.