type of Expression is ambiguous ...

the following code gives me an issue in Swift 3:


UIView.animateWithDuration(highlightTime,

delay: 0.0,

options: .CurveLinear & .AllowUserInteraction & .BeginFromCurrentState, // here Type of expression is ambigous without more context

animations: {

button.backgroundColor = highlightColor

}, completion: { finished in

button.backgroundColor = originalColor

var newIndex : Int = index + 1

self.playSequence(newIndex, highlightTime: highlightTime)

})

}


The code was copied frok an earlier Swift version

Accepted Answer

options are now mostly (all?) set up to use sets. If no options are needed, you'd pass an empty set


[]


For the code above, your options would be:


UIView.animate(withDuration: highlightTime, delay: 0.0,
   options: [.curveLinear, .allowUserInteraction, .beginFromCurrentState],
   animations: <your closure here>, completion: <your closure here>)


Note the API signature change as well.

Thank you very much, this helped me.

I need to find the proper link to the swift documentation, as well as application examples.

(Sorry I,m of the old school, used to printed manuals 😉)

It's not printed, but that should do the work :


Apple official doc:

h ttps://developer.apple.com/documentation/swift/optionset


Some examples:

h ttps://oleb.net/blog/2016/09/swift-option-sets/


And a discussion on the reasons for change:

h ttps://medium.com/the-traveled-ios-developers-guide/swift-option-set-d939d1228557

type of Expression is ambiguous ...
 
 
Q