AppleMusicKit icon indicating copy to clipboard operation
AppleMusicKit copied to clipboard

How to read results with fetcher

Open alexyak opened this issue 4 years ago • 0 comments

I can't figure out how to read the results that I get using framework's fetcher. For example:

public func GetMyRecomendations(_ result: @escaping ([MusicItem]) -> Void) { let authorization = Authorization(developerToken: token, musicUserToken: authorizationManager.userToken) let task = build(GetRecentlyPlayed(language: "en"), authorization: authorization, using: fetcher) { response in do { let response = try response let result = try response.get() for item in result.data { let resource = item as AnyResource // How do I get the values for href, id or name here?

            }
            
        } catch {
            print(error)
        }
    }
    
    task?.resume()
}

alexyak avatar Jan 17 '20 22:01 alexyak