Nil is not compatible with expected argument type UIViewAnimationOptions Nil is not compatible with expected argument type UIViewAnimationOptions ios ios

Nil is not compatible with expected argument type UIViewAnimationOptions


You may replace options: nil with options: [] should make the error goes way.

Good luck !


UIViewAnimationOptions is an enum backed by integers. You should pass 0. Here is the doc for the enum.


It's because UIViewAnimationOptions is an OptionSet type, not Optional typeOptionSet according to apple

You use the OptionSet protocol to represent bitset types, where individual bits represent members of a set.

it's mainly used to create a combined flag from the current flags inside the set,in your case animation flags or types we can call them, this will give you the ability to combine options to make the final desired option, there are about 23 option, however in your case you can just pass an empty OptionSet as []