HomePostsKalshi Style Swifui Charts

Building custom charts like Kalshi

Published Oct 23, 2026
⋅
Updated Oct 24, 2026

While exploring Kalshi app during World Cup I have been curious how these custom charts are made - what is the logic behind percentage placement and intercections between odds. Down below I made an interactive breakdown of my approach recreating this type of chart and integrating a logic to handle scribble gestures without blocking parent scrolling

Integrate this chart and any other polished components directly to your app codebase with SwiftUX MCP
Start here

Managing gesture controls with SwiftUI

Scrubbing needs your finger's position from the moment the press starts. It also must not block a parent list from scrolling. None of SwiftUI's built-in gestures do both like DragGesture or LongPressGesture

UIKit's UILongPressGestureRecognizer does all of it. It waits 0.1 s, then reports the location on begin and on every move. If you swipe away before the hold finishes, it fails and the scroll goes through. iOS 18 added UIGestureRecognizerRepresentable, which lets a SwiftUI view attach a UIKit recognizer directly, so I used it for gestures

Unlike Any-Distance reference which I used as reference for custom chart line, I used UIImpactFeedbackGenerator wiring to SwiftUI's .sensoryFeedback, which fires whenever scrubIndex changes

Chart component