copper-leaf / ballast

Opinionated Application State Management framework for Kotlin Multiplatform
https://copper-leaf.github.io/ballast/
BSD 3-Clause "New" or "Revised" License
147 stars 10 forks source link

iOS instructions out of date? #44

Closed svdo closed 1 year ago

svdo commented 1 year ago

I'm investigating which state management library I want to use for my multi-platform (iOS, Android) app. From what I'm reading Ballast seems like an interesting alternative.

I'm following the instructions on the web site: https://copper-leaf.github.io/ballast/wiki/platforms/ios/, but I get compiler errors when trying to compile the CombineAdapters file (copied from the KaMPKit repo as per the instructions): FlowAdapter and EventHandler types cannot be found by Xcode.

After a lot of searching, I think the documentation might be out of date, because if I add the dependencies and exports for ballast-api and ballast-viewmodel, the file is compiled correctly.

    cocoapods {
        summary = "Some description for the Shared Module"
        homepage = "Link to the Shared Module homepage"
        version = "1.0"
        ios.deploymentTarget = "14.1"
        podfile = project.file("../TryBallast/Podfile")
        framework {
            baseName = "shared"
            isStatic = false // SwiftUI preview requires dynamic framework
            export("io.github.copper-leaf:ballast-api:3.0.1")           // <=====
            export("io.github.copper-leaf:ballast-core:3.0.1")
            export("io.github.copper-leaf:ballast-repository:3.0.1")
            export("io.github.copper-leaf:ballast-viewmodel:3.0.1")      // <=====
        }
    }

    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0")
                api("io.github.copper-leaf:ballast-api:3.0.1")           // <=====
                api("io.github.copper-leaf:ballast-core:3.0.1")
                api("io.github.copper-leaf:ballast-repository:3.0.1")
                api("io.github.copper-leaf:ballast-viewmodel:3.0.1")    // <=====
            }
        }
        [...]
    }
cjbrooks12 commented 1 year ago

Good catch. In v3.0.0, I moved all the code that was previously in ballast-core into several smaller modules (ballast-api, ballast-logging, ballast-viewmodel, and ballast-utils), with ballast-core now just depending on those other modules. Indeed, I did forget to update the iOS documentation here.

In general, I'm not too familiar with iOS, and haven't done much more than build a POC for this integration (initially internally for work, then later with KaMPKit-ballast, which I haven't gotten around to updating to v3 yet). There are probably a few rough edges with the current instructions, and almost certainly better ways to do things here, so if you happen to know how the iOS documentation/integration should be improved, I'd greatly appreciate your thoughts on this discussion thread!

svdo commented 1 year ago

Thanks Casey, if I'm going to pick Ballast for my needs then I will certainly share my thoughts. For now I'm still working on understanding the mental model ;) My experience is mostly in iOS, so for me the Android side is going to be the more challenging one.