© 2021 Charles Pisciotta
A sample UIKit (iOS) app that allows a user to simply play locally stored audio files using AudioKit.
This project was put together for my interview with SoundMind before joining as an iOS Developer. The initial project requirements, some basic files, assets, and project skeleton were written and/or provided by SoundMind (Jack Zimmer and Jason Silberman). On receiving the project, I implemented all of the necessary files (i.e. audio playback, navigation, asset management, etc.), restructured the project, and added assets (i.e. the app icon and cover images for sounds).
This sample app displays a list of audio files that are stored locally. The home screen is a simple UITableViewController that lists the audio files as SoundTableViewCell
s. Each cell contains the name of the audio file and a PlayingIndicator
. The latter is highlighted when currently playing and, at any given time, only one indicator can be highlighted as only one file can play at once. At the start, no audio plays, so all indicators start unhighlighted and all remain unhighlighted when no audio is playing.
On click of a SoundTableViewCell
, a PlayerViewController
is displayed modally. The PlayerViewController
consists of the following UI elements: a background image consistent with the audio file, a large title at the top displaying the name of the audio file, and a button at the bottom allowing the user to play and pause the sound. When that specific audio file is playing, the button shows a pause icon; when that specific audio file is not playing, the button shows a play icon. Note, if an audio file is playing, only the modal view controller of that audio file will toggle the default button icon.
- View locally stored audio files in a table view and determine which, if any, file is currently playing via the
PlayingIndicator
. - Play and pause audio files on click of a table view cell via a modally displayed
PlayerViewController
.
On startup and when playing audio, the following errors print to the console:
AddInstanceForFactory: No factory registered for id
AURemoteIO.h:323:entry: Unable to join I/O thread to workgroup ((null)): 2
This error was reported issue on GitHub and can be found here. It appears that this issue relates to using the simulator and might be unavoidable.
Understanding
- Read the instructions to understand the scope of the problem, the features that need to be implemented, and any development constraints.
- Review the prewritten code to understand the structure of the codebase, the assets included, the technologies used, and the features that need to be implemented.
- Read the documentation for
AudioKit
to understand the basic use of the framework.
Design Preparation
- Create a basic sketch of what the sample detail view will look like when completed.
Development
- Create a model to hold the Audio File data. This includes the name of the file, the name of the image, and any other metadata.
- Develop the
SoundTableViewCell
to display a preview of the audio files. - Develop the
PlayerViewController
to display a detailed view of the audio file, including its cover image, and to allow play/pause functionality. - Complete the play and pause functions in
CPAudioPlayer
to allow for proper audio playback using AudioKit. This includes enabling playing in the background.
Testing
- Develop now, and throughout the process, unit tests to ensure that the code is functioning properly. In this case, unit tests were set up to ensure that each audio file was successfully played and paused.
- Use the app and determine any remaining issues, bugs, or improvements.
Documentation and Clean Up
- Write now, and throughout the process, documentation to help for readability and understanding.
- Ensure that all existing code is written cleanly and efficiently.
Final Deliverable
- Send the finished prototype for review.
- iOS 14.0+
- Xcode 12.0+
Download or clone the project to Xcode. Run the code on the simulator or a physical device.
Charles Pisciotta – Freelance iOS Developer – cpisciottadeveloping@gmail.com