All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.multiplatform.webview.util.Platform.kt Maven / Gradle / Ivy

There is a newer version: 1.9.40-alpha04
Show newest version
package com.multiplatform.webview.util

/**
 * Created By Kevin Zou On 2023/12/5
 */

/**
 * A class that represents the platform that the code is running on.
 */
internal sealed class Platform {
    /**
     * The Android platform.
     */
    data object Android : Platform()

    /**
     * The Desktop platform.
     */
    data object Desktop : Platform()

    /**
     * The iOS platform.
     */
    data object IOS : Platform()

    /**
     * Whether the current platform is Android.
     */
    fun isAndroid() = this is Android

    /**
     * Whether the current platform is Desktop.
     */
    fun isDesktop() = this is Desktop

    /**
     * Whether the current platform is iOS.
     */
    fun isIOS() = this is IOS
}

/**
 * Get the current platform.
 */
internal expect fun getPlatform(): Platform

internal expect fun getPlatformVersion(): String

internal expect fun getPlatformVersionDouble(): Double




© 2015 - 2024 Weber Informatics LLC | Privacy Policy