     }
     
     func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return currencies().count
+        return currencies.count
     }
     
     func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
         let cell = self.tableView.dequeueReusableCellWithIdentifier("CurrencyCell")
         let index = indexPath.row
-        let currency: Currency = currencies()[index] as! Currency
+        let currency: Currency = currencies[index]
         cell!.textLabel!.text = currency.name!
         cell!.detailTextLabel!.text = currency.code!
         cell!.accessoryType = UITableViewCellAccessoryType.None

        do {
            result = try managedObjectContext!.executeFetchRequest(fetch)
        } catch let error as NSError {
                print("Error fetching currencies error: %@", error)
        }
        return result
    }
    
}

    
    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        let index = indexPath.row
        let currency: Currency = currencies[index]
        let currencyCode = currency.code!
        
        delegate?.didChangeCurrency(currencyCode, targetCurrency: targetCurrency)
        self.dismissViewControllerAnimated(true, completion: {})
    }
    
}

extension ChangeCurrencyViewController: UISearchBarDelegate, UISearchDisplayDelegate {
    
    func filterContentForSearchText(searchText: String) {

        
    }
    
}























