Start a new topic
Solved

WikitudeSDK integration in SWIFT language

WikitudeSDK integration in SWIFT language


Hello,

is there any documentation or tutorial available to integrate WikitudeSDK in Swift language ?

Hi Yunas,

This is not something Wikitude SDK specific, you just need to follow the Apple guidelines how to integrate native code and libraries with Swift:

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

Best,

Martin

Hello,

would it be possible to have the basic http://www.wikitude.com/developer/documentation/ios code snippets translated to swift as a starter please?

I'm battling with the import and it would be great to have the basics covered

I'm also finding difficult to access the WTFeatures bit mask from Swift as enums/options don't have values in Swift

Thanks a lot

Franck

Hi Franck,
Currently we don't have any Swift related samples, but I found some information on how to transfer enums/options from ObjC into Swift. I'm sorry that you have to do this by yourself, but we currently don't have a Swift API. However you can write an augmented reality related view controller in ObjC and use this VC in your Swift project.

Maybe this NSHipster article helps you integrating our ObjC API into your Swift project

Best regards

Andreas

Thanks Andreas,

I have managed to build the first sample in Swift, will post it to GitHub shortly and will add a link here.

:-)

That sounds great! THX!

We will add Swift support as soon as it becomes more relevant and the tools support is acceptable.

Best regards

Andreas

Frank,

I'm building out a Swift version as well and I think I've got everything configured.  I can debug through Safari and see that the js files are loading up and my WTArchitectViewDelegates are firing but my camera never loads and the isRunning flag never seems to update even after a call to my architect view's start() function.

I've tested the wtc file in the SDKs example code and it works just fine.  Did you have this problem at all?

Hi Matthew,
Sounds like you missed to set the OTHER_LINKER_FLAG -ObjC!?

Best regards

Andreas

Thanks Andreas, that was the missing piece to get my architectView running but after the wikitude logo appears it fades away to a black screen.  Any places I should look for the camera feed not loading?  My understanding from the docs is that calling start() should activate the camera etc.  In the Obj-C example demo i'm not seeing any explicit user call to set up the feed.  

Hi Matthew,
A black camera usually means that you did not authorized access to the camera. Please check your iOS Privacy settings regarding camera access for your application in the iOS Settings App.

Best regards

Andreas

My problem ended up being because I was trying to programmatically add my WTArchitectView.  I fixed the problem by adding it as a subview in Interface Builder and then created an Outlet.

Hi Matthew,
Thanks for sharing your finding! I'm still a little bit surprised that it works with IB but not when programatically adding the WTArchitectView as a subview. If you want, you can send me a demo project that reproduces the problem and I have a look at it. Once we officially support Swift, I will definetly have a look at your problem. 

Best regards

Andreas

Andreas,

I have been working on this project as well with Swift. I modeled my view controller after the one found here. (Whoops, this repo is private)

However I too am getting this black screen. When I look at the Debug View Hierarchy, I see that some of the web content does appear to be rendering, but it's "hidden" behind the WTArchitectLicenseView. I suspect it may have something to do with the constraints being set, maybe? I'm not entirely sure. But I would really appreciate some help on this as I am definitely 100% stuck without some help.

 

Thanks,

Matt

Hi,

Can someone share a simple example to use Wikitude SDK with swift. If possible please share Git link.

Thanks in advance,

Yash
Login or Signup to post a comment