Simplicity for your iOS Applications
Make it easy for yourself
What’s the problem
There are many issues in the world of programming. The most tricky? Probably naming — it’s a huge problem.
Other issues? Introducing complexity into your Application that can make it tricky to maintain, read or understand.
This article will go through some of the common issues! If you’ve problems with blogs keeping things simple, watch the YouTube version!
Use the simplest method to store data and model behaviour
Apple have a document that makes this clear. Choose struct
by default over class
types because:
Using structures makes it easier to reason about a portion of your code
So, you might have a discussion about value and referent types, but you know, default to struct
in any case.
Can I make it simpler?
enums
on the other hand groups several pieces of data together. I’ve recommended using these to store constants since they’re a value type (with no inheritance), designed to be a list of different options that can be selected. They aren’t designed to be used instead of classes…