Structures

The following structures are available globally.

  • FormatIndicatedCacheSerializer lets you indicate an image format for serialized caches.

    It could serialize and deserialize PNG, JPEG and GIF images. For image other than these formats, a normalized pngRepresentation will be used.

    Example:

    let profileImageSize = CGSize(width: 44, height: 44)
    
    // A round corner image.
    let imageProcessor = RoundCornerImageProcessor(
        cornerRadius: profileImageSize.width / 2, targetSize: profileImageSize)
    
    let optionsInfo: KingfisherOptionsInfo = [
        .cacheSerializer(FormatIndicatedCacheSerializer.png), 
        .processor(imageProcessor)]
    
    A URL pointing to a JPEG image.
    let url = URL(string: "https://example.com/image.jpg")!
    
    // Image will be always cached as PNG format to preserve alpha channel for round rectangle.
    // So when you load it from cache again later, it will be still round cornered.
    // Otherwise, the corner part would be filled by white color (since JPEG does not contain an alpha channel).
    imageView.kf.setImage(with: url, options: optionsInfo)
    
    See more

    Declaration

    Swift

    public struct FormatIndicatedCacheSerializer : CacheSerializer
  • Wrapper for Kingfisher compatible types. This type provides an extension point for connivence methods in Kingfisher.

    See more

    Declaration

    Swift

    public struct KingfisherWrapper<Base>
  • The default modifier. It does nothing and returns the image as is.

    See more

    Declaration

    Swift

    @available(*, deprecated, message: "Use `nil` in KingfisherOptionsInfo to indicate no modifier.")
    public struct DefaultImageModifier : ImageModifier
  • ImageResource is a simple combination of downloadURL and cacheKey. When passed to image view set methods, Kingfisher will try to download the target image from the downloadURL, and then store it with the cacheKey as the key in cache.

    See more

    Declaration

    Swift

    public struct ImageResource : Resource