Playing with an idea

I’ve been thinking about the app I’d like to build, and using the little bit of knowledge I’ve gained from the first four days of the Learning with Swift UI course (I can never quite remember the exact name, but if you’re following along you’ll know what I’m talking about).

At it’s most basic I want to store birthdays and names in an app, then display them in a list, sorted by what’s coming soonest. That means I must be able to add names, sort, and do a bunch of things with them.

Using what I know of dictionaries, and sorting, I sketched out the logic that may work for the app. Dictionaries seem to be perfect, since they have a key and value, and can store a large amount of data. I can then sort them, remove, count them, etc.

I’m not sure if I have this right, but going off the simplest version of the screens I could imagine, here’s what I’m thinking.

Hopefully the next few days will help me learn if this is correct.  A quick check on ChatGPT suggests I may be overthinking this. It sounds like I could just do it as an array. The code:

struct Person {
    let name: String
    let birthday: Date

var people: [Person] = [
    Person(name: "John", birthday: johnsBirthdayDate),
    Person(name: "Jane", birthday: janesBirthdayDate),
    // Add more people as needed

A quick test in ChatGPT and Xcode tells me I have a lot to learn. I’m excited! I think I need to have dates and strings properly stored together, which likely can’t be in an array.


Great feedback from my friend, Luke Carbis. I’m going to try arrays (instead of dictionaries) so that I can just sort later by reverse chron, and see if I can the person in as a struct with the dates and names. I’m not 100% sure how I can do this, but I can almost see it in my head. Excited to come back to this tomorrow.