INExtension.GetHandler(INIntent) 메서드

정의

개발자는 이 메서드를 재정의하여 확장이 응답할 수 있는 경우 처리기 개체 intent 를 반환합니다.

[Foundation.Export("handlerForIntent:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 3, 2, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.MacOSX, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual Foundation.NSObject GetHandler (Intents.INIntent intent);
abstract member GetHandler : Intents.INIntent -> Foundation.NSObject
override this.GetHandler : Intents.INIntent -> Foundation.NSObject

매개 변수

intent
INIntent

INIntent 시스템에서 받은 입니다.

반환

개발자의 처리기 개체이거나 null 가 확장에서 처리되지 않는 경우 intent 입니다.

구현

특성

설명

개발자의 처리기 개체는 이 메서드가 IIN{Intent}Handling 처리기를 반환하는 형식 INIntent 에 적합한 인터페이스를 구현해야 합니다. 예를 들면 다음과 같습니다.

class MyExtension : INExtension
{
    override public NSObject GetHandler (INIntent intent)
    {
        if (intent is INSendMessageIntent)
        {
            return new MySendMessageHandler ();
        }
        return null;
    }
}

class MySendMessageHandler : NSObject, IINSendMessageIntentHandling
{
    public void HandleSendMessage (INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion)
    {
        // ... Send a message here ...

        var activity = new NSUserActivity (nameof (INSendMessageIntent));
        var response = new INSendMessageIntentResponse (INSendMessageIntentResponseCode.Success, activity);
        completion (response);
    }
}

적용 대상