I had been working on your question and this are my results,

First of all in the SWRevealViewControllerDelegate
you have 3 methods to get noticed of changes on the revealViewController panGestureRecognizer
func revealController(revealController: SWRevealViewController!, panGestureBeganFromLocation location: CGFloat, progress: CGFloat) {
}
func revealController(revealController: SWRevealViewController!, panGestureMovedToLocation location: CGFloat, progress: CGFloat, overProgress: CGFloat) {
}
func revealController(revealController: SWRevealViewController!, panGestureEndedToLocation location: CGFloat, progress: CGFloat, overProgress: CGFloat) {
}
So you need make your FrontViewController
as delegate of SWRevealViewController
like this self.revealViewController().delegate = self
and then using an extension from https://www.raywenderlich.com/84043/ios-8-visual-effects-tutorial called UIImage+ImageEffects
founded on the example code provided by the tutorial, we can create an image from frontViewController.view and apply the gaussian blur from the mentioned category this is the code
import UIKit
class MainViewController: UIViewController,SWRevealViewControllerDelegate {
var imageBlur : UIImageView?
var originalImage : UIImage?
let maxRadius : CGFloat = 5.0
let minRadius = 0
var arrayOfImages : [UIImage]?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
self.revealViewController().delegate = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
self.originalImage = self.takeSnapShotOfView(self.view)
self.imageBlur = UIImageView(image: self.originalImage)
self.view.addSubview(self.imageBlur!)
}
func revealController(revealController: SWRevealViewController!, panGestureBeganFromLocation location: CGFloat, progress: CGFloat) {
let image = self.originalImage
self.imageBlur?.image = image?.applyFixedBlurWithRadius(CGFloat(progress*self.maxRadius))
}
func revealController(revealController: SWRevealViewController!, panGestureMovedToLocation location: CGFloat, progress: CGFloat, overProgress: CGFloat) {
let image = self.originalImage
self.imageBlur?.image = image?.applyFixedBlurWithRadius(CGFloat(progress*self.maxRadius))
}
func revealController(revealController: SWRevealViewController!, panGestureEndedToLocation location: CGFloat, progress: CGFloat, overProgress: CGFloat) {
let image = self.originalImage
self.imageBlur?.image = image?.applyFixedBlurWithRadius(CGFloat(progress*self.maxRadius))
}
func revealController(revealController: SWRevealViewController!, willMoveToPosition position: FrontViewPosition) {
if(position == .Left)
{
self.imageBlur?.image = self.originalImage
}
if(position == .Right)
{
let image = self.originalImage
self.imageBlur?.image = image?.applyFixedBlurWithRadius(CGFloat(1*self.maxRadius))
}
}
func takeSnapShotOfView(view:UIView) ->UIImage
{
UIGraphicsBeginImageContext(CGSizeMake(view.frame.size.width, view.frame.size.height))
view.drawViewHierarchyInRect(CGRectMake(0, 0, view.frame.size.width, view.frame.size.height), afterScreenUpdates: true)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
}
I hope this helps you