For those people who don’t know about SwiftUI, it is the latest shiny framework from apple which everyone is talking about. I have been trying it on and off for past 6 months. But now i feel the best way to learn it is to make an app using SwiftUI. I’ll update about my journey here. Stay tuned…

๐Ÿ“… Day 1: Jan 13, 2021

I started an app to track my expenses. It would be a simple app where i would add my expenses and see the total. The app is simple on my mind with few screens. It has already been months since i did anything in SwiftUI. I feel like i forgot all the basics ๐Ÿ˜€

List will have some padding when embedded inside NavigationView in ios 14. I needed to assign .listStyle(PlainListStyle()) modifier to remove that padding.

๐Ÿ“… Day 2: Feb 23, 2021

Wow it has been more than a months since i did some swiftUI. Life got in the way. I am continuing this project. Few screens are ready now. I am having delimma over using core data or realm. For now i’ve added Core Data but i am leaning towards realm. hmmm.. i’ll make my database layer loosely coupled so that i can swap db later on. Now i can CRUD expenses and show it in a list

๐Ÿ“… Day 3: Feb 24, 2021

Lets work on tags. I would like to tag my expenses so that i can categories each expenses and see total expenses per each category. Core data relationships would prove pretty useful here. My expense would have a relationship with tags and later on i fetch all the tags, get expenses per each tag and filter it by timestamp duration.

Picker is so weird. It only shows the selected value on the same view (i.e on right side), if the value in forEach and selection bindings are of same type.

Picker("Select Tag", selection: $currentSelection) {
    ForEach(["a","b","c"], id: \.self) { item in
        Text(item)
    }
}

// Here `$currentSelection` and `item` should be of same type i.e String

๐Ÿ“… Day 4: Feb 28, 2021

So the tag is ready now. Tags & Expenses are stored separately in coredata and linked using relationships. Worked on DatePicker today. To be honest i don’t like the new datepicker style. I’ll look into more ways to customize it. But atleast now you can create expense with tags and display it. It supports multiple tags too. Next work is fetching all expenses under particular tag.

Also created an script to deploy this blog automatically. Previously i was writing, then using hugo commands to generate a public html static sites, copying it to my public repo, pushing it. Now everything is automatic. I just write then its just about running one script deploy.sh.

๐Ÿ“… Day 5: March 1, 2021

Learned something new today. If you apply .font() modifier for the encapsulating view, it gets applied to all the children views. Here font gets applied to all the labels.

HStack {
    Label("\(scrum.attendees.count)", systemImage: "person.3")
    Spacer()
    Label("\(scrum.lengthInMinutes)", systemImage: "clock")
}
.font(.caption)

Presenting a Modal: I’ve been using .sheet() modifier to present a modal. But there is another modifier called fullScreenCover() which is used to present a screen which fully covers the presenting screen. .sheet() by default only partially covers the view below.

๐Ÿ“… Day 6: March 5, 2021

I always forget to update this blog daily. Maybe i should just write about my progress instead of tracking it per dates.. Learnt few more things today. Also found some design inspiration from dribbles. Onboarding page is ready and looks simple but beautiful. SwiftUI has some bugs where if i try to hide navigation bar in previous screen, my trailing bar items is not appearing on next screen. I was using List to display list of expenses but then i was facing issue customizing it like removing separator insets. Learned about LazyVStackand used that instead. Tags can be now added for each expense. I still need to support multiple tags per expense. … One thing that i love about SwiftUI is how easy it is to prototype any design. I wanted to see how Floating action button would look in my screen. Creating that circular floating action button with some shadow took about ~ 2 minutes. ๐Ÿคฏ

๐Ÿ“… May 28, 2021

Its been a long time since i wrote about my progress. I’ve made much more progress in this app & learned a lot of SwiftUI along the way. Although the pace is much much slower as i have full time job and at the end of the day, i’m too tired to code.

At first, i was just making this app to learn SwiftUI but now i’ve decided to publish it too. I finished the basic functionality, setup coredata backed layer, changed app design multiple time, implemented a dark mode, integrated revenuecat for in app purchases etc. I decided to go with coredata instead of realm. The reason was simple: Free cloudkit integration. (Though this part is still left to be implemented as i need to handle deduplication).

I don’t get much time to work on this these days so i’m not sure when the app would be ready. There are still few things left to do before publishing it. I’ve started using the app daily too.

There were some quirks in SwiftUI but working with SwiftUI has made the whole development process much much faster. That’s it for today โœŒ๏ธ