Daily iOS
SwiftUI

Swift Charts implementation

This is on-site coding. For a stock app, how would you build a Chart in Swift Charts that draws the last 30 days of closing prices as a line, with axes, range, and today's value highlighted?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Draw an Identifiable data array with Chart { ForEach { LineMark(x: .value, y: .value) } } and tune the axes with chartYScale and chartXAxis. Highlight today's value with a PointMark or RuleMark.

Share a question