Closed mickeyl closed 7 years ago
It might be possible to run via GNUstep on Linux and then write bindings for it, but it would probably be easiest to write a macOS tool that shares code with your iOS app.. or just do it in your iOS app and extract the prepopulated db (that's what we do in iBurn).
For a pure Python tool you'd also need to rewrite your object serialization/deserialization code e.g. NSCoding/NSKeyedArchiver, and then also rewrite all the code to do all of the Yap specific stuff like view registration etc. I think Robbie was working on a C++ port at one point but I'm not sure if it was meant to be 100% compatible with the db format, or just using similar ideas.
Hi @mickeyl!
We did something similar like @chrisballinger proposed. We had a special "create seeddatabase" target for our app. This had special instructions on how to fill the local DB. Afterwards we would extract it from the simulator and vacuum it. Ours was around 50-100MB and was mainly limited in performance by web service calls to acquire the data. If you dislike ObjC you could also use Swift in this target ;)
Of course there are tools like PyObjC but I personally would advise against a complicated and brittle solution like this.
Thanks for the pointers. Yes, I guess writing special ObjC code for populating the database seems the easiest approach. I will probably try to offload the most complicated stuff into a dedicated (Python) script that puts out a JSON file that contains everything parsed into model objects right away which then only needs to be parsed by ObjC and stuck into the database.
I'm very satisfied with YapDatabase on the client. Alas, for some of my projects, I have the necessity to start with a large prepopulated database. It seems pretty cumbersome to write a dedicated data importer in Objective-C. I'd rather use a scripting language, e.g. Python, to generate my database upfront, possibly on a beefy machine that's not running macOS. Are bindings to other programming languages planned or feasible?