UIImage

extension UIImage
  • The image always draw the original image, without treating it as a template

    Declaration

    Swift

    public var original: UIImage { get }
  • The image always draw the image as a template image, ignoring its color information

    Declaration

    Swift

    public var template: UIImage { get }

Edit

  • The rounded image with the half of height for the corner radius.

    Declaration

    Swift

    public var rounded: UIImage { get }
  • Make an image rounded.

    Declaration

    Swift

    public func rounded(with radius: CGFloat) -> UIImage

    Parameters

    radius

    the radius of each corner oval. Values larger than half the images width or height are clamped appropriately to half the width or height.

    Return Value

    the rounded image.

  • Resize an image as square.

    Declaration

    Swift

    public func square(with width: CGFloat = 0) -> UIImage

    Parameters

    width

    a width of the square.

    Return Value

    a squared image.

  • Undocumented

    Declaration

    Swift

    public func scale(xTimes: CGFloat) -> UIImage
  • Undocumented

    Declaration

    Swift

    public func scale(xWidth: CGFloat, xHeight: CGFloat) -> UIImage
  • Resize an image.

    Declaration

    Swift

    public func resize(with size: CGSize, crop: UIView.ContentMode = .scaleAspectFill) -> UIImage

    Parameters

    size

    a size of the resized image.

    crop

    a crop mode for the resized image. Default: scaleAspectFill.

    Return Value

    a squared image.

  • Make a transparent image.

    Declaration

    Swift

    public func transparent(alpha: CGFloat) -> UIImage

    Parameters

    alpha

    The desired opacity of the image, specified as a value between 0.0 and 1.0. A value of 0.0 renders the image totally transparent while 1.0 renders it fully opaque. Values larger than 1.0 are interpreted as 1.0.

    Return Value

    the transparented image.

Create an Image with a color

  • Create an Image 1x1 with a given color.

    Declaration

    Swift

    public convenience init(color: UIColor)

    Parameters

    color

    a UIColor. If the color has alpha 1, the image would be opaque.

  • A home icon.

    Declaration

    Swift

    public static let homeIcon: UIImage
  • An image icon.

    Declaration

    Swift

    public static let imageIcon: UIImage
  • A close button icon.

    Declaration

    Swift

    public static let closeIcon: UIImage
  • An user icon.

    Declaration

    Swift

    public static let userIcon: UIImage
  • A bell icon.

    Declaration

    Swift

    public static let bellIcon: UIImage
  • A reply icon.

    Declaration

    Swift

    public static let replyIcon: UIImage
  • An unselected like icon.

    Declaration

    Swift

    public static let likeInactiveIcon: UIImage
  • A selected like icon.

    Declaration

    Swift

    public static let likeIcon: UIImage
  • A repost icon.

    Declaration

    Swift

    public static let repostIcon: UIImage
  • An image of an icon from Stream Activity Feed Components.

    Declaration

    Swift

    public static func stream(named name: String) -> UIImage