0

I am using swift 2.2 and getting the error Value of type 'String' has no member 'contains', where as the same works in swift 2.1. Can anyone please help if contains method is deprecated or removed in swift 2.2.

code

var another = "Test"
another.contains("we")

error :

Value of type 'String' has no member 'contains'

luk2302
  • 55,258
  • 23
  • 97
  • 137
Max
  • 5,380
  • 6
  • 42
  • 66
  • 5
    http://stackoverflow.com/questions/24034043/how-do-i-check-if-a-string-contains-another-string-in-swift – kostek May 25 '16 at 12:10

1 Answers1

1

Use:

another.containsString("we")

You'll have use:

import Foundation

in your code for containsString

Steve Ives
  • 7,894
  • 3
  • 24
  • 55