Guest User

Untitled

a guest
Jun 23rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. func initialize(_ token: String, secret: String) {
  2. FMAudioPlayer.setClientToken(token, secret: secret)
  3. }
  4.  
  5. func requestStations(stationsCallback: (Stations) -> ()) {
  6. FMAudioPlayer.shared().whenAvailable({
  7. guard let stations = FMAudioPlayer.shared().getAllStations(options: [:]) else {
  8. // throw error
  9. return
  10. }
  11.  
  12. let stationInfo = stations.map {
  13. ["name": $0.name,
  14. "identifier": $0.identifier]
  15. }
  16.  
  17. stationsCallback(stationInfo)
  18. }) {
  19. // throw error
  20. }
  21. }
Add Comment
Please, Sign In to add comment