UIImageView Extensions
Set of helper methods defined on UIImageView to simplify displaying a user's image.
For most cases, you will likely have one or more UIImageView
s defined for a view controller where you will want to display a user's profile pic and/or cover photo, such as on a profile screen. The methods in this extension simplify that by taking an image id, making a request for that image, and if successful, set an image view's image
property to that image.
Methods
dxImage
Request an image by its id and if successful, set as the image view's image
property.
Parameter | Type | Description |
forImageId |
| String representing an image's id. |
completion |
| The closure invoked when the request finishes. |
error |
| The error returned for an unsuccessful request. |
dxProfilePic
Request a user's profile pic by its id. If the request fails, sets the image
property to a default image; otherwise, sets the image
property to the user's profile pic.
Parameter | Type | Description |
forImageId |
| The id of a user's profile pic. |
completion |
| The closure invoked when the request finishes. |
error |
| The error returned for an unsuccessful request. |
dxCoverPhoto
Request a user's cover photo by its id. If the request fails, sets the image
property to a default image; otherwise, sets the image
property to the user's cover photo.
Parameter | Type | Description |
forImageId |
| The id of a user's cover photo. |
completion |
| The closure invoked when the request finishes. |
error |
| The error returned for an unsuccessful request. |
Last updated