There is no QuickType API but you can get similar functionality with the ACEAutocompleteBar library from GitHub. Just for the record, I have listed the steps to get this working with Swift:
1) Import the files from the folder "ACEAutocompleteBar" to your project.
2) Create a bridging header and write #import "ACEAutocompleteBar.h"
at the top.
3) Make your view containing the text field an ACEAutocompleteDataSource and ACEAutocompleteDelegate.
4) Implement the minimumCharactersToTrigger function
func minimumCharactersToTrigger(inputView: ACEAutocompleteInputView!) -> UInt {
return 1
}
5) Implement the inputView function.
func inputView(inputView: ACEAutocompleteInputView!, itemsFor query: String!, result resultBlock: (([AnyObject]!) -> Void)!) {
inputView.hidden = false
inputView.alpha = 0.75
if resultBlock != nil{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
var data:NSMutableArray = []
if(self.myTextField.isFirstResponder()){
//query your data source with 'query' and add any of the results to data to pass back
}
dispatch_async(dispatch_get_main_queue()) {resultBlock(data as [AnyObject])}
}
}
}
6) Implement the textField function.
func textField(textField: UITextField!, didSelectObject object: AnyObject!, inInputView inputView: ACEAutocompleteInputView!) {
textField.text = String(object)
}
7) Call setAutocompleteWithDataSource on the textField.
self.myTextField.setAutocompleteWithDataSource(self, delegate: self, customize: {
inputView in
// customize the view (optional)
inputView.font = UIFont.systemFontOfSize(20)
inputView.textColor = UIColor.whiteColor()
inputView.backgroundColor = UIColor.blueColor()
inputView.hidden = false
})
Hope that helps anyone looking for this kind of functionality!