Skip to content
Core utilities for Kotlin Multiplatform
Kotlin Groovy
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
documentation
foundation mirego.release commit next working version Jan 6, 2020
gradle/wrapper
jenkins-jobs
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
LICENSE.md
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat Initial commit Aug 16, 2019
settings.gradle

README.md

Trikot.foundation

Kotlin Multiplatform implementation of threads, timers, atomic references and iso8601 dates.

AtomicReference and AtomicListReference

AtomicReference implementation on all platform

val atom = AtomicReference("a")
atom.compareAndSet("a", "b")
atom.setOrThrow("c", "b") // Will throw

val list = AtomicListReference<String>()
list.add("a") // Thread safely adds "a"
list.remove("a") // Thread safely removes "a"

Timers

Single and repeatable multiplatform timer implementations

 val doOnceTimer = TimerFactory.single(12.seconds) { doSomething() }
 val repeatTimer = TimerFactory.repeatable(12.seconds) { doSomething() }
 repeatTimer.cancel() // stop the timer

Dates (Basic from and to ISO8601)

Multiplatform iso date implementation

val now = Date.now()            // GMT
val date = now + 5.seconds
val isoDate = date.toISO8601()  // yyyy-MM-dd:mm:dd:ssZ
val otherDate = Date.fromISO8601(isoDate)
otherDate == date               // true

Multiplatform freezing

Allow freezing in common code. Does nothing in js and JVM.

freeze(objectToFreeze)

In swift, use access freeze via MrFreezeKt class helper to freeze object.

MrFreezeKt.freeze(objectToFreeze: objectToFreeze)

Dispatch Queues

While waiting for Sharing of coroutines across threads in Kotlin/Native to work correctly. Trikot.foundation provide a standard Thread model based on queues. When this issue will be resolved, DispatchQueues will be converted to Coroutines.

See: Dispatch Queues

Installation

Import dependencies
    api "com.mirego.trikot:foundation:$trikot_foundation_version"
    jvm "com.mirego.trikot:foundation-jvm:$trikot_foundation_version"
    js "com.mirego.trikot:foundation-js:$trikot_foundation_version"
    iosx64 "com.mirego.trikot:foundation-iosx64:$trikot_foundation_version"
    iosarm64 "com.mirego.trikot:foundation-iosarm64:$trikot_foundation_version"
    iosarm32 "com.mirego.trikot:foundation-iosarm32:$trikot_foundation_version"
    tvosx64 "com.mirego.trikot:foundation-tvosx64:$trikot_foundation_version"
    tvosarm64 "com.mirego.trikot:foundation-tvosarm64:$trikot_foundation_version"

License

Trikot.foundation is © 2018-2019 Mirego and may be freely distributed under the New BSD license. See the LICENSE.md file.

About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We’re a team of talented people who imagine and build beautiful Web and mobile applications. We come together to share ideas and change the world.

We also love open-source software and we try to give back to the community as much as we can.

You can’t perform that action at this time.