The below codes used to work fine two years ago.
it has "AnyObject is not a subtype of NSArray" error after Xcode update. can anyone help me fixing it?
override func viewWillAppear(_ animated: Bool) {
if let storednoteItems : AnyObject = UserDefaults.standard.object(forKey: "noteItems") as AnyObject? {
noteItems = []
for i in 0 ..< storednoteItems.count += 1 {
// the above line getting Anyobject is not a subtype of NSArray error
noteItems.append(storednoteItems[i] as! String)
}
}
}