Practical coding

You may have come across a list of system sounds available in Swift 5, like this one. These can be used in your app, and are very convenient! They include standard notifications like MailReceived ,SMSSent (tweet sound) and other common sounds.

The sounds typically all mix:

  • Sound AND
  • Vibration

Let’s see how to play them:

Simple! If you want to play just the sound without the vibration, note that they are located here:

"/System/Library/Audio/UISounds/NAME.caf"

https://gist.github.com/smrfeld/a5235e905463e059aba637adbc6fd364

I first tried the following:

However, I found that the sound was very quiet. Ultimately AudioServicesPlaySystemSound isn’t the best way to play a sound. Instead: use this:

Which plays the sound without vibration, nice and loud, as expected!

--

--

Practical coding

Practical coding and machine learning publications that fill in the gaps

Connect with Practical coding

Sign up for practical coding

By Practical coding

Practical articles on coding & AI Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Medium sent you an email at to complete your subscription.