Kingfisher
Undocumented
-
Undocumented
-
Undocumented
-
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: ImageReturn Value
The normalized image with orientation set to up and correct scale.
-
Undocumented
-
Undocumented
-
Undocumented
-
Create image based on
selfand 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) -> ImageParameters
radiusThe round corner radius of creating image.
sizeThe target size of creating image.
cornersThe target corners which will be applied rounding.
backgroundColorThe background color for the output image
Return Value
An image with round corner of
self.
-
Resize
selfto an image of new size.Note
This method only works for CG-based image.
Declaration
Swift
public func resize(to size: CGSize) -> ImageParameters
sizeThe target size.
Return Value
An image with new size.
-
Resize
selfto an image of new size, respecting the content mode.Declaration
Swift
public func resize(to size: CGSize, for contentMode: ContentMode) -> ImageParameters
sizeThe target size.
contentModeContent mode of output image should be.
Return Value
An image with new size.
-
Undocumented
-
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) -> ImageParameters
radiusThe blur radius should be used when creating blur effect.
Return Value
An image with blur effect applied.
-
Create an image from
selfwith a color overlay layer.Note
This method only works for CG-based image.
Declaration
Swift
public func overlaying(with color: Color, fraction: CGFloat) -> ImageParameters
colorThe color should be use to overlay.
fractionFraction 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
selfwith a color tint.Declaration
Swift
public func tinted(with color: Color) -> ImageParameters
colorThe color should be used to tint
selfReturn Value
An image with a color tint applied.
-
Create an image from
selfwith color control.Declaration
Swift
public func adjusted(brightness: CGFloat, contrast: CGFloat, saturation: CGFloat, inputEV: CGFloat) -> ImageParameters
brightnessBrightness changing to image.
contrastContrast changing to image.
saturationSaturation changing to image.
inputEVInputEV changing to image.
Return Value
An image with color control applied.
-
Return an image with given scale.
Declaration
Swift
public func scaled(to scale: CGFloat) -> ImageParameters
scaleTarget scale factor the new image should have.
Return Value
The image with target scale. If the base image is already in the scale,
basewill be returned.
-
Apply a
FiltercontainingCIImagetransformer toself.Note
Only CG-based images are supported. If any error happens during transforming,
selfwill be returned.Declaration
Swift
public func apply(_ filter: Filter) -> ImageParameters
filterThe filter used to transform
self.Return Value
A transformed image by input
Filter.
-
Undocumented
-
Set an image with a resource, a placeholder image, options, progress handler and completion handler.
Note
Both the
progressBlockandcompletionHandlerwill be invoked in main thread. TheCallbackDispatchQueuespecified inoptionsInfowill not be used in callbacks of this method.If
resourceisnil, theplaceholderimage will be set andcompletionHandlerwill be called with botherrorandimagebeingnil.Declaration
Swift
public func setImage(with resource: Resource?, placeholder: Placeholder? = nil, options: KingfisherOptionsInfo? = nil, progressBlock: DownloadProgressBlock? = nil, completionHandler: CompletionHandler? = nil) -> RetrieveImageTaskParameters
resourceResource object contains information such as
cacheKeyanddownloadURL.placeholderA placeholder image when retrieving the image at URL.
optionsA dictionary could control some behaviors. See
KingfisherOptionsInfofor more.progressBlockCalled when the image downloading progress gets updated.
completionHandlerCalled 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? -
Holds which indicator type is going to be used. Default is .none, means no indicator will be shown.
Declaration
Swift
public var indicatorType: IndicatorType -
Holds any type that conforms to the protocol
Indicator. The protocolIndicatorhas aviewproperty that will be shown when loading an image. It will benilifindicatorTypeis.none.Declaration
Swift
public fileprivate(set) var indicator: Indicator? -
Undocumented
-
Set an image to use for a specified state with a resource, a placeholder image, options, progress handler and completion handler.
Note
Both the
progressBlockandcompletionHandlerwill be invoked in main thread. TheCallbackDispatchQueuespecified inoptionsInfowill not be used in callbacks of this method.If
resourceisnil, theplaceholderimage will be set andcompletionHandlerwill be called with botherrorandimagebeingnil.Declaration
Swift
public func setImage(with resource: Resource?, for state: UIControlState, placeholder: UIImage? = nil, options: KingfisherOptionsInfo? = nil, progressBlock: DownloadProgressBlock? = nil, completionHandler: CompletionHandler? = nil) -> RetrieveImageTaskParameters
resourceResource object contains information such as
cacheKeyanddownloadURL.stateThe state that uses the specified image.
placeholderA placeholder image when retrieving the image at URL.
optionsA dictionary could control some behaviors. See
KingfisherOptionsInfofor more.progressBlockCalled when the image downloading progress gets updated.
completionHandlerCalled 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
progressBlockandcompletionHandlerwill be invoked in main thread. TheCallbackDispatchQueuespecified inoptionsInfowill not be used in callbacks of this method.If
resourceisnil, theplaceholderimage will be set andcompletionHandlerwill be called with botherrorandimagebeingnil.Declaration
Swift
public func setBackgroundImage(with resource: Resource?, for state: UIControlState, placeholder: UIImage? = nil, options: KingfisherOptionsInfo? = nil, progressBlock: DownloadProgressBlock? = nil, completionHandler: CompletionHandler? = nil) -> RetrieveImageTaskParameters
resourceResource object contains information such as
cacheKeyanddownloadURL.stateThe state that uses the specified image.
placeholderA placeholder image when retrieving the image at URL.
optionsA dictionary could control some behaviors. See
KingfisherOptionsInfofor more.progressBlockCalled when the image downloading progress gets updated.
completionHandlerCalled 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
stateThe 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
stateThe state that uses the specified background image.
Return Value
Current URL for background image.
View on GitHub
Install in Dash
Kingfisher Class Reference