Create shared iOS & Android Library



  • 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


  • Lifetime Qt Champion

    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



  • 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


  • Moderators

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.