Skip to content

Instantly share code, notes, and snippets.

@ilamanov
Created April 25, 2021 22:44
Show Gist options
  • Save ilamanov/9f89d5a01db7e351fbbf73fd4713c44d to your computer and use it in GitHub Desktop.
Save ilamanov/9f89d5a01db7e351fbbf73fd4713c44d to your computer and use it in GitHub Desktop.
Creating SwiftPieChart: rows def
struct PieChartRows: View {
var colors: [Color]
var names: [String]
var values: [String]
var percents: [String]
var body: some View {
VStack{
ForEach(0..<self.values.count){ i in
HStack {
RoundedRectangle(cornerRadius: 5.0)
.fill(self.colors[i])
.frame(width: 20, height: 20)
Text(self.names[i])
Spacer()
VStack(alignment: .trailing) {
Text(self.values[i])
Text(self.percents[i])
.foregroundColor(Color.gray)
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment