UIImage
Undocumented
- 
                  
                  
Width of the UIImage.
Declaration
Swift
open var width: CGFloat - 
                  
                  
Height of the UIImage.
Declaration
Swift
open var height: CGFloat 
- 
                  
                  
Resizes an image based on a given width. - Parameter toWidth w: A width value. - Returns: An optional UIImage.
Declaration
Swift
open func resize(toWidth w: CGFloat) -> UIImage?Parameters
toWidth wA width value.
Return Value
An optional UIImage.
 - 
                  
                  
Resizes an image based on a given height. - Parameter toHeight h: A height value. - Returns: An optional UIImage.
Declaration
Swift
open func resize(toHeight h: CGFloat) -> UIImage?Parameters
toHeight hA height value.
Return Value
An optional UIImage.
 
- 
                  
                  
Creates a new image with the passed in color. - Parameter color: The UIColor to create the image from. - Returns: A UIImage that is the color passed in.
Declaration
Swift
open func tint(with color: UIColor) -> UIImage?Parameters
colorThe UIColor to create the image from.
Return Value
A UIImage that is the color passed in.
 
- 
                  
                  
Creates an Image that is a color. - Parameter color: The UIColor to create the image from. - Parameter size: The size of the image to create. - Returns: A UIImage that is the color passed in.
Declaration
Swift
open class func image(with color: UIColor, size: CGSize) -> UIImage?Parameters
colorThe UIColor to create the image from.
sizeThe size of the image to create.
Return Value
A UIImage that is the color passed in.
 
- 
                  
                  
Crops an image to a specified width and height. - Parameter toWidth tw: A specified width. - Parameter toHeight th: A specified height. - Returns: An optional UIImage.
Declaration
Swift
open func crop(toWidth tw: CGFloat, toHeight th: CGFloat) -> UIImage?Parameters
toWidth twA specified width.
toHeight thA specified height.
Return Value
An optional UIImage.
 
- 
                  
                  
Creates an clear image. - Returns: A UIImage that is clear.
Declaration
Swift
open class func clear(size: CGSize = CGSize(width: 16, height: 16)) -> UIImage?Return Value
A UIImage that is clear.
 
- 
                  
                  
Asynchronously load images with a completion block. - Parameter URL: A URL destination to fetch the image from. - Parameter completion: A completion block that is executed once the image has been retrieved.
Declaration
Swift
open class func contentsOfURL(url: URL, completion: @escaping ((UIImage?, Error?) -> Void))Parameters
URLA URL destination to fetch the image from.
completionA completion block that is executed once the image has been retrieved.
 
- 
                  
                  
Adjusts the orientation of the image from the capture orientation. This is an issue when taking images, the capture orientation is not set correctly when using Portrait. - Returns: An optional UIImage if successful.
Declaration
Swift
open func adjustOrientation() -> UIImage?Return Value
An optional UIImage if successful.
 
View on GitHub
        UIImage Extension Reference