Kingfisher
public final class Kingfisher<Base>
Undocumented
-
Undocumented
Declaration
Swift
public let base: Base
-
Undocumented
Declaration
Swift
public init(_ base: Base)
-
Normalize the image. This method does nothing in OS X.
-
Normalize the image. This method will try to redraw an image with orientation and scale considered.
Declaration
Swift
public var normalized: Image { get }
Return Value
The normalized image with orientation set to up and correct scale.
-
Undocumented
Declaration
Swift
public func pngRepresentation() -> Data?
-
Undocumented
Declaration
Swift
public func jpegRepresentation(compressionQuality: CGFloat) -> Data?
-
Undocumented
Declaration
Swift
public func gifRepresentation() -> Data?
-
Undocumented
Declaration
Swift
public static func animated(with data: Data, scale: CGFloat = 1.0, duration: TimeInterval = 0.0, preloadAll: Bool, onlyFirstFrame: Bool = false) -> Image?
-
Undocumented
Declaration
Swift
public static func image(data: Data, scale: CGFloat, preloadAllAnimationData: Bool, onlyFirstFrame: Bool) -> Image?
-
Undocumented
Declaration
-
Create image based on
self
and apply compositing operation.Note
This method only works for CG-based image.
-
Create a round corner image based on
self
.Note
This method only works for CG-based image.
Declaration
Swift
public func image(withRoundRadius radius: CGFloat, fit size: CGSize, roundingCorners corners: RectCorner = .all, backgroundColor: Color? = nil) -> Image
Parameters
radius
The round corner radius of creating image.
size
The target size of creating image.
corners
The target corners which will be applied rounding.
backgroundColor
The background color for the output image
Return Value
An image with round corner of
self
.
-
Resize
self
to an image of new size.Note
This method only works for CG-based image.
Declaration
Swift
public func resize(to size: CGSize) -> Image
Parameters
size
The target size.
Return Value
An image with new size.
-
Resize
self
to an image of new size, respecting the content mode.Declaration
Swift
public func resize(to size: CGSize, for contentMode: ContentMode) -> Image
Parameters
size
The target size.
contentMode
Content mode of output image should be.
Return Value
An image with new size.
-
Undocumented
Declaration
Swift
public func crop(to size: CGSize, anchorOn anchor: CGPoint) -> Image
-
Create an image with blur effect based on
self
.Note
This method only works for CG-based image.
Declaration
Swift
public func blurred(withRadius radius: CGFloat) -> Image
Parameters
radius
The blur radius should be used when creating blur effect.
Return Value
An image with blur effect applied.
-
Create an image from
self
with a color overlay layer.Note
This method only works for CG-based image.
Parameters
color
The color should be use to overlay.
fraction
Fraction of input color. From 0.0 to 1.0. 0.0 means solid color, 1.0 means transparent overlay.
Return Value
An image with a color overlay applied.
-
Create an image from
self
with a color tint.Parameters
color
The color should be used to tint
self
Return Value
An image with a color tint applied.
-
Create an image from
self
with color control.Declaration
Swift
public func adjusted(brightness: CGFloat, contrast: CGFloat, saturation: CGFloat, inputEV: CGFloat) -> Image
Parameters
brightness
Brightness changing to image.
contrast
Contrast changing to image.
saturation
Saturation changing to image.
inputEV
InputEV changing to image.
Return Value
An image with color control applied.
-
Undocumented
Declaration
Swift
public static var shared: UIApplication? { get }
-
Set an image with a resource, a placeholder image, options, progress handler and completion handler.
Note
Both the
progressBlock
andcompletionHandler
will be invoked in main thread. TheCallbackDispatchQueue
specified inoptionsInfo
will not be used in callbacks of this method.If
resource
isnil
, theplaceholder
image will be set andcompletionHandler
will be called with botherror
andimage
beingnil
.Declaration
Swift
@discardableResult public func setImage(with resource: Resource?, placeholder: Placeholder? = nil, options: KingfisherOptionsInfo? = nil, progressBlock: DownloadProgressBlock? = nil, completionHandler: CompletionHandler? = nil) -> RetrieveImageTask
Parameters
resource
Resource object contains information such as
cacheKey
anddownloadURL
.placeholder
A placeholder image when retrieving the image at URL.
options
A dictionary could control some behaviors. See
KingfisherOptionsInfo
for more.progressBlock
Called when the image downloading progress gets updated.
completionHandler
Called when the image retrieved and set.
Return Value
A task represents the retrieving process.
-
Cancel the image download task bounded to the image view if it is running. Nothing will happen if the downloading has already finished.
Declaration
Swift
public func cancelDownloadTask()
-
Get the image URL binded to this image view.
Declaration
Swift
public var webURL: URL? { get }
-
Holds which indicator type is going to be used. Default is .none, means no indicator will be shown.
Declaration
Swift
public var indicatorType: IndicatorType { get set }
-
Holds any type that conforms to the protocol
Indicator
. The protocolIndicator
has aview
property that will be shown when loading an image. It will benil
ifindicatorType
is.none
.Declaration
Swift
public fileprivate(set) var indicator: Indicator? { get set }
-
Undocumented
Declaration
Swift
public fileprivate(set) var placeholder: Placeholder? { get set }
-
Undocumented
Declaration
Swift
public var md5: String { get }
-
Set an image to use for a specified state with a resource, a placeholder image, options, progress handler and completion handler.
Note
Both the
progressBlock
andcompletionHandler
will be invoked in main thread. TheCallbackDispatchQueue
specified inoptionsInfo
will not be used in callbacks of this method.If
resource
isnil
, theplaceholder
image will be set andcompletionHandler
will be called with botherror
andimage
beingnil
.Declaration
Swift
@discardableResult public func setImage(with resource: Resource?, for state: UIControlState, placeholder: UIImage? = nil, options: KingfisherOptionsInfo? = nil, progressBlock: DownloadProgressBlock? = nil, completionHandler: CompletionHandler? = nil) -> RetrieveImageTask
Parameters
resource
Resource object contains information such as
cacheKey
anddownloadURL
.state
The state that uses the specified image.
placeholder
A placeholder image when retrieving the image at URL.
options
A dictionary could control some behaviors. See
KingfisherOptionsInfo
for more.progressBlock
Called when the image downloading progress gets updated.
completionHandler
Called when the image retrieved and set.
Return Value
A task represents the retrieving process.
-
Cancel the image download task bounded to the image view if it is running. Nothing will happen if the downloading has already finished.
Declaration
Swift
public func cancelImageDownloadTask()
-
Set the background image to use for a specified state with a resource, a placeholder image, options progress handler and completion handler.
Note
Both the
progressBlock
andcompletionHandler
will be invoked in main thread. TheCallbackDispatchQueue
specified inoptionsInfo
will not be used in callbacks of this method.If
resource
isnil
, theplaceholder
image will be set andcompletionHandler
will be called with botherror
andimage
beingnil
.Declaration
Swift
@discardableResult public func setBackgroundImage(with resource: Resource?, for state: UIControlState, placeholder: UIImage? = nil, options: KingfisherOptionsInfo? = nil, progressBlock: DownloadProgressBlock? = nil, completionHandler: CompletionHandler? = nil) -> RetrieveImageTask
Parameters
resource
Resource object contains information such as
cacheKey
anddownloadURL
.state
The state that uses the specified image.
placeholder
A placeholder image when retrieving the image at URL.
options
A dictionary could control some behaviors. See
KingfisherOptionsInfo
for more.progressBlock
Called when the image downloading progress gets updated.
completionHandler
Called when the image retrieved and set.
Return Value
A task represents the retrieving process.
-
Cancel the background image download task bounded to the image view if it is running. Nothing will happen if the downloading has already finished.
Declaration
Swift
public func cancelBackgroundImageDownloadTask()
-
Get the image URL binded to this button for a specified state.
Declaration
Swift
public func webURL(for state: UIControlState) -> URL?
Parameters
state
The state that uses the specified image.
Return Value
Current URL for image.
-
Get the background image URL binded to this button for a specified state.
Declaration
Swift
public func backgroundWebURL(for state: UIControlState) -> URL?
Parameters
state
The state that uses the specified background image.
Return Value
Current URL for background image.