0

I'm running Xcode 10 beta with Swift 4.2. Xcode wants to convert my Xcode 9.4.1 with Swift 4.1 code to Swift 4.2 syntax. The changes are all UIView.animate(... options: ...).

I using options like .curveEaseIn which worked fine before but it wants to change them to UIView.AnimationOptions.curveEaseIn.

What happened to Swift's ENUM type inference?

Ashish Kakkad
  • 23,586
  • 12
  • 103
  • 136
mretondo
  • 187
  • 1
  • 9

2 Answers2

6

It was UIViewAnimationOptions.curveEaseIn in Swift 4.1. So, the migrator has detected your .curveEaseIn as UIViewAnimationOptions.curveEaseIn and trying to convert it to UIView.AnimationOptions.curveEaseIn.

Seems current migrator does not like dot-leaded notation.

You can convert all occurrences of UIView.AnimationOptions.curveEaseIn into .curveEaseIn manually, and Swift type inference would work if appropriate.

You may want to write a feature request proposing improvement of the migrator.


(Addition) Seems Xcode 10 beta 3 has fixed this issue, though I have not tested yet.

Xcode 10 beta 3 Release Notes

OOPer
  • 47,149
  • 6
  • 107
  • 142
0

AnimationOptions is a enum under UIView now in swift 4.2

You can also take a look at this git repo which contains a list of syntax changes. Please feel free to contribute with the changes you've met in your project.

https://github.com/alexliubj/Swift-Migration-4.2

Alex L
  • 309
  • 2
  • 9