- iOS: 15.0 or later.
- macOS: 12.0 or later.
You can install RatioBarChart
using the Swift Package Manager.
- In Xcode, select "File" > "Add Package Dependencies".
- Copy & paste the following into the "Search or Enter Package URL" search bar.
https://github.com/JamesSedlacek/RatioBarChart.git
- Xcode will fetch the repository & the "RatioBarChart" library will be added to your project.
There's a default initializer that sets the font, text, and colors for a win/loss ratio bar chart.
import RatioBarChart
import SwiftUI
struct ContentView: View {
var body: some View {
RatioBarChart(wins: 50, losses: 50)
}
}
The initializer allows you to customize the chart's colors, text, & font.
public init(firstCount: Int, secondCount: Int,
firstColor: Color, secondColor: Color,
topLeftText: String, topRightText: String,
bottomLeftText: String, bottomRightText: String,
topFont: FontRepresentable = .systemFont(ofSize: 16, weight: .semibold),
bottomFont: FontRepresentable = .systemFont(ofSize: 14, weight: .medium))