Stefano Andrean Salim
06/09/2025, 5:09 AM@Serializable
data class ScoreInfo(
@SerialName("tier_mapping")
val tier: Tier? = null,
@SerialName("score")
val score: Int? = null,
@SerialName("info")
val info: Map<String, InterestInfo?>? = null,
)
@Serializable
data class InterestInfo(
@SerialName("interest_rate")
val InterestRate: InterestRate? = null,
)
@Serializable
data class InterestRate(
...
)
the ScoreInfo
and Tier
data class is defined in OBJC header but the InterestInfo
data class is not.
context: my app is a native iOS app created in swift. Then I have a project to add a VC created in CMP as a childViewController of a page in native swift. I created a function in shared.kt
which return ScoreInfo
data class because I want to save it into the ios app localdb. I face a hard time to save it into ios localDb because the property info
is declared as interestInfo:(NSDictionary<NSString *, *id*> *)interestInfo
in OBJC header. id
in OBJC could be any object.
I wish I can typecast it into InterestInfo
but it is not declared on OBJC header somehow.
need a clue here. 🙂Michael Krussel
06/09/2025, 1:43 PMMap<String, InterestInfo?>
to Map<String, InterestInfo>
I think that would help.
Maybe a computed property that removes the nulls.Stefano Andrean Salim
06/11/2025, 9:32 AM