Skip to content

Commit 4bd6cf3

Browse files
authored
Merge pull request #1247 from wordpress-mobile/issue/xcode-10-compatibility
Compatibility with xcode 10
2 parents dc3253b + 1d0c77d commit 4bd6cf3

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

Aztec.xcodeproj/project.pbxproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
1A830346228583B200798076 /* NSBundle+AztecBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A830345228583B200798076 /* NSBundle+AztecBundle.swift */; };
11+
1EDDEBA5239A68320000A957 /* XCodeVersion.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 1EDDEBA4239A68320000A957 /* XCodeVersion.xcconfig */; };
1112
40359F261FD88A5F00B1C1D2 /* HRElementConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40359F251FD88A5F00B1C1D2 /* HRElementConverter.swift */; };
1213
40359F281FD88A7900B1C1D2 /* BRElementConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40359F271FD88A7900B1C1D2 /* BRElementConverter.swift */; };
1314
40A2986D1FD61B0C00AEDF3B /* ElementConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40A2986C1FD61B0C00AEDF3B /* ElementConverter.swift */; };
@@ -281,6 +282,7 @@
281282

282283
/* Begin PBXFileReference section */
283284
1A830345228583B200798076 /* NSBundle+AztecBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSBundle+AztecBundle.swift"; sourceTree = "<group>"; };
285+
1EDDEBA4239A68320000A957 /* XCodeVersion.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = XCodeVersion.xcconfig; sourceTree = "<group>"; };
284286
40359F251FD88A5F00B1C1D2 /* HRElementConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HRElementConverter.swift; sourceTree = "<group>"; };
285287
40359F271FD88A7900B1C1D2 /* BRElementConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRElementConverter.swift; sourceTree = "<group>"; };
286288
40A2986C1FD61B0C00AEDF3B /* ElementConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ElementConverter.swift; sourceTree = "<group>"; };
@@ -551,6 +553,14 @@
551553
/* End PBXFrameworksBuildPhase section */
552554

553555
/* Begin PBXGroup section */
556+
1EDDEBA3239A68090000A957 /* config */ = {
557+
isa = PBXGroup;
558+
children = (
559+
1EDDEBA4239A68320000A957 /* XCodeVersion.xcconfig */,
560+
);
561+
path = config;
562+
sourceTree = "<group>";
563+
};
554564
40A2986F1FD61B1C00AEDF3B /* Implementations */ = {
555565
isa = PBXGroup;
556566
children = (
@@ -597,6 +607,7 @@
597607
FF5B98E21DC29D0C00571CA4 /* README.md */,
598608
FF7A1C4A1E51F05700C4C7C8 /* CONTRIBUTING.md */,
599609
FFC2BBF81F2A25CF00E404FB /* CHANGELOG.md */,
610+
1EDDEBA3239A68090000A957 /* config */,
600611
5951CB901D8BC93600E1866F /* Aztec */,
601612
5951CB9B1D8BC93600E1866F /* AztecTests */,
602613
599F255A1D8BCD97002871D6 /* Frameworks */,
@@ -1492,6 +1503,7 @@
14921503
isa = PBXResourcesBuildPhase;
14931504
buildActionMask = 2147483647;
14941505
files = (
1506+
1EDDEBA5239A68320000A957 /* XCodeVersion.xcconfig in Resources */,
14951507
FF1F56A3239562B900E93A30 /* html_colors.json in Resources */,
14961508
FF0714021EFD78AF00E50713 /* Media.xcassets in Resources */,
14971509
);
@@ -1901,6 +1913,7 @@
19011913
};
19021914
5951CBA31D8BC93600E1866F /* Debug */ = {
19031915
isa = XCBuildConfiguration;
1916+
baseConfigurationReference = 1EDDEBA4239A68320000A957 /* XCodeVersion.xcconfig */;
19041917
buildSettings = {
19051918
CLANG_ENABLE_MODULES = YES;
19061919
CODE_SIGN_IDENTITY = "";

Aztec/Classes/TextKit/ColorProvider.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ public class ColorProvider {
4646
}
4747

4848
public lazy var codeBackgroungColor: UIColor = {
49+
#if XCODE11
4950
if #available(iOS 13.0, *) {
5051
return .secondarySystemBackground
5152
} else {
5253
return .lightGray
5354
}
55+
#endif
56+
return .lightGray
5457
}()
5558
}

Aztec/Classes/TextKit/TextView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,14 @@ open class TextView: UITextView {
249249
}
250250

251251
open lazy var defaultTextColor: UIColor? = {
252+
#if XCODE11
252253
if #available(iOS 13.0, *) {
253254
return UIColor.label
254255
} else {
255256
return UIColor.darkText
256-
}
257+
}
258+
#endif
259+
return UIColor.darkText
257260
}()
258261

259262
// MARK: - Plugin Loading

Aztec/Classes/TextKit/TextViewPasteboardDelegate.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ open class AztecTextViewPasteboardDelegate: TextViewPasteboardDelegate {
8181
}
8282

8383
private func fixColors(in string: NSAttributedString, using baseColor: UIColor?) -> NSAttributedString {
84+
#if XCODE11
8485
guard #available(iOS 13.0, *) else {
8586
return string
8687
}
88+
8789
let colorToUse = baseColor ?? UIColor.label
8890

8991
let newString = NSMutableAttributedString(attributedString: string)
@@ -93,6 +95,9 @@ open class AztecTextViewPasteboardDelegate: TextViewPasteboardDelegate {
9395
}
9496
}
9597
return newString
98+
#else
99+
return string
100+
#endif
96101
}
97102

98103
/// Tries to paste raw text from the clipboard, replacing the selected range.

config/XCodeVersion.xcconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_AZTEC_IOS_130000 = XCODE11
2+
_AZTEC_IOS_120000 = XCODE10
3+
4+
AZTEC_IOS_SDK = $(_AZTEC_IOS_$(SDK_VERSION_MAJOR))
5+
6+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) $(AZTEC_IOS_SDK)

0 commit comments

Comments
 (0)