Skip to content

Commit 07d8246

Browse files
committed
#97 Added localizedUppercase/loweracase/capitalized for iOS 8
1 parent f2ed98f commit 07d8246

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Sources/SwiftRichString/Attributes/TextTransform.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,29 @@ public enum TextTransform {
4646
switch self {
4747
case .lowercase:
4848
return { string in
49-
string.localizedLowercase
49+
if #available(iOS 9.0, iOSApplicationExtension 9.0, *) {
50+
return string.localizedLowercase
51+
} else {
52+
return string.lowercased(with: Locale.current)
53+
}
5054
}
5155

5256
case .uppercase:
5357
return { string in
54-
string.localizedUppercase
58+
if #available(iOS 9.0, iOSApplicationExtension 9.0, *) {
59+
return string.localizedUppercase
60+
} else {
61+
return string.uppercased(with: Locale.current)
62+
}
5563
}
5664

5765
case .capitalized:
5866
return { string in
59-
string.localizedCapitalized
67+
if #available(iOS 9.0, iOSApplicationExtension 9.0, *) {
68+
return string.localizedCapitalized
69+
} else {
70+
return string.capitalized(with: Locale.current)
71+
}
6072
}
6173

6274
case .lowercaseWithLocale(let locale):

SwiftRichString.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@
16361636
DYLIB_INSTALL_NAME_BASE = "@rpath";
16371637
INFOPLIST_FILE = Configs/SwiftRichString.plist;
16381638
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1639-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
1639+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
16401640
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
16411641
MACOSX_DEPLOYMENT_TARGET = 10.11;
16421642
MARKETING_VERSION = 3.5.0;
@@ -1661,7 +1661,7 @@
16611661
DYLIB_INSTALL_NAME_BASE = "@rpath";
16621662
INFOPLIST_FILE = Configs/SwiftRichString.plist;
16631663
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1664-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
1664+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
16651665
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
16661666
MACOSX_DEPLOYMENT_TARGET = 10.11;
16671667
MARKETING_VERSION = 3.5.0;

0 commit comments

Comments
 (0)