I would like to create moon shape. Currently, I archived it by placing another circle on top and then giving it the same colour as the background colour.
Perhaps using a clipped shape or masking layer.
I was wondering if there's a better way to do this?
ZStack{
Circle().foregroundColor(isDarkMode ? Color( colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)) : Color.yellow)
.frame(width: 30, height: 30)
.offset(x: isDarkMode ? 20 : -20)
Circle().foregroundColor(isDarkMode ? Color( colorLiteral(red: 0.1764705926, green: 0.4980392158, blue: 0.7568627596, alpha: 1)) : Color.white)
.frame(width: 30, height: 30)
.offset(x: isDarkMode ? 6 : -20).rotationEffect(.degrees( isDarkMode ? -40 : 0))
}