See the new trikot repository for releases starting from 3.0.0.
Kotlin Multiplatform implementation of threads, timers, atomic references, string utilities and iso8601 dates.
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"
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
Multiplatform string extensions for formating, normalizing
val string = "Où sont les bûches de Noël durant l'été?".normalize()
string == "Ou sont les buches de Noel durant l'ete?" // true
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
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)
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
api "com.mirego.trikot:trikotFoundation:$trikot_foundation_version"
jvm "com.mirego.trikot:trikotFoundation-jvm:$trikot_foundation_version"
js "com.mirego.trikot:trikotFoundation-js:$trikot_foundation_version"
android "com.mirego.trikot:trikotFoundation-android:$trikot_foundation_version"
iosx64 "com.mirego.trikot:trikotFoundation-iosx64:$trikot_foundation_version"
iosarm64 "com.mirego.trikot:trikotFoundation-iosarm64:$trikot_foundation_version"
iosarm32 "com.mirego.trikot:trikotFoundation-iosarm32:$trikot_foundation_version"
tvosx64 "com.mirego.trikot:trikotFoundation-tvosx64:$trikot_foundation_version"
tvosarm64 "com.mirego.trikot:trikotFoundation-tvosarm64:$trikot_foundation_version"
Trikot.foundation is © 2018-2019 Mirego and may be freely distributed under the New BSD license. See the LICENSE.md
file.
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.