Introducing the Swift Charts framework
Creating charts that are simple and easy to use was always a challenge. Unlike Tables, Collection views, or Lists, most third-party chart frameworks never felt natural in UIKit/SwiftUI.
In iOS 16, Apple announced Swift Charts, a SwiftUI framework that presents structured data in a chart and fits nicely in a SwiftUI view.
Let’s see an example of a bar chart:
import Charts struct BarMarkView: View { struct Sales: Identifiable { var id: UUID = UUID() let itemType: String let qty: Int } let data: [Sales] = [ Sales(itemType: "Apples", qty: 50), Sales(itemType: "Oranges", qty: 60), &...