SKArtist

public struct SKArtist : JSONDecodable

A Spotify artist.

See also

The Web API Simplified and Full Artist objects.
  • Known external URLs for this artist. See external URL object for more details.

    Declaration

    Swift

    public let externalURLs: [String : URL]
  • url

    A link to the Web API endpoint providing full details of the artist.

    Declaration

    Swift

    public let url: URL
  • id

    The Spotify ID for the artist.

    Declaration

    Swift

    public let id: String
  • The name of the artist.

    Declaration

    Swift

    public let name: String
  • uri

    The Spotify URI for the album.

    Declaration

    Swift

    public let uri: String
  • Information about the followers of the artist.

    Declaration

    Swift

    public let followers: SKFollowers?
  • A list of the genres the artist is associated with. For example: "Prog Rock", "Post-Grunge". (If not yet classified, the array is empty.)

    Declaration

    Swift

    public let genres: [String]?
  • Images of the artist in various sizes, widest first.

    Declaration

    Swift

    public let images: [SKImage]?
  • The popularity of the artist. The value will be between 0 and 100, with 100 being the most popular. The artist’s popularity is calculated from the popularity of all the artist’s tracks.

    Declaration

    Swift

    public let popularity: Int?
  • Creates and returns the request used to get the current artist’s albums.

    Declaration

    Swift

    public func makeAlbumsRequest(types: Set<SKAlbumType>, locale: Locale?, page: Pagination?) -> SKRequest

    Parameters

    types

    The types of albums by which to filter results. If no types are specified (i.e., parameter is set to an empty array), all album types will be returned. See SKAlbumType for possible values.

    locale

    The locale-specific storefront/market from which to request.

    page

    The parameters for paginating the results, specifying the index and number of items to return. If no parameters are supplied, the request will return the default number of items beginning with first item.

    Return Value

    An SKRequest instance with which to perform the API request.

  • Gets Spotify catalog information about the current artist’s albums.

    Note

    This method uses the SPTAuth default instance session to authenticate the underlying request. If this session does not contain a valid access token, the request will result in an error.

    Declaration

    Swift

    public func getAlbums(filteredBy types: Set<SKAlbumType> = [], for locale: Locale? = SKCatalog.local.locale, page: Pagination? = nil, completion handler: @escaping (Page<SKAlbum>?, Error?) -> Void)

    Parameters

    types

    The types of albums by which to filter results. If no types are specified, all album types will be returned. See SKAlbumType for possible values. The default value is an empty array.

    locale

    The locale-specific storefront/market from which to request. The default value is the locale for the shared SKCatalog instance, which by default represents the user’s region settings at the time the method is called.

    page

    The parameters for paginating the results, specifying the index and number of items to return. If no parameters are supplied, the request will return the default number of items beginning with first item. The default value is nil.

    handler

    The callback handler for the request. The parameters for this handler are:

    • albums: A paginated collection of simplified albums, if available.
    • error: An error identifying if and why the request failed, or nil if the request was successful.

  • Creates and returns the request used to get the current artist’s top tracks.

    Declaration

    Swift

    public func makeTopTracksRequest(locale: Locale) -> SKRequest

    Parameters

    locale

    The locale-specific storefront/market from which to request.

    Note: The locale must contain a valid region code.

    Return Value

    An SKRequest instance with which to perform the API request.

  • Gets Spotify catalog information about the current artist’s top tracks.

    Note

    This method uses the SPTAuth default instance session to authenticate the underlying request. If this session does not contain a valid access token, the request will result in an error.

    Declaration

    Swift

    public func getTopTracks(for locale: Locale = SKCatalog.local.locale!, completion handler: @escaping ([SKTrack]?, Error?) -> Void)

    Parameters

    locale

    The locale-specific storefront/market from which to request. The default value is the locale for the shared SKCatalog instance, which by default represents the user’s region settings at the time the method is called.

    handler

    The callback handler for the request. The parameters for this handler are:

    • tracks: An array returned by the request of up to 10 top tracks, if available.
    • error: An error identifying if and why the request failed, or nil if the request was successful.

  • Creates and returns the request used to get a list of artists similar to the current artist.

    Declaration

    Swift

    public func makeRelatedArtistsRequest() -> SKRequest

    Return Value

    An SKRequest instance with which to perform the API request.

  • Gets Spotify catalog information about artists similar to the current artist.

    Similarity is based on analysis of the Spotify community’s listening history.

    Note

    This method uses the SPTAuth default instance session to authenticate the underlying request. If this session does not contain a valid access token, the request will result in an error.

    Declaration

    Swift

    public func getRelatedArtists(completion handler: @escaping ([SKArtist]?, Error?) -> Void)

    Parameters

    handler

    The callback handler for the request. The parameters for this handler are:

    • artists: An array returned by the request of up to 20 related artists, if available.
    • error: An error identifying if and why the request failed, or nil if the request was successful.
  • Declaration

    Swift

    public var isSimplified: Bool { get }
  • Declaration

    Swift

    public typealias CursorType = String