Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var citiesArray: AnyObject? = nil;
- override func viewDidLoad() {
- super.viewDidLoad()
- //loading an array from a file
- var documentList=NSBundle.mainBundle().pathForResource("EuropeanCapitals", ofType:"plist")
- citiesArray = NSArray(contentsOfFile:documentList);
- func tableView(tableView: UITableView!, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath!) {
- if (editingStyle == UITableViewCellEditingStyle.Delete) {
- if let tv=tableView
- {
- citiesArray.removeAtIndex(indexPath!.row) /* Throws Error */
- tv.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
- }
- }
- if var citiesArr = citiesArray as? Array<AnyObject>{
- citiesArr.removeAtIndex(0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement