Will there be Structure SDK written in Swift 4?


#1

Been using Swift – hard to go back to Obj-C.

Swift is faster than Obj-C/C.


Build error with iOS 11.4, SDK 0.8
#2

There’s a forum member (n6xej) who has graciously ported the SDK over to Swift. I believe I last got it working with Swift 3.2, haven’t made the changes yet for Swift 4 but should be doable.


#3

I’ve ported the Scanner App to swift 4, but have not uploaded to GitHub yet. Message me if you need it.


#4

Here is a link to my Swift 4 port on GitHub https://github.com/n6xej/RRStructureScannerSwift4


Build error with iOS 11.4, SDK 0.8
#5

Are there any plans to release an official port for Swift 4?


#6

Hellow n6xej,

Thanks for your excellent translation to swift efforts!

I have tried running the project but there errors appearing as shown in the figure. The “Extra argument freeGLTextureUni in call”. I am new to swift. It would be great if you could explain the cause and how to correct that.

Thank you very much.

Remel01


#7

That version links against SDK 0.62. Using 7.1 or 8.0 that call no longer takes a second argument, so just remove the second argument like so:
// Initialize the scene.
slamState.scene = STScene.init(context: display!.context) //, freeGLTextureUnit: GLenum(GL_TEXTURE2))
You can delete it off as well:
// Initialize the scene.
slamState.scene = STScene.init(context: display!.context)

You should also make these changes everywhere they are used:
.hasValidPose becomes .lastOutput.hasValidPose.boolValue
.hasSupportPlane becomes .lastOutput.hasSupportPlane.boolValue
.cameraPose becomes .lastOutput.cameraPose

I think here are 5 or 6 places total.


#8

Hello n6xej,

Worked flawlessly. Thanks a lot. Excellent work!