Sample iOS Project
This is the basic framework for a sample iOS project. The app will sort all of your photos by color.
Note: the actual sorting algorithm is missing from this code. That's just for me to know :)
Please be aware: this is just the very bare bones project framework for demo purposes only. There are still many improvements needed for this to be a true app.
Before | After |
---|---|
Not a huge difference, but the blues, reds, and yellows are grouped in the After image.
The main reason for building this demo app was to refresh my skills working with Interface Builder/Scenes. I primarily work with programatically defined interfaces in SwiftUI these days. So this was a good weekend refresher project.
If you would like to try it out, you'll need a few things first:
- a clone of this repo
xcodegen
for building the project and info.plist files- Xcode for building the app
Once you have everything you need, just:
- Open a terminal and
cd
into the repo directory
$ cd PhotoGamut
- Generate the project and info.plist files
$ xcodegen
- Open the project in Xcode
$ xed PhotoGamut.xcodeproj/
- Then just build and run!
You may find the app more interesting if your simulator has lots of photos on it. There are several ways to get photos into your simulator's photo library, but here's the method I found to be most useful.
Note
Make sure you have Xcode command line tools enabled before attempting step 3. (see below for more information)
- Put all the photos you want to add to your simulator into a folder.
- Launch the simulator you want to target (i.e. just run the app from Xcode).
- Run the following command:
$ xcrun simctl addmedia booted [YOUR_FOLDER_PATH]/*
.
If all goes well, your simulator should now have a lot of photos to play with!
To enable Xcode Command Line Tools, open XCode and go to Xcode -> Preferences... -> Locations, then select the available command line tools from the Command Line Tools: dropdown menu.