Expense Tracker App – Code Kit Documentation

Hey there! This project contains the source code of the Expense tracker app. Feel free to use the code as a template for your own project, or to modify the source files as a way to experiment and further your learning.

Reading code written by other people is also one of the most important skills to learn as a developer. I hope that by reading this code, you improve your own understanding of Swift and SwiftUI.

This documentation contains a simple yet detailed explaination of the project, but should you have any questions regarding the code and stuff, please feel free to post it up on our forums.

Getting Started

To get started, open the .xcodeproj file in Xcode, and run the project (Cmd+R) in Simulator. This will allow you to experience the app first hand.

The app’s starting point is the app file, which should be ExpenseApp.swift. Most of the source code includes inline documentation to serve as your guide reading the code.

Scenes

Scenes are views that take up the entire screen, to show a specific content. In this code kit, all of the scenes can be found in the Scenes group, and there are 3 initial scenes included in this kit.

The scenes included are:

  1. Home View – The Home View is the starting scene of the app. Initially shows an empty view with an “Add Expense” button and if there are expenses to show, it’ll show it with a List
  2. Details View – The Details View is the scene that holds the form and input fields. This would show up when the user taps “Add Expense” button from the Home View or by selecting an expense to view its detail from the list of expenses.
  3. Sort Filter View – The Sort Filter View shows a sort filter selection on a sheet. The app has three sort filters available: (1) Date/Time which filters the list of expenses over a certain time period, (2) expense categories filter which would filter the list of expenses under a certain category, and (3) payment options filter which would filter expenses based on the payment method used.

More information about the scene are described in better detail as inline documentation comments in their respective SwiftUI files. Open the scene file in Xcode to learn more.

Getting Help

Should you have any questions about this code kit, feel free to post it up on our forums.

Copyright © 2023 CodeWithChris. All rights reserved.