RSDImageWrapper
public struct RSDImageWrapper
RSDImageWrapper vends an image. It does not handle image caching. If your app using a custom image caching,
then you will need to use the shared delegate to implement this. The image wrapper is designed to allow coding of
images using an imageName property as a key for accessing the image.
-
The name of the image to be fetched.
Declaration
Swift
public let imageName: String -
The
sharedDelegateis a singleton delegate that can be used to customize the rules for fetching an image using theRSDImageWrapper. If defined and attached to theRSDImageWrapperusing the this property, then the image wrapper will ask the delegate for the appropriate image.Declaration
Swift
public static var sharedDelegate: RSDImageWrapperDelegate? -
Initialize the wrapper with a given image name.
Throws
RSDValidationError.invalidImageNameif the wrapper cannot convert theimageNameto an image. This error will only be thrown if there is not asharedDelegate. In that case, this initializer will check that the image is either included in the main bundle or in the bundle returned by a call toRSDResourceConfig.resourceBundle().Declaration
Swift
public init?(imageName: String) throwsParameters
imageNameThe name of the image to be fetched.
-
Fetch the image.
Declaration
Swift
public func fetchImage(for size: CGSize, callback: @escaping ((UIImage?) -> Void))Parameters
sizeThe size of the image to return.
callbackThe callback with the image, run on the main thread.
-
The
imageNameis used to represent the image wrapper.Declaration
Swift
public var rawValue: String -
Required initializer for conformance to
RawRepresentable. This will returnnilif the image is not valid.Declaration
Swift
public init?(rawValue: String)
-
Declaration
Swift
public static func ==(lhs: RSDImageWrapper, rhs: RSDImageWrapper) -> Bool -
Undocumented
Declaration
Swift
public static func ==(lhs: String, rhs: RSDImageWrapper) -> Bool -
Undocumented
Declaration
Swift
public static func ==(lhs: RSDImageWrapper, rhs: String) -> Bool
-
Required initializer for conformance to
ExpressibleByStringLiteral.Declaration
Swift
public init(stringLiteral value: String)Parameters
stringLiteralThe
imageNamefor this image wrapper.
-
Required initializer for conformance to
Decodable.Throws
DecodingErrorif the value is not aStringorRSDValidationError.invalidImageNameif the wrapper cannot convert the string to an image.Declaration
Swift
public init(from decoder: Decoder) throwsParameters
decoderThe decoder to use to decode this value. This is expected to have a single value container.
-
The unique identifier for the image.
Declaration
Swift
public var identifier: String -
The placement type for the image. This is
nilfor anRSDImageWrapper.Declaration
Swift
public var placementType: RSDImagePlacementType? -
The size of the image. This is
nilfor anRSDImageWrapper.Declaration
Swift
public var size: CGSize? -
The bundle for the image. This is
nilfor anRSDImageWrapper.Declaration
Swift
public var bundle: Bundle?
View on GitHub
RSDImageWrapper Structure Reference