2

Is there a way to use Sequence as a type through an if statement? I wanted to do the following

if value is Sequence {
    print("sequence")
}

But I get an error

Protocol 'Sequence' can only be used as a generic constraint because it has Self or associated type requirements

Is there some other way to check against Sequence?

Denis Balko
  • 1,566
  • 2
  • 15
  • 30
  • Possible duplicate of [What does "Protocol ... can only be used as a generic constraint because it has Self or associated type requirements" mean?](https://stackoverflow.com/questions/24926310/what-does-protocol-can-only-be-used-as-a-generic-constraint-because-it-has) – Tamás Sengel Jul 03 '17 at 09:13
  • 1
    @the4kman it's not because OP is trying to check protocol conformance – Leo Jul 03 '17 at 09:15

0 Answers0