Foundation overlay: add overlays for new NSString APIs

Swift SVN r28984
This commit is contained in:
Dmitri Hrybenko
2015-05-24 10:39:21 +00:00
parent bbf61217cd
commit d45413efb8
2 changed files with 318 additions and 14 deletions

View File

@@ -308,6 +308,16 @@ extension String {
return _ns.capitalizedString as String
}
// @property (readonly, copy) NSString *localizedCapitalizedString NS_AVAILABLE(10_11, 9_0);
/// A capitalized representation of the `String` that is produced
/// using the current locale.
@available(iOS, introduced=9.0)
@available(OSX, introduced=10.11)
public var localizedCapitalizedString: String {
return _ns.localizedCapitalizedString
}
// - (NSString *)capitalizedStringWithLocale:(NSLocale *)locale
/// Returns a capitalized representation of the `String`
@@ -316,7 +326,6 @@ extension String {
return _ns.capitalizedStringWithLocale(locale) as String
}
// - (NSComparisonResult)caseInsensitiveCompare:(NSString *)aString
/// Returns the result of invoking `compare:options:` with
@@ -1000,6 +1009,16 @@ extension String {
//===--- Omitted for consistency with API review results 5/20/2014 ------===//
// @property long long longLongValue
// @property (readonly, copy) NSString *localizedLowercaseString NS_AVAILABLE(10_11, 9_0);
/// A lowercase version of the string that is produced using the current
/// locale.
@available(iOS, introduced=9.0)
@available(OSX, introduced=10.11)
public var localizedLowercaseString: String {
return _ns.localizedLowercaseString
}
// - (NSString *)lowercaseStringWithLocale:(NSLocale *)locale
/// Returns a version of the string with all letters
@@ -1164,6 +1183,36 @@ extension String {
)
}
// - (BOOL)localizedStandardContainsString:(NSString *)str NS_AVAILABLE(10_11, 9_0);
/// Returns `true` if `self` contains `string`, taking the current locale
/// into account.
///
/// This is the most appropriate method for doing user-level string searches,
/// similar to how searches are done generally in the system. The search is
/// locale-aware, case and diacritic insensitive. The exact list of search
/// options applied may change over time.
@available(iOS, introduced=9.0)
@available(OSX, introduced=10.11)
public func localizedStandardContainsString(string: String) -> Bool {
return _ns.localizedStandardContainsString(string)
}
// - (NSRange)localizedStandardRangeOfString:(NSString *)str NS_AVAILABLE(10_11, 9_0);
/// Finds and returns the range of the first occurrence of a given string,
/// taking the current locale into account.
///
/// This is the most appropriate method for doing user-level string searches,
/// similar to how searches are done generally in the system. The search is
/// locale-aware, case and diacritic insensitive. The exact list of search
/// options applied may change over time.
@available(iOS, introduced=9.0)
@available(OSX, introduced=10.11)
public func localizedStandardRangeOfString(string: String) -> Range<Index>? {
return _optionalRange(_ns.localizedStandardRangeOfString(string))
}
// @property NSStringEncoding smallestEncoding;
/// Returns the smallest encoding to which the `String` can
@@ -1427,6 +1476,13 @@ extension String {
return _ns.substringWithRange(_toNSRange(aRange))
}
// @property (readonly, copy) NSString *localizedUppercaseString NS_AVAILABLE(10_11, 9_0);
@available(iOS, introduced=9.0)
@available(OSX, introduced=10.11)
public var localizedUppercaseString: String {
return _ns.localizedUppercaseString as String
}
// - (NSString *)uppercaseStringWithLocale:(NSLocale *)locale
@@ -1472,6 +1528,7 @@ extension String {
url, atomically: useAuxiliaryFile, encoding: enc)
}
/// Perform string transliteration.
@available(iOS, introduced=9.0)
@available(OSX, introduced=10.11)
public func stringByApplyingTransform(