iosMain.dev.gitlive.firebase.firestore.GeoPoint.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of firebase-firestore Show documentation
Show all versions of firebase-firestore Show documentation
The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the Firebase Android SDK Kotlin Extensions but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting iOS, Android or JS.
package dev.gitlive.firebase.firestore
import cocoapods.FirebaseFirestoreInternal.FIRGeoPoint
import kotlinx.serialization.Serializable
/** A class representing a platform specific Firebase GeoPoint. */
actual typealias NativeGeoPoint = FIRGeoPoint
/** A class representing a Firebase GeoPoint. */
@Serializable(with = GeoPointSerializer::class)
actual class GeoPoint internal actual constructor(internal actual val nativeValue: NativeGeoPoint) {
actual constructor(latitude: Double, longitude: Double) : this(NativeGeoPoint(latitude, longitude))
actual val latitude: Double = nativeValue.latitude
actual val longitude: Double = nativeValue.longitude
override fun equals(other: Any?): Boolean =
this === other || other is GeoPoint && nativeValue == other.nativeValue
override fun hashCode(): Int = nativeValue.hashCode()
override fun toString(): String = nativeValue.toString()
}