Obsolete String.contains(_:) of Swift runtime

Starting with iOS 10, macOS 10.12, tvOS 10.0 and watchOS 3.0, Foundation contains
its own definition of String.contains(_:), which conflicts with the extension
provided by antlr.
This commit is contained in:
Jonas Auer 2017-03-28 11:52:32 +02:00
parent de4d129921
commit 79eb3721e4
1 changed files with 4 additions and 0 deletions

View File

@ -32,6 +32,10 @@ public extension String {
return self.replacingOccurrences(of: from, with: replacement, options: NSString.CompareOptions.literal, range: nil)
}
@available(iOS, obsoleted: 10.0)
@available(macOS, obsoleted: 10.12)
@available(tvOS, obsoleted: 10.0)
@available(watchOS, obsoleted: 3.0)
func contains(_ find: String) -> Bool {
return self.range(of: find) != nil
}