revealapp / Revert

REVEal Rendering Test
revealapp.com
BSD 3-Clause "New" or "Revised" License
364 stars 28 forks source link

Use Decodable for `HomeItem` model class #59

Closed nabby26 closed 4 years ago

nabby26 commented 4 years ago

Context

The existing codebase in Revert is using custom protocol Collectable and struct CollectableGroup to decode data from the property list file into a model class that extends the protocol. This approach would require some maintenance work needed if the newer Swift version introduced and breaks the custom protocol and struct.

Fortunately, Swift Decodable API can easily decode data from property list file into a model class, as long as the model just extends Decodable and no extra configuration needed.

About this PR

This PR contains changes to replace HomeItem model class extension from Collectable to Decodable. The changes apply to both Revert iOS app and tvOS app.

Changes

What's next

nabby26 commented 4 years ago

Thanks for the feedback everyone! Got some valuable points here. I think for now I will just merge the code. Any issues for the name changing will be addressed on future PRs.

tonyarnold commented 4 years ago

Great work, Nabby! Thanks for the effort and time you put into this.