Created
April 25, 2021 22:44
-
-
Save ilamanov/9f89d5a01db7e351fbbf73fd4713c44d to your computer and use it in GitHub Desktop.
Creating SwiftPieChart: rows def
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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