Play reminder sound SwiftUI

孤街醉人 提交于 2021-01-21 11:47:28

问题


I understand I can play a sound from my own library, like: How to play a sound using Swift?

But how can I use the already existing default Reminder Alerts sounds that iPhone has? Just to put it into context in a simple button press?

Thanks


回答1:


try this:

import AVFoundation

AudioServicesPlaySystemSound(1026)

where the number 1026 is the SystemSound id.



来源:https://stackoverflow.com/questions/61310578/play-reminder-sound-swiftui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!