Create shared iOS & Android Library
-
wrote on 23 Sept 2013, 15:17 last edited by
Would QT allow me to write a library that could be shared across iOS and Android?
This library would contain some core app services including
- Gateway API calls to remote servers
- Models (entities)
- Persistence of those models in Sqlite, along with helper methods or data access
- Business logic
- Separate test suite
I'd then want to link those into Android and iOS native apps to achieve a level of code reuse between the two.
Tobin
-
Hi and welcome to devnet,
Shared as in using the same code ? Yes, you can easily isolate the platform specific API that you might want to use using Qt's platform ifdefs.
You will need however to build your lib for both platform separately (as Qt is built for each platform it supports)
Hope it helps
-
wrote on 25 Sept 2013, 16:34 last edited by
Thanks for the reply.
Is there any particular thing I need to look at if I wanted to learn to write the code once then compile and link the library for Android and iOS separately. Is there any special project type or tools? I'm a C++ noob :)
Tobin
-
no not really. It's more a matter of code design than compiler settings, etc.
You can look at Qt implementations for some classes as a reference. Especially classes with system specific stuff.
1/4