Learn Courses My Dashboard

Andrew's Journey to Release an app

Day 15 - Started M5L4 - Filtering Core Data

Tuesday, January 11, 2022

Today, I learned how to sort and filter core data. Much simpler than I would have thought!

You can’t beat the way Chris explains these concepts… I would love to find a similar course-set for Kotlin or how to develop Android apps.

This piece of code sorts the people by age as well as filters only for users named Joe:

@FetchRequest(sortDescriptors: [
    NSSortDescriptor(key: "name", ascending: true), // Sort by name first
    NSSortDescriptor(key: "age", ascending: true)  // Then sort by age
], predicate: NSPredicate(format: "name contains 'Joe'"))
var people: FetchedResults<Person>

See Apple’s docs for more details on how to use predicates to filter the data: Apple Developer Documentation

Day 16 - Finished M5L4/ Started M5L5 - Filtered Data & Entity Relationships

Wednesday, January 12, 2022

Today, I learned how to better search/ filter data through requests to the Core Data model. In particular, I was impressed by the .onChange modifier. This modifier, allows you to run a piece of code as soon as one of your binding variables change. So as soon as the person types a character, it searches for all Core Data person values that match.

//  Whenever the filterByText value changes, it will retrieve the data from the database
.onChange(of: filterByText) { newValue in
    // Fetches core data
    fetchData()
}

I also learned about relationships between entities. The terms graph data still confuse me that Chris mentions, but this will make more sense with time.

Day 17 - Finished Module 5 Core Data

Thursday, January 13, 2022

I was happy to finish the last Core Data lesson! It’s easier than I thought to save information locally. Honestly, I wish I had learned this prior to all of the Firebase stuff. Still, there were some confusing components to it like the viewContext that must be used in order to access the Core Data. I’d love to see this code combined with that with Firebase or other things.

Also, I was dissapointed, but it seems like both this module and the one before it, lack wrap-up challenges. Those reinforce the concepts the most for me, and ensure I learn it. Therefore, I will likely create my own demo project to try out many of the concepts in this.

1 Like

Day 18 - Created First Apple Watch app

Saturday, January 15, 2022

Today, I finished my first Apple Watch app! I went through the Apple tutorial thanks to @mikaelacaron found here: Apple Developer Documentation. Highly recommend others to try this, if your curious at all about building a watchOS app! It’s much easier than you might think, and you can likely build it for many of your iOS apps right away.

See my repo here for the completed app/ screenshots: GitHub - agholson/Landmarks-Apple-Watch-app. Or this thread about the subject as well: Apple Watch App?.

2 Likes

CONGRATS! That’s awesome! I’ve always wanted to make a watch app, so I’ll add that to my to-do list too!

1 Like

Hey thanks @Philomath!!

Yeah, absolutely, it was a little daunting at first. I almost gave up after getting stuck on a simple problem for 20 minutes (how to open Apple’s demo code), but am glad I pushed through. It seems like any iOS app could also have a simple watchOS companion app as well with a little more effort! Let me know, when you give it a shot

Day 19 - Created Challenge for Core Data Concepts

Sunday, January 16, 2022

I was disappointed to not find any challenges for modules four and five in the iOS databases course. Therefore, at least for the Module five all about Core Data, I created my own challenge based on the unusual trade of buying un-delivered packages/ pallets, or lost baggage. I plan to post the challenge/ also the solution here:

Day 20 - MVVM in Core Data

Monday, January 17, 2021

After many hours, and some confusion, I got a working Model View View-Model (MVVM) app with Core Data. I like this pattern of working with Core Data better in contrast to passing in the viewContext as an environment object to the Views. Apple’s docs and Chris’s videos teach this way, but I prefer the way described by Matt Righetti here: SwiftUI and Core Data: The MVVM Way | by Mattia Righetti | Better Programming

I plan to finish this app, then go onto the next lesson/ module in the iOS Databases course. Once again, I find that I learn the most through challenges, and this one was no exception.

I’m thrilled with the progress I’ve achieved in Swift. I can write my own code, and most importantly debug it. It was such a challenge to get here. I’m so grateful for this platform, the staff at CWC+, and the community that taught me so much! This is perfect for learning a new language, and wish similar ones existed for many other languages as well.