Hello, On shared code "commonMain" (Kotlin), I ha...
# multiplatform
d
Hello, On shared code "commonMain" (Kotlin), I have this class:
Copy code
@Serializable
data class GeoPoint(
    var latitude: Double = 0.0,
    var longitude: Double = 0.0
)
I am trying to instantiate a simple object in my iOS (Swift) code:
Copy code
@State var myGeopoint = GeoPoint()
However this returns the error:
'init()' is unavailable
For a list of GeoPoints the error does not appear. Why this is different? Any easier workaround? This should be related to Kotlin more than with Swift I believe. I just want a simple contructor with the properties empty/null.
in the meanwhile, try
Copy code
@Serializable
data class GeoPoint(
    var latitude: Double,
    var longitude: Double,
) {
    constructor() : this(latitude = 0.0, longitude = 0.0)
}