-1

is there a way using system sound like Apple calculator app

@IBAction func button(_ sender: UIButton) {

}

help appreciated

believe have some different I mean using system sound the question posted is focus on using url sound

jin
  • 57
  • 1
  • 9

1 Answers1

1

You can use the AudioToolbox framework. Example usage (making the device vibrate):

import AudioToolbox.AudioServices

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)

Full documentation: https://developer.apple.com/documentation/audiotoolbox

To try out another constants, see this: https://developer.apple.com/documentation/audiotoolbox/system_sound_services/1618202-alert_sound_identifiers

or just command+click on the constant kSystemSoundID_Vibrate to see other constants.

Glenn Posadas
  • 12,555
  • 6
  • 54
  • 95