Skip to content

Latest commit

 

History

History

Drawing

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Lessons Learned

  • We can use images for fills and borders, but for that we need to use ImagePaint
  • If rendering is slow, we can try drawingGroup; it is not something to be used often, but only if you run into rendering performance problems
  • The multiply blend mode is quite common and there is a shortcut modifier: colorMultiply
  • SwiftUI Color.blue, .red and .green are not pure. They are blends of colors made to appear well in dark and light modes. For pure colors, you can initialize them manually: Color(red: 1, green: 0, blue: 0)
  • SwiftUI is smart to interpolate values that changed abruptly for animations. However, its usage in withAnimation is not automatic. SwiftUI will update the ‘animatableData’ property (defined in the Animatable protocol) with the last interpolated value. By defining it with a getter and setter you can make use of it in your Shape

Issues

  • Although I saw the tutorial with an example image that worked, I always had issues when running on my simulator.
  • I didn’t understand the last challenge of “Day 46 - Project 9 - Part 4” which is “Create a ColorCyclingRectangle shape that is the rectangular cousin of ColorCyclingCircle, allowing us to control the position of the gradient using a property.”. I couldn’t understand what he meant changing the gradient position. I can imagine it for a ConicGradient that you just change the center, but a LinerGradient? The fact that he said “Cousin” made me interpret that all the rest is the same, including the LinearGradient, and I just change the view to a rectangle and change the position of the gradient (maybe its center? but even so I coudln’t figure out how to do it for a LinearGradient