Skip to content

Latest commit

 

History

History

trikot-foundation

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Trikot.foundation

Kotlin Multiplatform implementation of threads, timers, atomic references, string utilities 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

Strings

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

Dates (Basic from and to ISO8601)

Multiplatform iso date implementation is provided by kotlinx-datetime

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

build.gradle

    dependencies {
        maven { url("https://s3.amazonaws.com/mirego-maven/public") }
    }

    ios() {
        binaries {
            framework {
                export "com.mirego.trikot:trikotFoundation:$trikot_version"
            }
        }
    }
    sourceSets {
        commonMain {
            dependencies {
                implementation "com.mirego.trikot:trikotFoundation:$trikot_version"
            }
        }
    }