Reputation: 546
I am using SiriKit for Payment Domain and when user say "Send 10 $ to Ronoldo", my custom UI is shown.
Although there is only 1 label in my custom view, SiriKit shows the IntentsUI as it has three same label as image below.
I think my view is repeated 3 times. Can you help please?
Upvotes: 0
Views: 587
Reputation: 91
I have faced the same issue in one of my project.I used following method instead of the configureView function for providing the custom interface.
func configure(with interaction: INInteraction!, context: INUIHostedViewContext, completion: ((CGSize) -> Void)!) {
// your code....
completion(self.desiredSize)
}
and by using this method mine problem was solved I hope it works for u too.
Upvotes: 0
Reputation: 546
Finally I solved the problem. My custom Siri UI conforms to the INUIHostedViewControlling protocol and it defines configureView function for providing the custom interface. It is called many times for each parameter for my view controller, I checked the correct parameter and return my controller's view size only 1 time.
Hope this helps someone.
func configureView(for parameters: Set<INParameter>, of interaction: INInteraction, interactiveBehavior: INUIInteractiveBehavior, context: INUIHostedViewContext, completion: @escaping (Bool, Set<INParameter>, CGSize) -> Void) {
//.... other codes....
if (parameters.count > 0) {
let startIntentDescriptionParameter = INParameter(for: INSendPaymentIntent.self,
keyPath: "currencyAmount")
if parameters.contains(startIntentDescriptionParameter) {
return completion(true, parameters, self.desiredSize)
}
}
return completion(false, parameters, CGSize.zero)
}
Upvotes: 1