Pump up the volume! Control volume for audio on iOS using Swift

In most circumstances, you’ll want audio playback to use the volume settings on the device – users are typically not going to be happy if they turn down their volume, then hear something loud. But occasionally there may be a need to override the device settings – say an important alarm. We wouldn’t want to use this for sustained playback, but we recently wrote a function to play a specified sound, and optionally override volume to a specified level – 0 being silent and 1.0 being full-blast.

Evan is an experienced and accredited solution designer and developer with over 19 years of software systems delivery experience. Passionate about delivering elegant experiences, Evan’s expertise lies designing and developing iOS and Android native Apps, mobile and responsive web sites, and cross-platform hybrid applications. Evan is a Professional Scrum Master and certified in User Experience (UX) by the Nielsen Norman Group (NN/g).