ntherning

    ntherning

    1 year ago
    Hi folks! I want to share how we are invoking Gradle from our Xcode project when building our iOS app. We only build the configuration (Release/Debug/simulator/device) actually requested by Xcode. We also generate a dependencies file (Makefile style
    .d
    -file) which Xcode uses to determine whether Gradle needs to be run at all. Xcode will discover changes to
    .kt
    files (which we edit in Android Studio, they aren't part of the Xcode project), changes to the Gradle files, etc and only then rebuild the framework. It works nicely so far. Would be great to get some feedback on the approach. https://gist.github.com/ntherning/dafd5979bdfb660bbf516066ca056931
    e

    Even André Fiskvik

    1 year ago
    Hi Niklas. We had a similar approach (altough not exactly the same), however we got issues each time when toggling between the Release and Debug environment from Xcode. The build after changing configuration would fail. Does this approach solve that issue?
    (Because of this we opted into integrating our kotlin MP library through Cocoapods instead)
    ntherning

    ntherning

    1 year ago
    I haven't run into any issues yet. Building debug builds for debugging on sim/device and archiving release builds for device all seem to work as expected. I have updated the gist with further instructions on how to embed the lib which I forgot in the first version. Unfortunately one has to edit the Xcode
    project.pbxproj
    file in a text editor to make it select the correct
    .framework
    depending on the
    CONFIGURATION
    and
    PLATFORM_NAME
    build variables. Don't like to have to do that but it does the trick and Xcode doesn't seem to mind.