46.17 Donating Shortcuts to Siri
Each time the user successfully completes a stock purchase within the main app the action needs to be donated to Siri as a potential shortcut. The code to make these donations should now be added to the PurchaseView.swift file in a method named makeDonation(), which also requires that the Intents framework be imported:
import SwiftUI
import Intents
struct PurchaseView: View {
.
.
.onAppear() {
purchaseData.refresh()
}
}
func makeDonation(symbol: String, quantity: String) {
let intent = BuyStockIntent()
...