Returns a Boolean value indicating whether a value is included in a range.
- Xcode 8.0+
- Swift Standard Library
A value to match against
You can use this pattern matching operator (
~=) to test whether a value is included in a range. The following example uses the
~= operator to test whether an integer is included in a range of single-digit numbers.
~= operator is used internally in
case statements for pattern matching. When you match against a range in a
case statement, this operator is called behind the scenes.