-
-
Save laevandus/579c62d4cd4c0dc6a2d62c5119cb2e96 to your computer and use it in GitHub Desktop.
This file contains 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
/// A view displaying a star rating with a step of 0.5. | |
struct RatingsView: View { | |
/// A value in range of 0.0 to 5.0. | |
let value: Double | |
var body: some View { | |
HStack(spacing: 0) { | |
ForEach(0..<5) { index in | |
Image(systemName: imageName(for: index, value: value)) | |
} | |
} | |
.foregroundColor(.yellow) | |
} | |
func imageName(for starIndex: Int, value: Double) -> String { | |
// redacted | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment