Structures
The following structures are available globally.
-
A no data view is shown when there is no data
Usage
See more/// default NoDataView let noDataView = NoDataView() /// provide your own ViewBuilder to create the no data view let noDataView = NoDataView { GeometryReader { proxy in VStack(alignment: .center) { Text("☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹") Text("Customized No Data View") Text("☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹") } .frame(width: proxy.size.width, height: proxy.size.height) .border(Color.primary, width: 1) } }
Declaration
Swift
public struct NoDataView<Content> : View where Content : View
-
A type-erased ShapeStyle
See moreDeclaration
Swift
public struct AnyShapeStyle
-
SwiftUI View’s wrapper for all charts
Usage
See morelet model = ChartModel(chartType: .line, data: [[nil, 220, nil, 250, 200, nil, 230], [160, nil, 130, 170, nil, 190, 180]], titlesForCategory: [["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"]] ) /// default no data view is shown if there is no data in model ChartView(model) .frame(width: 300, height: 200) /// create a chart view with customized no data view ChartView(self.info.1[i], noDataView: NoDataView { GeometryReader { proxy in VStack(alignment: .center) { Text("☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹") Text("Customized No Data View") Text("☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹☹") } .frame(width: proxy.size.width, height: proxy.size.height) .border(Color.primary, width: 1) } }).frame(width: 300, height: 200)
Declaration
Swift
public struct ChartView<Content> : View where Content : View
-
A property wrapper combined both @ConstrainedValue and @Published
Usage
See more@PublishedConstrainedValue(0...10) public var width: CGFloat = 1
Declaration
Swift
@propertyWrapper public struct PublishedConstrainedValue<Value> where Value : Strideable