0

I have a method in my Java Model that is called like this:

httpClient.login(email, password, new JsonResponseHandler() {
        @Override
        public void onSuccess(int statusCode, JsonObject response) {
        }

        @Override
        public void onFailure(int statusCode, JsonObject response) {
        }
    });

My question is, how can I use this in Swift after translating my Model to objective-c

client.loginWithNSString(email, withNSString: password, withJsonResponseHandler: JsonResponseHandler!)

Is there a way to inline the JsonResponseHandler or any other way?

ph1lb4
  • 1,982
  • 17
  • 24

1 Answers1

0

This looks like a duplicate of the Anonymous class in Swift question. It looks like you need to create a class (perhaps inside of a closure) that implements JsonResponseHandler, then create an instance of that class.

Community
  • 1
  • 1
tball
  • 1,984
  • 11
  • 21