@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.
Initializes and returns a newly allocated DSIllustration with the specified renderingType.
The renderingType to style the component.
The renderingSize to style the component.
public var renderingSize: DSIllustrationRenderingSize = .size120
The width and height of the illustration. Illustrations are always square.
@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.
public var renderingType: DSIllustrationRenderingType = .none
The image used by the illustration. Can be changed after initialization.
@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.
public var name: String
Returns the name of the rendering type
public override var intrinsicContentSize: CGSize
public override func prepareForInterfaceBuilder()