moko-time

所属分类:iPhone/iOS
开发工具:kotlin
文件大小:0KB
下载次数:0
上传日期:2020-09-07 02:45:41
上 传 者sh-1993
说明:  用于移动(android和ios)Kotlin多平台开发的时间戳和计时器,
(Timestamp and timers for mobile (android & ios) Kotlin Multiplatform development,)

文件列表:
CONTRIBUTING.md (1841, 2020-09-06)
LICENSE.md (11356, 2020-09-06)
build.gradle.kts (608, 2020-09-06)
buildSrc/ (0, 2020-09-06)
buildSrc/build.gradle.kts (540, 2020-09-06)
buildSrc/src/ (0, 2020-09-06)
buildSrc/src/main/ (0, 2020-09-06)
buildSrc/src/main/kotlin/ (0, 2020-09-06)
buildSrc/src/main/kotlin/Deps.kt (1350, 2020-09-06)
buildSrc/src/main/kotlin/Versions.kt (600, 2020-09-06)
gradle.properties (170, 2020-09-06)
gradle/ (0, 2020-09-06)
gradle/wrapper/ (0, 2020-09-06)
gradle/wrapper/gradle-wrapper.jar (55616, 2020-09-06)
gradle/wrapper/gradle-wrapper.properties (202, 2020-09-06)
gradlew (5917, 2020-09-06)
gradlew.bat (2842, 2020-09-06)
img/ (0, 2020-09-06)
img/logo.png (20888, 2020-09-06)
publishToMavenLocal.sh (55, 2020-09-06)
sample/ (0, 2020-09-06)
sample/android-app/ (0, 2020-09-06)
sample/android-app/build.gradle.kts (1150, 2020-09-06)
sample/android-app/proguard-rules.pro (647, 2020-09-06)
sample/android-app/src/ (0, 2020-09-06)
sample/android-app/src/main/ (0, 2020-09-06)
sample/android-app/src/main/AndroidManifest.xml (726, 2020-09-06)
sample/android-app/src/main/java/ (0, 2020-09-06)
sample/android-app/src/main/java/com/ (0, 2020-09-06)
sample/android-app/src/main/java/com/icerockdev/ (0, 2020-09-06)
sample/android-app/src/main/java/com/icerockdev/MainActivity.kt (643, 2020-09-06)
sample/android-app/src/main/res/ (0, 2020-09-06)
sample/android-app/src/main/res/layout/ (0, 2020-09-06)
sample/android-app/src/main/res/layout/activity_main.xml (694, 2020-09-06)
... ...

# Project deprecated, use https://github.com/Kotlin/kotlinx-datetime start from kotlin 1.4.0. ![moko-time](https://github.com/icerockdev/moko-time/blob/master/img/logo.png) [![GitHub license](https://github.com/icerockdev/moko-time/blob/master/https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://github.com/icerockdev/moko-time/blob/master/http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://github.com/icerockdev/moko-time/blob/master/https://api.bintray.com/packages/icerockdev/moko/moko-time/images/download.svg) ](https://github.com/icerockdev/moko-time/blob/master/https://bintray.com/icerockdev/moko/moko-time/_latestVersion) ![kotlin-version](https://github.com/icerockdev/moko-time/blob/master/https://img.shields.io/badge/kotlin-1.3.70-orange) # Mobile Kotlin time This is a Kotlin Multiplatform library that supports time and Timers. ## Table of Contents - [Features](https://github.com/icerockdev/moko-time/blob/master/#features) - [Requirements](https://github.com/icerockdev/moko-time/blob/master/#requirements) - [Versions](https://github.com/icerockdev/moko-time/blob/master/#versions) - [Installation](https://github.com/icerockdev/moko-time/blob/master/#installation) - [Usage](https://github.com/icerockdev/moko-time/blob/master/#usage) - [Samples](https://github.com/icerockdev/moko-time/blob/master/#samples) - [Set Up Locally](https://github.com/icerockdev/moko-time/blob/master/#setup-locally) - [Contributing](https://github.com/icerockdev/moko-time/blob/master/#contributing) - [License](https://github.com/icerockdev/moko-time/blob/master/#license) ## Features - **Timer** for recurrent/delayed operations; - **getCurrentMilliSeconds** in common code. ## Requirements - Gradle version 5.6.4+ - Android API 16+ - iOS version 9.0+ ## Versions - kotlin 1.3.50 - 0.1.0 - kotlin 1.3.60 - 0.2.0 - kotlin 1.3.70 - 0.3.0 ## Installation root build.gradle ```groovy allprojects { repositories { maven { url = "https://dl.bintray.com/icerockdev/moko" } } } ``` project build.gradle ```groovy dependencies { commonMainApi("dev.icerock.moko:time:0.3.0") } ``` ## Usage ### Timer Create the timer for a recurring operation: ```kotlin var iteration = 0 val timer = Timer(intervalMilliSeconds = 5000) { iteration++ println("iteration $iteration") true // return true to repeat operation after interval } timer.start() // call block after intervalMilliSeconds timer.stop() // manually stop repeating timer ``` Create the timer for a single run (a delayed operation): ```kotlin val timer = Timer(intervalMilliSeconds = 5000) { println("printed after 5 seconds") false // we not need repeating - just single run } timer.start() // call block after intervalMilliSeconds ``` ### Current milliseconds ```kotlin val milliSeconds: Long = getCurrentMilliSeconds() println("now $milliSeconds milliseconds") ``` ## Samples Please see more examples in the [sample directory](https://github.com/icerockdev/moko-time/blob/master/sample). ## Set Up Locally - The [time directory](https://github.com/icerockdev/moko-time/blob/master/time) contains the `time` library; - The [sample directory](https://github.com/icerockdev/moko-time/blob/master/sample) contains sample apps for Android and iOS; plus the mpp-library connected to the apps; - For local testing use the `./publishToMavenLocal.sh` script - so that sample apps use the locally published version. ## Contributing All development (both new features and bug fixes) is performed in the `develop` branch. This way `master` always contains the sources of the most recently released version. Please send PRs with bug fixes to the `develop` branch. Documentation fixes in the markdown files are an exception to this rule. They are updated directly in `master`. The `develop` branch is pushed to `master` on release. For more details on contributing please see the [contributing guide](https://github.com/icerockdev/moko-time/blob/master/CONTRIBUTING.md). ## License Copyright 2019 IceRock MAG Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

近期下载者

相关文件


收藏者