DXImageClient

This class is responsible for making requests to the DX image API.

public final class DXImageClient

The primary use case for this class is making requests for a user's profile pic and cover photo using the profilePic and coverPhoto properties on a DXProfile instance. The SDK provides helper methods as an extension on UIImageView to simplify displaying a user's images, which means in most cases you won't need to use this class; however, if you'd like to manually do so, this class allows you to request a base 64 representation of an image.

Properties

public static let shared: DXImageClient

Singleton instance of DXImageClient. You will access all the available DXImageClient methods through this instance.

Methods

getImage

public func getImage(
    forImageId imageId: String, 
    _ completion: @escaping (_ error: Error?, _ data: Data?) -> Void
) -> Void

Request a base 64 representation of an image by its id.

Parameter

Type

Description

forImageId

String

The unique id of the image.

completion

(Error?, Data?) -> Void

The closure invoked when the request finishes.

error

Error?

The error returned for an unsuccessful request.

data

Data?

Base 64 image returned for a successful request.

Last updated