Photo Gallery App – Code Kit Documentation

A photo gallery written in SwiftUI that uses the PhotoKit framework for robust memory management.

Hey there! This project contains the source code of the Photo Gallery 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 PhotoGalleryApp.swift. Most of the source code includes inline documentation to serve as your guide reading the code.


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 Scene group, and there are 2 initial scenes included in this kit.

The scenes included are:

  1. PhotoLibraryView – The photo library view is the scene that shows a photo grid of all photos from the user library.
  2. PhotoDetailView – The photo detail view is the scene that will focus on a selected photo with pinch-to-zoom and panning gesture support.

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 © 2022 CodeWithChris. All rights reserved.