UIImage

class UIImage : NSObject, NSSecureCoding

A UIImage extension to support resizing images.

  • Returns a resized image that fits in newSize, keeping it’s aspect ratio

    Note that the new image size is not newSize, but within it.

    Declaration

    Swift

    public func resized(toFitIn newSize: CGSize) -> UIImage?

    Parameters

    rectSize

    the returned image will fit within this size.

    Return Value

    an image with the same aspect ratio as the original, but that fits within rect size, or nil if it cannot create such an image