 
         dispatch_async(autocompleteSearchQueue) { ()
             // Save new suggestions
-            if let dataArray = self.autocompleteDataSource?.getItemsArrayWithSubstring(substring) {
+            if let dataArray = self.autocompleteDataSource?.getItemsArrayWithSubstring(substring as String) {
                 self.autocompleteItemsArray = dataArray;
             }
             // Call show or hide autocomplete and reload data on main thread

        var origin = getTextViewOrigin();
        setFrame(origin, height: computeHeight());

        layer.zPosition = CGFloat.max;
        
        parentView?.addSubview(self);
        
    }
    
    func shouldChangeCharacters(InRange range: NSRange, replacementString string: NSString) {
        var substring = NSString(string: textField.text);
        substring = substring.stringByReplacingCharactersInRange(range, withString: string);
        searchAutocompleteEntries(WithSubstring: substring);

        // Get the cell
        let selectedCell = tableView.cellForRowAtIndexPath(indexPath)
        // Set text to
        textField.text = selectedCell?.textLabel!.text
        // Call delegate method
        autocompleteDelegate?.autocompleteWasSelectedRow(indexPath.row)
    }
