     var delegate: ChangeCurrencyViewControllerDelegate?
     var targetCurrency: String!
     var selectedCurrency: String!
+    var currencies:Array<Currency>!
+    var searchResults:Array<Currency>?
     
     @IBOutlet weak var tableView: UITableView!
     

        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) {

        
    }
    
}























