Hello Swift Charts — Create SwiftUI Graphs for iOS 16 | by José Neves | Jun, 2022

In real life, it’s common to have a list of data to show, and for that we do not create Marks manually, to simplify our life. The Chart initializer can receive a list of Identifiable objects and escape a closure with ForEach loop.


One of the most powerful features of Swift Charts is the possibility to combine multiple marks to create a custom view.

Let’s see an example combining LineMark and Point:


Continuing the example above, we can also combine multiple data categories in the same chart.

To do this, we need to provide some info to chart know how to split data in multiple charts. The easy way is using the foregroundStyle(by:) modifier passing a PlottableValue to create “categories“.

1*GE 7BDdbrPAOkcY3EaALrA

News Credit

%d bloggers like this: