Skip to content

API

Names are the same on both platforms, except where the table says otherwise. In Kotlin the packages are today.torke.kit.session, .engine, .input, .format, .analysis, .suspension and .sensors.

Member Swift Kotlin
Create RunSession(options:) RunSession(options)
Live state snapshot (@Observable) snapshot: StateFlow<RunSnapshot>
Events events() -> AsyncStream<RunEvent> events: Flow<RunEvent>
Read a source start(with:) start(provider, scope)
Read to the end await run(with:) suspend run(provider)
Arm arm(mode:) arm(mode)
Close / drop / stop finish(), cancel(), stop() same
App error fail(_:) fail(failure)
Recording recording(device:app:) -> TorkeRun recording(device, app)
Feed a sample process(_:) -> [RunEvent] process(sample): List<RunEvent>

phase, speed, speedKmh, elapsed, distance, gpsAccuracy, location, startLocation, mode, result, interval, gpsRate. See The live session.

idle, waitingStill, armed, running(start), finished, failed(failure). Capitalized in Kotlin: RunPhase.Idle, RunPhase.Running(start)…

Swift Kotlin Measures
.standingStart RunMode.StandingStart A standing start (the default).
.rolling(fromKmh:toKmh:) RunMode.Rolling(fromKmh, toKmh) A rolling range.
.braking(fromKmh:) RunMode.Braking(fromKmh) Braking to a stop.
Swift Kotlin When
.armed RunEvent.Armed Still long enough.
.disarmed RunEvent.Disarmed Moved without launching.
.launched(time:location:) RunEvent.Launched Launched.
.passed(mark, elapsed:) RunEvent.Passed Live estimate of a mark.
.finished(result) RunEvent.Finished Official times.
.intervalFinished(result) RunEvent.IntervalFinished A rolling or braking run finished.
.failed(failure) RunEvent.Failed No run.

noLaunch, noInterval, noMotionSensors, locationDenied.

stillWindow, stillAccel, stillSpeed, launchAccel, launchHoldAccel, launchHold, launchGrace, finishDistance, backOffRatio, maxDuration, analysisDistance. See Tuning the detection.

Field Unit
launchTime s, on the samples’ clock
sixtyFeet, zeroTo100, eighthMile, quarterMile s
eighthMileKmh, quarterMileKmh, topSpeedKmh km/h
launchG, peakG g
accelBias m/s², the bias the filter learned
trace [TracePoint]: t, speed and distance

Extensions: zeroTo60mph, thousandFeet, halfMile, time(toKmh:), time(fromKmh:toKmh:), elapsed(toDistance:), speedKmh(atDistance:), corrected(for:) (Kotlin: corrected(weather)).

kind (rolling, braking), fromKmh, toKmh, time, distance, peakG, startTime.

DragMark: sixtyFeet, zeroTo100, eighthMile, quarterMile.

DragDistance (meters): rollout, sixtyFeet, eighthMile, thousandFeet, quarterMile, halfMile, and the speeds speed100, speed60mph. Upper case in Kotlin: DragDistance.QUARTER_MILE.

A protocol (an interface in Kotlin) with a single method: samples(), which delivers SensorSamples in time order. Implement it to plug in your own source (a file from another tool, test data).

The phone’s sensors. iOS: PhoneSensorProvider() and await requestPermission(). Android: PhoneSensorProvider(context, fullTracking), with ACCESS_FINE_LOCATION already granted; gnss (StateFlow<GnssInfo?>: satellitesInFix, satellitesVisible, meanCn0).

The station pressure for Weather: isAvailable and stationPressureHpa() (async in Swift, suspend in Kotlin).

RecordedRunProvider(run, speed:): speed 0 (the default) replays as fast as possible; 1, in real time. RecordedRunProvider.demo(seed:) is the simulated run.

Type Fields
RawMotionSample t, user (acceleration without gravity, m/s²), gravity
GPSSample t, speed, speedAccuracy, latitude, longitude, horizontalAccuracy, altitude
Coordinate latitude, longitude

format, version, recordedAt, device, app, motion, gps, result, interval, weather, suspension.

Methods: analyze(stopDistance:), rolling(fromKmh:toKmh:), braking(fromKmh:), quality(), startLocation, encoded() / TorkeRun.decode(_:) (Kotlin: encode() / TorkeRun.decode(text)). See torke.run format.

Weather(temperatureC:humidity:pressureHpa:). Properties: vaporPressureHpa, dryPressureHpa, airDensity, densityAltitude, correctionFactor. Methods: corrected(time:), corrected(speed:) (Kotlin: correctedTime, correctedSpeed).

fromTrapSpeed(massKg:quarterMileKmh:), fromElapsedTime(massKg:quarterMile:), wheelPower(_:massKg:dragArea:rollingResistance:airDensity:) -> [PowerPoint], peakWheelHp(…). PowerPoint: t, speedKmh, watts.

grade (good, fair, poor), issues, gpsRate, speedAccuracy, longestGpsGap, slope, tiltChange, disagreement. RunQuality.assess(run, limits:) with RunQuality.Limits. See Run quality.

Type What it is
Timeslip The timeslip: sixtyFeet, threeThirtyFeet, eighthMile, eighthMileSpeed, thousandFeet, quarterMile, quarterMileSpeed, speedUnit (kmh, mph), reactionTime, notes.
ValidationMark The comparable marks; isSpeed, value(in:).
MarkComparison mark, measured, reference, error.
RunComparison label, marks. Swift: RunComparison(result:timeslip:label:); Kotlin: RunComparison.of(…). TorkeRun.compare(with:) analyzes again and compares.
ValidationReport runs, skipped, summaries, targets, passed. Kotlin: ValidationReport.of(inputs).
MarkSummary count, bias, meanAbsolute, rms, worst, limit, passed.
ValidationTargets The allowed error per mark; TorkeKit’s targets by default.
ValidationSet The torke.validation JSON: decode, report(relativeTo:) (Kotlin: report(directory)).

See Validating with timeslips.

Type What it is
ChristmasTree type (pro, sportsman), activatedAt, lights, greenAt, lit(at:), reaction(leftStageAt:), estimatedReaction(launchedAt:); ChristmasTree.start(type:stagedAt:seed:).
TreeLight, Reaction A light (kind, time); the reaction (time, isRedLight, isPerfect).
RunResult leftStageAt, reaction(on:), package(on:) (Kotlin: reaction(tree), packageTime(tree)).
LapTimer process(_:) → LapEvent (started, sector, lap); laps, bestLap, delta, predictedLap, elapsed(at:), minimumLapTime.
TimingLine, Lap A two-point line; a lap (number, start, time, sectors, distance).
Geofence circle(center:radius:) or polygon(_:), contains; [Geofence].first(containing:) (Kotlin: firstContaining).
GeofenceCheck TorkeRun.check(_:): startInside, shareInside, allInside.
Geo distance(_:_:) (haversine) and local(_:origin:).

See Track tools.

Type What it is
SuspensionSetup kind (fourLink, ladderBar, torqueArm), unit, wheelbase, cgHeight, points, notes. Constructors fourLink, ladderBar, torqueArm; converted(to:), geometry().
SuspensionGeometry instantCenter, icLength, icHeight, antiSquat, bars, warnings.
Bar name, rear, front, angle, length.
Point2, LengthUnit A point x, y; inches or centimeters.
ValueRange min, max, contains, miss.
TargetWindow icLength, icHeight, antiSquat, nearShare; status(_:of:), score(_:).
FourLinkHoles The holes of each bracket; ranked(base:target:limit:) -> [HoleOption].
HoleOption holes, setup, geometry, score.
SetupChange icLength, icHeight, antiSquat, moved. Swift: SetupChange(from:to:); Kotlin: SetupChange.between(before, after).