Structures

The following structures are available globally.

  • A no data view is shown when there is no data

    Usage

     /// 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)
         }
     }
    
    
    See more

    Declaration

    Swift

    public struct NoDataView<Content> : View where Content : View
  • A type-erased ShapeStyle

    See more

    Declaration

    Swift

    public struct AnyShapeStyle
  • SwiftUI View’s wrapper for all charts

    Usage

    let 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)
    
    
    See more

    Declaration

    Swift

    public struct ChartView<Content> : View where Content : View
  • A property wrapper combined both @ConstrainedValue and @Published

    Usage

    @PublishedConstrainedValue(0...10) public var width: CGFloat = 1
    
    See more

    Declaration

    Swift

    @propertyWrapper
    public struct PublishedConstrainedValue<Value> where Value : Strideable