iOS: Get next word predictions

Does iOS provide an API for getting text predictions based on previous text?

I tried with UITextChecker.completions as such

let str = "Hello"
let range = NSMakeRange(str.utf16.count, 0)
let tc = UITextChecker()
let completions = tc.completions(forPartialWordRange: range, in: str, language: "en-US")
print(completions)

However, this only works for completing words, not sentences. Does iOS have a way of doing this? I read somewhere that macOS does. If not, what workarounds/alternatives would you recommend?