EnterpriseDS Documentation

Class DSIllustration

@IBDesignable public final class DSIllustration: UIImageView, DSIconDisplayable  

An Enterprise-styled drop-in replacement for a UIImageView that displays a standard Enterprise illustration (DSIllustrationRenderingType).

For storyboards, add a UIImageView to your view and change the class name to DSIllustration.

Initialize with a rendering type to specify the image displayed. The default intrinsic size is 120x120, but can be overridden by specifying a renderingSize. A rendering size of .size160 would size the illustration at 160x160. It's recommended not to use layout constraints for sizing.

let defaultIllustration = DSIllustration(renderingType: .office)
let smallIllustration = DSIllustration(renderingType: .quiz, renderingSize: .size160)
let largeIllustration = DSIllustration(renderingType: .tests, renderingSize: .size120)

Do not attempt to change the illustration directly using image as this change could be overwritten if other properties get changed:

let illustration = DSIllustration(renderingType: .gluten)

illustration.image = UIImage(named: "illustration-enterprise-scale")
illustration.renderingSize = .size64 // <-- improper Illustration image will be lost

The rendering type for an DSIllustration can be changed at any time.

DSIllustration DSIllustration UIImageView UIImageView DSIllustration->UIImageView DSIconDisplayable DSIconDisplayable DSIllustration->DSIconDisplayable

Conforms To

UIImageView

Initializers

init(rendering​Type:​rendering​Size:​)

public init(renderingType: DSIllustrationRenderingType, renderingSize: DSIllustrationRenderingSize)  

Initializes and returns a newly allocated DSIllustration with the specified renderingType.

Parameters

rendering​Type DSIllustration​Rendering​Type

The renderingType to style the component.

rendering​Size DSIllustration​Rendering​Size

The renderingSize to style the component.

Properties

rendering​Size

public var renderingSize: DSIllustrationRenderingSize = .size120  

The width and height of the illustration. Illustrations are always square.

rendering​Size​String

@IBInspectable public var renderingSizeString: String  

The squared size of the illustration representable by a String.

This property is only recommended for use in the Attributes inspector of a storyboard since enums are not @IBInspectable. Possible values are 48, 64, and other sizes in IllustrationRenderingSize. In code, use the renderingSize property instead.

rendering​Type

public var renderingType: DSIllustrationRenderingType = .none  

The image used by the illustration. Can be changed after initialization.

rendering​Type​String

@IBInspectable public var renderingTypeString: String  

The image used by the illustration representable by a String.

This property is only recommended for use in the Attributes inspector of a storyboard since enums are not @IBInspectable. Possible values are enumerations of IllustrationRenderingType. In code, use the renderingType property instead.

name

public var name: String  

Returns the name of the rendering type

intrinsic​Content​Size

public override var intrinsicContentSize: CGSize  

Methods

prepare​For​Interface​Builder()

public override func prepareForInterfaceBuilder()