1

I have some query regarding documentation provided by apple at this https://developer.apple.com/documentation/swift/string

Why documentation doesn't contain components(separatedBy:) method . Instead inside "Splitting a String" section new method split(separator:maxSplits:omittingEmptySubsequences: is added by apple.

Sudhir kumar
  • 659
  • 5
  • 21
  • 1
    `Why documentation doesn't contain components(separatedBy:) method` Because `components(separatedBy:)` is for NSString, not for String - it's in Foundation, not in Swift itself. – Eric Aya Sep 21 '17 at 12:07
  • if this method is in NSString then how can we call `components(separatedBy:)` directly on String without casting it to NSString. Please help in understanding this. – Sudhir kumar Sep 21 '17 at 12:13
  • There's nothing special to do because NSString is "bridged" to String. You can call `components(separatedBy:)` directly on a String. *But* the method is not declared in Swift, it is declared in Foundation, that's the difference. – Eric Aya Sep 21 '17 at 12:15

0 Answers0