NatImage
public class NatImage : UIView
Note
This component is available in the following variants:- ✅ Standard
- ✅ Highlight
With the following attribute status:
- Radius:
- ✅
None
- ✅
Medium
- ✅
Circle
- ✅
- Fade:
- ✅
Top
- ✅
Bottom
- ✅
Left
- ✅
Right
- ✅
- ✅ Fallback
NatImage is a class that represents the image component from the design system.
It can be configured with the variants:
- Standard (default)
- Highlight
Example of usage:
let image = NatImage()
image.configureFade(.top)
image.configure(setImage: YourUIImage())
image.configureRadius(.medium)
Requires
It’s necessary to configure the Design System with a theme or fatalError will be raised.
DesignSystem().configure(with: AvailableTheme)
-
Undocumented
Declaration
Swift
public init()
-
Sets the component with the chosen variant interface.
Declaration
Swift
public func configure(variant: ImageType)
Parameters
variant
an option from ImageType enum
-
Sets the value for the border radius. The radius is equally applied in all corners. If the chosen option is
circle
, the height of the view (a CGFloat) must be sent as a parameter. Default option isnone
.Declaration
Swift
public func configureRadius(_ radius: ImageRadius = .none)
Parameters
radius
an option from ImageRadius enum
-
Applies a fade overlay to the component and sets its direction. Default option is
bottom
. Optionnone
is used to remove the fade overlay.Declaration
Swift
public func configureFade(_ fade: ImageFadeDirection = .bottom)
Parameters
fade
an option from ImageFadeDirection enum
-
Sets an image as a fallback, which will be displayed if the configuration with an URL or nil UIImage fails.
Declaration
Swift
public func configure(fallback: UIImage?)
Parameters
fallback
an UIImage
-
Sets an image as a fallback, which will be displayed if the configuration with an URL or nil UIImage fails.
Declaration
Swift
public func configure(fallback: URL?)
Parameters
fallback
an URL that will return an image
-
Configures the component with an image.
Declaration
Swift
public func configure(setImage: UIImage?)
Parameters
setImage
an UIImage
-
Configures the content mode for the image.
Declaration
Swift
public func configure(contentMode: UIImageView.ContentMode)
Parameters
contentMode
a contentMode option
-
Configures the component with an image from an URL.
Declaration
Swift
public func configure(setImageFromURL: URL?)
Parameters
setImageFromURL
an URL that loads an image
-
Undocumented
Declaration
Swift
public func configure(setBorderRadius: Bool)
-
Undocumented
Declaration
Swift
public func configure(setOverlay: Bool)
-
ImageFadeDirection is an enum that represents the fade options for NatImage
See moreDeclaration
Swift
public enum ImageFadeDirection
-
ImageRadius is an enum that represents the radius values for NatImage
See moreDeclaration
Swift
public enum ImageRadius
-
Imagetype is an enum that represents the variants for NatImage
See moreDeclaration
Swift
public enum ImageType