Search code examples
objective-cswiftvk-sdk

VKSDK : How to translate code to swift?


I try to translate this code:

[[VKSdk instance] setUiDelegate:self];

i tried so:

VKSdk.instance().setUiDelegate(self)

But this is wrong! Please help!


Solution

  • From where do you have the Objective-C code above? I have quickly read over the frameworks.h file and did not find something like that.

    But I did find this:

    VKSdk.initializeWithDelegate(self, andAppId: "")
    

    Is that what you are searching for? Or does it have to be the setUIDelegate?

    UPDATE

    Wait I have found something else...

    VKSdkUIDelegate Protocol.

    Please try this:

    VKSdk.instance().uiDelegate = self
    

    VK iOS SDK