HUBComponentImageData
@protocol HUBComponentImageData <HUBSerializable>
Protocol defining the public API of an object that describes image data for a Component in the Hub Framework
You don’t conform to this protocol yourself, instead the Hub Framework will create implementations of it for you
based on the data supplied to a HUBComponentImageDataBuilder
or through JSON data.
-
Any identifier for the image
This will always be
nil
for default images (main and background). For custom images, this property contains the same identifier as its key in thecustomImageData
dictionary of itsHUBComponentModel
.Declaration
Objective-C
@property (readonly, copy, nonatomic, nullable) NSString *identifier;
-
The type of the image
If the type is
HUBComponentImageTypeCustom
, theidentifier
property will contain the custom identifier of the image. SeeHUBComponentImageType
for more information.Declaration
Objective-C
@property (readonly, nonatomic) HUBComponentImageType type;
-
Any HTTP URL of a remote image that should be downloaded and then rendered
The Hub Framework will take care of the image downloading itself, and will notify a component once that operation is completed, so a component normally doesn’t have to interact with this property itself.
Declaration
Objective-C
@property (readonly, copy, nonatomic, nullable) NSURL *URL;
-
Any local image that should be used either as a placeholder image before the actual image has been dowloaded, or as a permanent image.
Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) UIImage *localImage;
-
Any custom data that is associated with the image data
You can use custom data to easily add new pieces of data to an image data object, that can then be picked up by a component using the object.
Declaration
Objective-C
@property (readonly, copy, nonatomic, nullable) NSDictionary<NSString *, id> *customData;