MapleBacon alternatives and similar libraries
Based on the "Images" category.
Alternatively, view MapleBacon alternatives based on common mentions on social networks and blogs.
-
SDWebImage
Asynchronous image downloader with cache support as a UIImageView category -
Kingfisher
A lightweight, pure-Swift library for downloading and caching images from the web. -
SwiftGen-Assets
The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs! -
GPUImage 2
GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing. -
HanekeSwift
A lightweight generic cache for iOS written in Swift with extra love for images. -
SkyFloatingLabelTextField
A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift. -
AlamofireImage
AlamofireImage is an image component library for Alamofire -
UIImageColors
Fetches the most dominant and prominent colors from an image. -
GPUImage 3
GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal. -
Brightroom
📷 A composable image editor using Core Image and Metal. [Moved to: https://github.com/FluidGroup/Brightroom] -
APNGKit
High performance and delightful way to play with APNG format in iOS. -
Lightbox
:milky_way: A convenient and easy to use image viewer for your iOS app -
TinyCrayon
A smart and easy-to-use image masking and cutout SDK for mobile apps. -
SwiftGif
[UNMAINTAINED] 🌠 A small UIImage extension with gif support -
CTPanoramaView
A library that displays spherical or cylindrical panoramas with touch or motion based controls. -
ImageScout
A Swift implementation of fastimage. Supports PNG, GIF, and JPEG. -
FMPhotoPicker
A modern, simple and zero-dependency photo picker with an elegant and customizable image editor -
AXPhotoViewer
An iOS/tvOS photo gallery viewer, useful for viewing a large (or small!) number of photos. -
PassportScanner
Scan the MRZ code of a passport and extract the firstname, lastname, passport number, nationality, date of birth, expiration date and personal numer. -
XAnimatedImage
XAnimatedImage is a performant animated GIF engine for iOS written in Swift based on FLAnimatedImage -
Viewer
Image viewer (or Lightbox) with support for local and remote videos and images -
JLStickerTextView
add text(multiple line support) to imageView, edit, rotate or resize them as you want, then render the text on image -
UIImageView-BetterFace-Swift
autoresize images and if any face discovered refine the position of the image. -
Moa
An image download extension of the image view written in Swift for iOS, tvOS and macOS. -
KFSwiftImageLoader
An extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memory and disk caching for iOS and Watch. -
MCScratchImageView
A custom ImageView that is used to cover the surface of other view like a scratch card, user can swipe the mulch to see the view below. -
ImageLoader
A lightweight and fast image loader for iOS written in Swift. -
FacebookImagePicker
FacebookImagePicker is Facebook album photo picker written in Swift. -
DTPhotoViewerController
A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer. -
ImageDetect
✂️ Detect and crop faces, barcodes and texts in image with iOS 11 Vision api. -
Harbeth
Metal API for GPU accelerated Image and Video and Camera filter framework. Support macOS & iOS. 🎨 图像、视频、相机滤镜框架 -
LetterAvatarKit
📲 Use this extension 🧩 to create letter-based avatars or placeholders 🎭 to be utilized within your app
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of MapleBacon or a related project?
README
MapleBacon
Introduction
MapleBacon is a lightweight and fast Swift library for downloading and caching images.
Example
The folder Example
contains a sample projects for you to try.
Requirements
- Swift 5.1
- iOS 10.0+
- Xcode 10.2+
Installation
MapleBacon is available through CocoaPods. To install add it to your Podfile:
pod "MapleBacon"
github "JanGorman/MapleBacon"
Usage
UIImageView
The most basic usage is via an extension on UIImageView
. You pass it URL:
import MapleBacon
private var imageView: UIImageView!
func someFunc() {
let url = URL(string: "…")
imageView.setImage(with: url)
}
If you want to add a placeholder while the image is downloading you specify that like this:
func someFunc() {
let url = URL(string: "…")
imageView.setImage(with: url, placeholder: UIImage(named: "placeholder"))
}
If your backend returns images that are not optimised for display, it's good practice to downsample them. MapleBacon comes with support for downsampling via displayOptions
:
func someFunc() {
let url = URL(string: "…")
imageView.setImage(with: url, displayOptions: .downsampled)
}
Image Transformers
MapleBacon allows you to apply transformations to images and have the results cached so that you app doesn't need to perform the same work over and over. To make your own transformer, create a class conforming to the ImageTransforming
protocol. A transform can be anything you like, let's create one that applies a Core Image sepia filter:
private class SepiaImageTransformer: ImageTransforming {
// The identifier is used as part of the cache key. Make sure it's something unique
let identifier = "com.schnaub.SepiaImageTransformer"
func transform(image: UIImage) -> UIImage? {
let filter = CIFilter(name: "CISepiaTone")!
let ciImage = CIImage(image: image)
filter.setValue(ciImage, forKey: kCIInputImageKey)
filter.setValue(0.5, forKey: kCIInputIntensityKey)
let context = CIContext()
guard let outputImage = filter.outputImage,
let cgImage = context.createCGImage(outputImage, from: outputImage.extent) else {
return image
}
// Return the transformed image which will be cached (or used by another transformer)
return UIImage(cgImage: cgImage)
}
}
You then pass this filter to MapleBacon in one of the convenience methods:
let url = URL(string: "…")
let transformer = SepiaImageTransformer()
imageView.setImage(with: url, transformer: transformer)
If you want to apply multiple transforms to an image, you can chain your transformers:
let chainedTransformer = SepiaImageTransformer()
.appending(transformer: DifferentTransformer())
.appending(transformer: AnotherTransformer())
Or if you prefer, using the custom >>>
operator:
let chainedTransformer = SepiaImageTransformer() >>> DifferentTransformer() >>> AnotherTransformer()
(Keep in mind that if you are using Core Image it might not be optimal to chain individual transformers but rather create one transformer that applies multiple CIFilter
s in one pass. See the Core Image Programming Guide.)
Caching
MapleBacon will cache your images both in memory and on disk. Disk storage is automatically pruned after a week (taking into account the last access date as well) but you can control the maximum cache time yourself too:
let oneDaySeconds: TimeInterval = 60 * 60 * 24
MapleBacon.default.maxCacheAgeSeconds = oneDaySeconds
Combine
On iOS13 and above, you can use Combine
to fetch images from MapleBacon
MapleBacon.shared.image(with: url)
.receive(on: DispatchQueue.main) // Dispatch to the right queue if updating the UI
.sink(receiveValue: { image in
// Do something with your image
})
.store(in: &subscriptions) // Hold on to and dispose your subscriptions
Migrating from 5.x
There is a small migration guide in the wiki when moving from the 5.x branch to 6.x
License
MapleBacon is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the MapleBacon README section above
are relevant to that project's source code only.