         }
         
         let substringBefore = lastSubstring;
-        lastSubstring = substring;
+        lastSubstring = substring as String;
         // If substring is the same as before and before it has no suggestions then
         // do not search for suggestions
         if (substringBefore == substring.substringToIndex(substring.length - 1) &&

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

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

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