SwiftUI Tutorials > Landmarks App > Drawing Paths and Shapes > BadgeBackground.swift > Gradient Fill Does Not Fill Hexagon Shape Entirely
I have run into the same issue taking this tutorial using xCode Version 16.1 (16B40) on a MacBook air m2 16GB RAM Running Sequoiia 15.3.
It's a relief to know this issue is affecting more than just myself. For a minute there i thought I was losing my mind. I reviewed all the code i had written so far and compared it to the files in the 'Complete' folder of the downloaded project files, and coudl not find an error. it was only when retraced my steps on the the BadgBackground.swift file that I learned the shape was correct until I reached the part of the tutorial when you change the fill from .black to .linearGradient
I have concluded that it is definitely the gradient addition at the end of the 'Draw Badge Background' section. All works well as long as the Hexagon is a solid color. I tried changing the gradient using system colors instead of using the colors declared in the gradientStart & gradientEnd variables.
Gradient(colors: [Color(.blue), Color(.red)]),
Even though the gradient changes using blue and red, it still does not completely fill the shape. I redeclared the variable colors using system colors:
static let gradientStart: Color = Color(.black)//= Color(red: 239.0 / 255, green: 120.0 / 255, blue: 221.0 / 255)
static let gradientEnd: Color = Color(.pink)//Color(red: 239.0 / 255, green: 172.0 / 255, blue: 120.0 / 255)
Then used the declared variables in the Gradient (colors: []) as in the tutorial's declaration and still had the same result where the shape was not completely filled with the gradient.
Commenting out
.aspectRatio(contentMode: .fit)
does not affect the fill.