diff options
author | Jason Wray <friedbunny@users.noreply.github.com> | 2018-04-27 12:25:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-27 12:25:49 -0400 |
commit | c067865e7bcb1f8a8eec483a572fa874e5d15111 (patch) | |
tree | 497d51966568a84de02e63943e32f363bc6fc4ce /platform/darwin/src/NSString+MGLAdditions.m | |
parent | 1a39d7db483a26cd846c7875f3ccc9d54d5a0982 (diff) | |
download | qtlocation-mapboxgl-c067865e7bcb1f8a8eec483a572fa874e5d15111.tar.gz |
[ios, macos] Update minimum deployment versions to iOS 9, macOS 10.11 (#11776)
* [ios] Remove iOS 8 conditionals
* [ios, macos] Bump pod deployment targets
* [ios, macos] Add changelog entries
* [ios, macos] Update docs
* Remove unnecessary selector-based version checks
* Update SQLite note
* [ios, macos] Replace lightweight generics macros with direct use
Lightweight generics for Foundation collections are available everywhere with the bump to iOS 9 and macOS 10.11.
* Update deprecated macOS method
Diffstat (limited to 'platform/darwin/src/NSString+MGLAdditions.m')
-rw-r--r-- | platform/darwin/src/NSString+MGLAdditions.m | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/platform/darwin/src/NSString+MGLAdditions.m b/platform/darwin/src/NSString+MGLAdditions.m index a61f229511..d645490eb3 100644 --- a/platform/darwin/src/NSString+MGLAdditions.m +++ b/platform/darwin/src/NSString+MGLAdditions.m @@ -17,14 +17,9 @@ - (NSString *)mgl_titleCasedStringWithLocale:(NSLocale *)locale { NSMutableString *string = self.mutableCopy; NSOrthography *orthography; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - if ([NSOrthography respondsToSelector:@selector(defaultOrthographyForLanguage:)]) { + if (@available(iOS 11.0, macOS 10.13.0, *)) { orthography = [NSOrthography defaultOrthographyForLanguage:locale.localeIdentifier]; } -#pragma clang diagnostic pop -#endif [string enumerateLinguisticTagsInRange:string.mgl_wholeRange scheme:NSLinguisticTagSchemeLexicalClass options:0 orthography:orthography usingBlock:^(NSString * _Nonnull tag, NSRange tokenRange, NSRange sentenceRange, BOOL * _Nonnull stop) { NSString *word = [string substringWithRange:tokenRange]; if (word.length > 3 @@ -46,22 +41,18 @@ } - (NSString *)mgl_stringByTransliteratingIntoScript:(NSString *)script { - if (@available(iOS 9.0, *)) { - NSMutableString *string = self.mutableCopy; - NSStringTransform transform; - if ([script isEqualToString:@"Latn"]) { - transform = NSStringTransformToLatin; - } else if ([script isEqualToString:@"Hans"]) { - // No transform available. - } else if ([script isEqualToString:@"Cyrl"]) { - transform = @"Any-Latin; Latin-Cyrillic"; - } else if ([script isEqualToString:@"Arab"]) { - transform = @"Any-Latin; Latin-Arabic"; - } - return transform ? [string stringByApplyingTransform:transform reverse:NO] : string; - } else { - return self; + NSMutableString *string = self.mutableCopy; + NSStringTransform transform; + if ([script isEqualToString:@"Latn"]) { + transform = NSStringTransformToLatin; + } else if ([script isEqualToString:@"Hans"]) { + // No transform available. + } else if ([script isEqualToString:@"Cyrl"]) { + transform = @"Any-Latin; Latin-Cyrillic"; + } else if ([script isEqualToString:@"Arab"]) { + transform = @"Any-Latin; Latin-Arabic"; } + return transform ? [string stringByApplyingTransform:transform reverse:NO] : string; } @end |