If you have have a NSString and you want to give it a stronger type try representable.


- (void)fetchImageWithID:(NSString *)imageID
- (void)fetchImageForItem:(id)imageRepresentable withSize:(CGSize)imageSize;

Then you can setup it up and use it like this.

NSString *imageID = imageRepresentable.imageIdentifier;
NSMutableDictionary *namedArguments = [NSMutableDictionary dictionaryWithDictionary:@{
mageIdentifierKey: imageID
}];

if (!CGSizeEqualToSize(imageSize, CGSizeZero)) {
namedArguments[ImageWidthKey] = @(imageSize.width);
namedArguments[ImageHeightKey] = @(imageSize.height);
}

[self.client performRPC:SPTAppRemoteGetImageCallMethodName
arguments:@[]
namedArguments:namedArguments

/**
* The @c ImageRepresentable protocol represents an object that may contain an image.
*/
@protocol ImageRepresentable

/// The identifier of the image of the entity.
@property (nonatomic, strong, readonly) NSString *imageIdentifier;

Advertisement