So the below code was working no issues, but has started to play up.
The error I am getting is Cannot convert value of type 'Foundation.Data' to specified type 'vscroll.Data' & Cannot convert value of type 'vscroll.Data' to expected argument type 'Foundation.Data'
func getPodCastPlayerNP(completion: @escaping (NowPlayingData) -> ()) {
// Timer.scheduledTimer(withTimeInterval: 15, repeats: true) { (timer) in
let songdata = "{\"id\": \"1\",\"song\": \"\(MusicPlayer.song)\",\"artist\": \"\(MusicPlayer.artist)\", \"cover\": \"\(MusicPlayer.cover)\"}"
let data: Data = songdata.data(using: .utf8)!
let podcast = try! JSONDecoder().decode(NowPlayingData.self, from: data!)
//print(data!)
// let episode = podcast.programs
DispatchQueue.main.async{
// The array is stored under programs now
//print(podcast)
completion(podcast)
}
// }
}
the two lines are
let data: Data = songdata.data(using: .utf8)!
let podcast = try! JSONDecoder().decode(NowPlayingData.self, from: data!)
Would anyone have a solution to fix this please. It was working up to an hour ago.