使用Siri打开视图控制器

时间:2019-04-24 16:24:27

标签: swift sirikit

我正在使用的应用程序中有SiriKit,并且它是乘车预订应用程序,我希望能够在设置pickupLocation时将其打开到特定的视图控制器。这是我的应用程序当前的样子

class RideRequestHandler: NSObject, INRequestRideIntentHandling {

    func handle(intent: INRequestRideIntent, completion: @escaping (INRequestRideIntentResponse) -> Void) {
        let response = INRequestRideIntentResponse(code: .success, userActivity: .none)
        completion(response)
    }

    func resolvePickupLocation(for intent: INRequestRideIntent, with completion: @escaping (INPlacemarkResolutionResult) -> Void) {
        if let pickup = intent.pickupLocation {
            completion(.success(with: pickup))
            print("PICKUP LOC \(pickup.administrativeArea)")
        } else {
            completion(.needsValue())
        }
    }
}

0 个答案:

没有答案