I am using MMDrawerController to create a sidebar in my ios app, i have succesfully implemented it, however i am trying to reduce the alpha of the center view when the sidebar displays, as you typically see on most apps with a similar feature, however i am getting the error
Type of expression is ambiguius without more context
Here is the code in my AppDelegate, the visualstateblock section is throwing the error
func buildNavigationDrawer()
{
// Instantiate Main.storyboard
let mainStoryBoard:UIStoryboard = UIStoryboard(name:"Main", bundle:nil)
// Create View Controllers
let mainPage:TabBarViewController = mainStoryBoard.instantiateViewController(withIdentifier: "TabBarViewController") as! TabBarViewController
let rightSideMenu:HomeSideMenuViewController = mainStoryBoard.instantiateViewController(withIdentifier: "HomeSideMenuViewController") as! HomeSideMenuViewController
// Wrap into Navigation controllers
let rightSideMenuNav = UINavigationController(rootViewController:rightSideMenu)
// Cerate MMDrawerController
drawerContainer = MMDrawerController(center: mainPage, rightDrawerViewController: rightSideMenuNav)
//drawerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.PanningCenterView
drawerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.panningCenterView
drawerContainer!.setDrawerVisualStateBlock { (drawerContainer, rightSideMenuNav) in
drawerContainer!.centerViewController.view.alpha = 0.3;
}
// Assign MMDrawerController to our window's root ViewController
window?.rootViewController = drawerContainer
}
Thanks for your help
In setDrawerVisualStateBlock
the returned MMDrawerController
is not optional but still there is a force wrapper !
behind it
this is telling the compiler to take the optional value from the previous line (the one you created)
To solve this either change one of the variables name or use this:
drawerContainer?.setDrawerVisualStateBlock { $0.0.centerViewController.view.alpha = 0.3 }