@Kitty asks:
how could I do to get half star instead of one star?
You own the Struct
This is the cool thing about structs. YOU get to decide what data you accept and how that data is displayed.
Take a close look at the RatingView struct's definition.
You'll see that it accepts an integer that represents the rating.
It also accepts two graphic images (onImage and offImage) to represent the on and off state.
struct RatingView: View {
// 👇🏼 Here! you accept an integer!
@Binding var rating: Int
var label = ""
var maximumRating = 5
// 👇🏼 Here! you accept an off image!
var offImage: Image?
// 👇🏼 Here! you accept an on image!
var onImage = Image(systemName: "star.fill")
//. ....... snip........
Your Challenge
You're asking the following:
How can I accept a Double value?
How can I represent THREE graphic images?
What logic do I need to change to display off, one-half, and whole images?
The first two questions should be easy for you to answer.
The third might be harder to answer.
Also, you may find that your users might find it easy to provide on and off graphics, but hard to find a half-filled graphic.
Keep Coding