andreacremaschi / SpatialDBKit

An Objective-C lightweight spatial RDBMS (based on SQLite/SpatiaLite)
Other
73 stars 67 forks source link

Swift support? #22

Closed jaddison closed 8 years ago

jaddison commented 9 years ago

I'm pretty new to iOS development and would love to use this project in my work - but I'm using Swift instead of Objective-C currently. What options exist for me to use this project? I've read a little bit about bridging headers?

Is there any chance of this project being swift-compatible (if it isn't already, and the docs are just out of date?)

andreacremaschi commented 9 years ago

Hi, good question! A porting to Swift is not scheduled, but you're on the right track: it is possible to integrate SpatialDBKit using a bridging header. You'll need to prepare one for ShapeKit too, but it shouldn't be too much work. Since I never did this myself, if you go this way I would be happy if you keep me up to date on this, would you?

jaddison commented 9 years ago

We've decided to try and use standard Core Data functionality for our needs - I've read that you can simulate bounding box behaviour and then sort distances post retrieval from Core Data. I'm not sure how it will go.

We're going this way because of concerns with GEOS and licensing (GPL related), making it a concern when building apps for iOS in the App Store. Nothing tangible, but many concerns raised. Thoughts on this?

andreacremaschi commented 9 years ago

Well your concerns are correct, LGPL compatibility with the App Store is controversial (at least if you're not planning to release your source code). CoreData doesn't support spatial indexes and can't be extended with custom SQL functions, but it will become a performance issue only if you're planning to filter some thousands of points.

davidm49090 commented 9 years ago

I'd also love to see a fully working Swift demo, if it's possible to upload one. Bridging headers hurt my brain, so if you could give an example, it would be much appreciated.

burhanuddin353 commented 8 years ago

I tried integrating the project with one of my swift project but without success. Before going for bridging header step, the project doesn't compile.

Also, When I replace the row 87 in spatialite.c:

#include <spatialite/spatialite.h>

with:

#include <spatialite/spatialite/spatialite.h>

it throws this 'spatialite/spatialite/spatialite.h' file not found.

Also, there is no main.m file to rename.

I would like if someone can upload a working example of this in swift.

burhanuddin353 commented 8 years ago

Alright. I was able to compile and run the project with Swift 3.0 on Xcode 8.0 beta. Some extra work has to be done in the files and build settings and it works.

andreacremaschi commented 8 years ago

@burhanuddin353 cool! I can't support the project anymore unfortunately, but you may want to fork it and share your work 🍺

halijoe commented 7 years ago

@burhanuddin353 Hello!Could you please tell me what extra work did you do in the files and build setting?thanks very much!