struct HueRotationExample: View { var body: some View { ZStack { Text("DevTechie") .font(.largeTitle) .bold() .foregroundColor(.white) } .frame(width: 200, height: 200) .background( RoundedRectangle(cornerRadius: 20) .foregroundColor(.orange) .hueRotation(.degrees(180)) ) } }
struct HueRotationExample: View { @State private var animate = false var body: some View { ZStack { Text("DevTechie") .font(.largeTitle) .bold() } .frame(width: 200, height: 200) .background( RoundedRectangle(cornerRadius: 20) .foregroundColor(.orange) .hueRotation(.degrees(animate ? 180 : 0)) ) .animation(.easeInOut.speed(0.1), value: animate) .onTapGesture { animate.toggle() } } }
With that we have reached the end of this article. Thank you once again for reading. Subscribe to our weekly newsletter at https://www.devtechie.com