Hey guys I am using AKSwiftSlideMenu for slide menu functionality in project and I wonder if is there a way so that I can change the destination ViewController title when I segue to it from the Menu? I tried this code but is not passing the data to the destination:
func slideMenuItemSelectedAtIndex(index: Int32) {
let topViewController : UIViewController = self.navigationController!.topViewController!
print("View Controller is : \(topViewController) \n", terminator: "")
switch(index){
case 0:
print("Note\n", terminator: "")
var nextVC = AddSubcategoryVC()
nextVC.categoryName = "Note"
self.openViewControllerBasedOnIdentifier("AddSubcategoryVC")
print("On menu the cat is: \(nextVC.categoryName)")
break
default:
print("default\n", terminator: "")
}
}
On the destination viewcontroller I have this variable that is to get the data from the Menu:
var categoryName = ""
and it is returning 'nil'. I also tried doing this:
var categoryName : String!
and this:
var categoryName = String()
all returning 'nil'.
You have created new object of view controller.
Replace this code :
with