I've been using this convenience initializer from iOS 11.0 beta.
@available(iOS 12, *)
extension SpotConditionIntent {
convenience init(spotId: String, spotName: String) {
self.init()
self.spotId = spotId
self.spotName = spotName
self.suggestedInvocationPhrase = "\(NSLocalizedString("how_are_waves_text", comment: "How are the waves at")) \(spotName)?"
if let uiimage = UIImage(named: "check-surf-icon"), let data = uiimage.pngData() {
let inImage = INImage(imageData: data)
setImage(inImage, forParameterNamed: \SpotConditionIntent.spotName)
}
}
}
It has been working fine, but it crashes in runtime if I convert this to Swift 5. There was no actual syntax changes though.
> Thread 1: Fatal error: could not demangle key path type from
XXXX9SpotConditionIntentCXD
It pointed the line 11 setImage.
I checked the documentation and I found that there is no `setImage` function in the `INIntent` class.
https://developer.apple.com/documentation/sirikit/inintent
Can you help me to find out what I should do? It seems I can still use
func keyImage() -> INImage?
which is added in iOS 12, but not sure when/how/why the `setImage` is not there(or deprecated?)