Created
July 27, 2018 17:40
-
-
Save azamsharp/b6bde057d9b624210fdca5629e3f1049 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prepare your view controller for the interaction to handle. | |
func configureView(for parameters: Set<INParameter>, of interaction: INInteraction, interactiveBehavior: INUIInteractiveBehavior, context: INUIHostedViewContext, completion: @escaping (Bool, Set<INParameter>, CGSize) -> Void) { | |
guard let intent = interaction.intent as? OrderCoffeeIntent else { | |
completion(false, Set(), .zero) | |
return | |
} | |
// clear out all the views | |
for childView in view.subviews { | |
childView.removeFromSuperview() | |
} | |
var desiredSize = CGSize.zero | |
if interaction.intentHandlingStatus == .ready { | |
desiredSize = displayInvoice(name :intent.coffeeName!, deliveryLocation :intent.deliveryLocation!) | |
} else if interaction.intentHandlingStatus == .success { | |
desiredSize = displayConfirm(name :intent.coffeeName!) | |
} | |
// Do configuration here, including preparing views and calculating a desired size for presentation. | |
completion(true, parameters, desiredSize) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment