Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func initialize(_ token: String, secret: String) {
- FMAudioPlayer.setClientToken(token, secret: secret)
- }
- func requestStations(stationsCallback: (Stations) -> ()) {
- FMAudioPlayer.shared().whenAvailable({
- guard let stations = FMAudioPlayer.shared().getAllStations(options: [:]) else {
- // throw error
- return
- }
- let stationInfo = stations.map {
- ["name": $0.name,
- "identifier": $0.identifier]
- }
- stationsCallback(stationInfo)
- }) {
- // throw error
- }
- }
Add Comment
Please, Sign In to add comment