userInfo
only sends data of type anyObject
, so I need to cast my array of Meals
to anyObject
without crashing and then recasting it to [Meal]
, unfortunately it crashes here ...
var anyOrder = NSMutableArray()
for meal in ordered { // ordered is array of meals [Meal] ...
anyOrder.addObject(meal as! AnyObject) //crashes here
}
I want to be able to cast it or find any other way to send it using userInfo
in NSNotification
, thanks in advance