Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Reusable Animations in Swift

Reusable Animations in Swift

A journey of mastering the endless nesting of completion blocks in UIView.animate.

Presentation was held on iOS Munich 08/03/2018
https://www.meetup.com/de-DE/The-Munich-iOS-Developers-Meetup/events/248032487/

Elmar Kretzer

March 08, 2018
Tweet

More Decks by Elmar Kretzer

Other Decks in Programming

Transcript

  1. Minor changes, Major pain Yeah, basically it’s the same animation,

    except its turning blue ... and later to the right, not the left ... exactly, but no alpha this time ...
  2. + easy to describe with words smaller green rotate 90

    normal yellow rotate 0 bigger green rotate 0 0.5 opacity then + + + + + + then
  3. easy to describe with words + smaller \.backgroundColor .~ green

    rotate 90 normal yellow rotate 0 bigger green rotate 0 0.5 opacity then + + + + + + then
  4. easy to describe with words >>> \.transform .~ scale(0.5) \.backgroundColor

    .~ green rotate 90 normal yellow rotate 0 bigger green rotate 0 0.5 opacity then + + + + + + then
  5. Way to easy But, hey ... these functions all create

    a single step. How do you compose the recursive steps?
  6. My learnings? Don’t do it - describe it. Reusability starts

    with atoms. There is no silver bullet.
  7. Me on Twitter: @elmkretzer thanks for your time! More Algebra:

    https://www.pointfree.co/ Composable CoreAnimation: https://github.com/bkase/swift-fp-animations