Add blur effect to image in Swift
Blur effect using CoreImage
First import CoreImage framework
import CoreImage
then add and call this function after replacing “bg” with your UIImageView
func blurEffect() { let context = CIContext(options: nil) let currentFilter = CIFilter(name: "CIGaussianBlur") let beginImage = CIImage(image: bg.image!) currentFilter!.setValue(beginImage, forKey: kCIInputImageKey) currentFilter!.setValue(5, forKey: kCIInputRadiusKey) let cropFilter = CIFilter(name: "CICrop") cropFilter!.setValue(currentFilter!.outputImage, forKey: kCIInputImageKey) cropFilter!.setValue(CIVector(cgRect: beginImage!.extent), forKey: "inputRectangle") let output = cropFilter!.outputImage let cgimg = context.createCGImage(output!, from: output!.extent) let processedImage = UIImage(cgImage: cgimg!) bg.image = processedImage }