We're trying to integrate SKIE into our project. W...
# multiplatform
l
We're trying to integrate SKIE into our project. We have the plugin in our
build.gradle.kts
and
enableSwiftUIObservingPreview = true
, but iosApp cannot find
Observing
.
We use SKIE 0.8.2 and Kotlin 2.0.0
j
There's example of it in following fwiw https://github.com/joreilly/FantasyPremierLeague
l
Yes, I'm following it, but it doesn't build.
The
Observing
seems not to be found
In Swift code
j
FantasyPremierLeague project doesn't build for you?
l
It builds, but my project doesn't
I use XCode 15.4
(I develop in Fleet, but use XCode as well)
f
Hi! Do other SKIE features work as expected?
l
Hi, I didn't try the other features
right now in the
Observing
line I get
Value of type 'KotlinBase' has no member 'here my member property name'
image.png
f
what is the declaration of “viewModel.uiState”?
l
StateFlow<UiState>
UiState
is a data class
Copy code
data class UiState(
        val signInState: SignInState = SignInState.Loading,
    ) {

        enum class SignInState {
            Loading,
            SignedIn,
            Error,
        }
    }
f
try adding
let foo: SkieSwiftStateFlow<UiState> = viewModel.uiState
above the
Observing
call just so that we know if the derived type is correct
l
image.png
I have
import ComposeApp
f
is the UiState data class nested?
l
ComposeApp
is where my framework is generated
Yes
f
oh, use its full name in that case
l
Oh, ok
So this line compiles now
image.png
f
hm, that’s weird 😄 try adding
let typedUiState: SplashScreenViewModel.UiState = uiState
before the switch
and replace the
uiState
inside the switch with this typedUiState
l
image.png
Somehow the type is not being passed correctly
f
yeah, can you try the force cast and run the code to see if it has the correct type in runtime?
l
I have setup the project first as a Compose Multiplatform project
Only afterwards I added SwiftUI
I don't know if this is the problem. When I created a new project with the "SwiftUI" template, SKIE works
f
or, maybe first try clicking on the
Observing
function and send me how it’s declared
it’s possible that there is some name conflict and that it’s calling a wrong function
l
Clicking on
Observing
in XCode shows a question mark
In Fleet it's not resolved
f
of course 😄
but I assume the code compiles if you add the force cast?
l
Yes
It shows "Loading" 🙂
But the state now doesn't change on the screen
Let me compare with Android
On Android the state updates on the screen
So SwiftUI just takes the first value and doesn't get updates from viewModel
f
is the project open source or can you share it in any way?
@Lukasz Kalnik I tried reverting the changes in the project and the project compiles just fine. I think it might be some issue with the incremental compilation, try a full clean build. The Loading screen is stuck in the loading state, but I don’t think that’s a SKIE issue because the custom function
onStart
is never executed.
l
Ah ok, yes, that might be a problem with our code. Thanks for looking into it!