4

Im creating a UIView animation:

UIView.animateWithDuration(0.1,
    delay: 0,
    options: (.AllowUserInteraction | .Repeat | .Autoreverse),
    animations:
        { () -> Void in

            // Animate

    },
    completion: nil)

But the compiler says “Could not find member “Autoreverse””, or whichever bit mask is on the end, unless there is one option. Has the syntax changed in Swift 2? I can’t see anything in the Swift docs nor do I remember anything in the WWDC presentations.

Or could it possibly just be a bug?

Thanks in advance

Adam Carter
  • 4,741
  • 5
  • 42
  • 103

1 Answers1

14

Answer found here:

Swift 2.0 - Binary Operator "|" cannot be applied to two UIUserNotificationType operands

“In Swift 2 the syntax has been updated..”

To cut it short, instead of

.Type | .Another | .Third

Use

[.Type, .Another, .Third]
Community
  • 1
  • 1
Adam Carter
  • 4,741
  • 5
  • 42
  • 103