Pomodoro App – Code Kit Documentation

Hey there! This project contains the source code of the pomodoro 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.

Folder and File Structure

File organization is one of the most important aspects of a project, as it would affect how developers locate and navigate files during development. This is mostly beneficial to projects that involve multiple developers.

How it affects your projects

File organization affects two factors of your project:

  1. Scalability – the ability to scale your app from small to large over time, and/or vice versa. High scalability means it would be easier to add or to remove files from your project.
  2. Maintainability – the ability for developers who were not original contributors to read, work, or contribute to your project. This is very important for projects that involve a team or teams of developers. High maintainability means it’s easy to onboard new developers to this project, without or with lessen efforts from active contributors.

File organization schemes

The most common organization schemes for organizing project files are:

  1. Grouping by type – Files are grouped by type: Views, ViewModels, Models (MVVM projects), Services, Assets, and so on…
  2. Grouping by feature – Files are grouped by feature: Splash, Login, Registration, Home feed, Profile, Settings…

Screen Shot 2022-07-03 at 10 59 49 PM

On this project, files are organized by Group type scheme:

  1. Files that are shared among different features, such as a model, are grouped by type. In some projects, files that are shared among different features are called common files. Common files are ideally grouped by type as it would be easier to locate, and puts safety when removing files from an obsolete feature.

Using the grouping schemes indicated above, the layout structure should look like this:

Project (folder)

  -> Components (Grouped by type - Common view types that are shared across features)
    -> ViewModel
        -> PomodoroViewModel.swift
        
    -> View
        -> Main.swift
        -> ViewModifiers
           -> ClockView.swift
           -> TitleView.swift
           -> ClockButtonView.swift
           -> SelectableTextView.swift

   -> Helper Files
      -> Constants.swift
      -> SessionStore

   -> Assets
      -> Google-Info.plist
      -> Info.plist
      -> Assets.xcassets

To check more on how the project is organized, I suggest that you open up the project, and open the project navigator by pressing Cmd+1 in Xcode.

Copyright © 2022 CodeWithChris. All rights reserved.