DevtorImageExtension is a pure Swift library for Downloading and cacging images from web with UIImage extension included
Enjoy!
To run the example project, clone the repo, and run pod install
from the Example directory first.
imageView.circleImageView(borderColor: .black, borderWidth: 1)
Without caching (default)
imageView.downloaded(from: "https://example.com/image", contentMode: .scaleToFill)
With caching
imageView.downloaded(from: "https://example.com/image", contentMode: .scaleToFill, cache: true)
image.averageColor()
Set image from base64
imageView.imageFromBase64(base64: base64_string)
Get base64 string from image (JPEG)
imageView.image.base64(format: .jpeg(100), completion: { base64 in
print("Your base64 string is \(base64)")
})
Get base64 string from image (PNG)
imageView.image.base64(format: .png, completion: { base64 in
print("Your base64 string is \(base64)")
})
OR without completion
imageView.image.convertImageTobase64(format: .jpeg(100))
imageView.image.convertImageTobase64(format: .png)
By percentage
imageView.image.resizeWithPercent(percentage: 50)
By width
imageView.image.resizeWithWidth(width: 120)
Scale image to new size
imageView.image.scaleImageToSize(width: 800, height: 400)
By percentage
let newImage = imageView.image.imageWithColor(color: .black)
- iOS 10.0+
- Swift 4.0+
DevtorImageExtension is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'DevtorImageExtension'
Feem.io
DevtorImageExtension is available under the MIT license. See the LICENSE file for more info.