Skip to content

Commit 0fd30b2

Browse files
authored
Use Xcode 15.0.1 (#1377)
2 parents 8ea911f + 1dd0099 commit 0fd30b2

26 files changed

Lines changed: 284 additions & 235 deletions

.buildkite/pipeline.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Nodes with values to reuse in the pipeline.
22
common_params:
33
plugins: &common_plugins
4-
- automattic/a8c-ci-toolkit#2.13.0
4+
- automattic/a8c-ci-toolkit#3.0.1
55
# Common environment values to use with the `env` key.
66
env: &common_env
7-
IMAGE_ID: xcode-13
7+
IMAGE_ID: xcode-15.0.1
88

99
# This is the default pipeline – it will build and test the app
1010
steps:
@@ -24,9 +24,11 @@ steps:
2424
- label: "🔬 Validate Podspecs"
2525
key: "validate"
2626
command: |
27-
validate_podspec
27+
validate_podspec --patch-cocoapods
2828
env: *common_env
2929
plugins: *common_plugins
30+
agents:
31+
queue: mac
3032

3133
#################
3234
# Lint

Aztec.xcodeproj/project.pbxproj

Lines changed: 12 additions & 18 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+
247D2C662AF5B90900301B71 /* UIKit+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 247D2C652AF5B90900301B71 /* UIKit+Extensions.swift */; };
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 */; };
@@ -283,6 +284,7 @@
283284

284285
/* Begin PBXFileReference section */
285286
1A830345228583B200798076 /* NSBundle+AztecBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSBundle+AztecBundle.swift"; sourceTree = "<group>"; };
287+
247D2C652AF5B90900301B71 /* UIKit+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIKit+Extensions.swift"; sourceTree = "<group>"; };
286288
40359F251FD88A5F00B1C1D2 /* HRElementConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HRElementConverter.swift; sourceTree = "<group>"; };
287289
40359F271FD88A7900B1C1D2 /* BRElementConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRElementConverter.swift; sourceTree = "<group>"; };
288290
40A2986C1FD61B0C00AEDF3B /* ElementConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ElementConverter.swift; sourceTree = "<group>"; };
@@ -345,7 +347,6 @@
345347
B5E607321DA56EC700C8A389 /* TextListFormatterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextListFormatterTests.swift; sourceTree = "<group>"; };
346348
B5E94D0F1FE01334000E7C20 /* FigureElementConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FigureElementConverter.swift; sourceTree = "<group>"; };
347349
B5F84B601E70595B0089A76C /* NSAttributedString+Analyzers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+Analyzers.swift"; sourceTree = "<group>"; };
348-
B5F84B621E706B720089A76C /* NSAttributedStringAnalyzerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSAttributedStringAnalyzerTests.swift; sourceTree = "<group>"; };
349350
E109B51B1DC33F2C0099605E /* LayoutManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LayoutManager.swift; sourceTree = "<group>"; };
350351
E11B775F1DBA14B40024E455 /* BlockquoteFormatterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockquoteFormatterTests.swift; sourceTree = "<group>"; };
351352
F1000CE61EAA44AA0000B15B /* String+EndOfLine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+EndOfLine.swift"; sourceTree = "<group>"; };
@@ -614,7 +615,6 @@
614615
5951CB9B1D8BC93600E1866F /* AztecTests */,
615616
599F255A1D8BCD97002871D6 /* Frameworks */,
616617
5951CB8F1D8BC93600E1866F /* Products */,
617-
F185A59D2123C07200DDFAB1 /* Recovered References */,
618618
);
619619
sourceTree = "<group>";
620620
};
@@ -1055,6 +1055,7 @@
10551055
F15415F8213447D70096D18E /* TextViewStub.swift */,
10561056
B5D575851F2288E2003A62F6 /* TextViewStubAttachmentDelegate.swift */,
10571057
B52220D21F86A05400D7E092 /* TextViewStubDelegate.swift */,
1058+
247D2C652AF5B90900301B71 /* UIKit+Extensions.swift */,
10581059
);
10591060
path = TestingSupport;
10601061
sourceTree = "<group>";
@@ -1266,14 +1267,6 @@
12661267
path = Conversions;
12671268
sourceTree = "<group>";
12681269
};
1269-
F185A59D2123C07200DDFAB1 /* Recovered References */ = {
1270-
isa = PBXGroup;
1271-
children = (
1272-
B5F84B621E706B720089A76C /* NSAttributedStringAnalyzerTests.swift */,
1273-
);
1274-
name = "Recovered References";
1275-
sourceTree = "<group>";
1276-
};
12771270
F185A5A02123C0D900DDFAB1 /* Extensions */ = {
12781271
isa = PBXGroup;
12791272
children = (
@@ -1713,6 +1706,7 @@
17131706
isa = PBXSourcesBuildPhase;
17141707
buildActionMask = 2147483647;
17151708
files = (
1709+
247D2C662AF5B90900301B71 /* UIKit+Extensions.swift in Sources */,
17161710
F185A5B52123C0DA00DDFAB1 /* NSMutableAttributedStringReplaceOcurrencesTests.swift in Sources */,
17171711
B5D575891F2288E2003A62F6 /* TextViewTests.swift in Sources */,
17181712
594C9D741D8BE6C700D74542 /* InNodeConverterTests.swift in Sources */,
@@ -1836,7 +1830,7 @@
18361830
GCC_WARN_UNUSED_FUNCTION = YES;
18371831
GCC_WARN_UNUSED_VARIABLE = YES;
18381832
HEADER_SEARCH_PATHS = /usr/include/libxml2;
1839-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
1833+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
18401834
MTL_ENABLE_DEBUG_INFO = YES;
18411835
ONLY_ACTIVE_ARCH = YES;
18421836
OTHER_LDFLAGS = "-lxml2";
@@ -1898,7 +1892,7 @@
18981892
GCC_WARN_UNUSED_FUNCTION = YES;
18991893
GCC_WARN_UNUSED_VARIABLE = YES;
19001894
HEADER_SEARCH_PATHS = /usr/include/libxml2;
1901-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
1895+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
19021896
MTL_ENABLE_DEBUG_INFO = NO;
19031897
OTHER_LDFLAGS = "-lxml2";
19041898
SDKROOT = iphoneos;
@@ -1926,7 +1920,7 @@
19261920
DYLIB_INSTALL_NAME_BASE = "@rpath";
19271921
INFOPLIST_FILE = Aztec/Info.plist;
19281922
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1929-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
1923+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
19301924
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
19311925
MARKETING_VERSION = 1.15.0;
19321926
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
@@ -1953,7 +1947,7 @@
19531947
DYLIB_INSTALL_NAME_BASE = "@rpath";
19541948
INFOPLIST_FILE = Aztec/Info.plist;
19551949
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1956-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
1950+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
19571951
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
19581952
MARKETING_VERSION = 1.15.0;
19591953
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
@@ -2042,7 +2036,7 @@
20422036
GCC_WARN_UNUSED_FUNCTION = YES;
20432037
GCC_WARN_UNUSED_VARIABLE = YES;
20442038
HEADER_SEARCH_PATHS = /usr/include/libxml2;
2045-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
2039+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
20462040
MTL_ENABLE_DEBUG_INFO = NO;
20472041
ONLY_ACTIVE_ARCH = YES;
20482042
OTHER_LDFLAGS = "-lxml2";
@@ -2070,7 +2064,7 @@
20702064
DYLIB_INSTALL_NAME_BASE = "@rpath";
20712065
INFOPLIST_FILE = Aztec/Info.plist;
20722066
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2073-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
2067+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
20742068
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
20752069
MARKETING_VERSION = 1.15.0;
20762070
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
@@ -2149,7 +2143,7 @@
21492143
GCC_WARN_UNUSED_FUNCTION = YES;
21502144
GCC_WARN_UNUSED_VARIABLE = YES;
21512145
HEADER_SEARCH_PATHS = /usr/include/libxml2;
2152-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
2146+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
21532147
MTL_ENABLE_DEBUG_INFO = YES;
21542148
ONLY_ACTIVE_ARCH = YES;
21552149
OTHER_LDFLAGS = "-lxml2";
@@ -2178,7 +2172,7 @@
21782172
DYLIB_INSTALL_NAME_BASE = "@rpath";
21792173
INFOPLIST_FILE = Aztec/Info.plist;
21802174
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2181-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
2175+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
21822176
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
21832177
MARKETING_VERSION = 1.15.0;
21842178
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;

Aztec/Classes/EditorView/EditorView.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,17 @@ public class EditorView: UIView {
4141
richTextView.contentOffset = newValue
4242
}
4343
}
44-
45-
public var scrollIndicatorInsets: UIEdgeInsets {
44+
45+
public var horizontalScrollIndicatorInsets: UIEdgeInsets {
4646
get {
47-
return activeView.scrollIndicatorInsets
47+
return activeView.horizontalScrollIndicatorInsets
4848
}
49-
5049
set {
51-
htmlTextView.scrollIndicatorInsets = newValue
52-
richTextView.scrollIndicatorInsets = newValue
50+
htmlTextView.horizontalScrollIndicatorInsets = newValue
51+
richTextView.horizontalScrollIndicatorInsets = newValue
5352
}
5453
}
55-
54+
5655
// MARK: - Editing Mode
5756

5857
public enum EditMode {

Aztec/Classes/Extensions/NSAttributedString+Archive.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ extension NSAttributedString
66
{
77
static let pastesboardUTI = "com.wordpress.aztec.attributedString"
88

9-
func archivedData() -> Data {
10-
let data = NSKeyedArchiver.archivedData(withRootObject: self)
11-
return data
9+
func archivedData() throws -> Data {
10+
return try NSKeyedArchiver.archivedData(withRootObject: self, requiringSecureCoding: false)
1211
}
1312

14-
static func unarchive(with data: Data) -> NSAttributedString? {
15-
let attributedString = NSKeyedUnarchiver.unarchiveObject(with: data) as? NSAttributedString
16-
return attributedString
13+
static func unarchive(with data: Data) throws -> NSAttributedString? {
14+
return try NSKeyedUnarchiver.unarchivedObject(ofClass: NSAttributedString.self, from: data)
1715
}
1816

1917
}

Aztec/Classes/Extensions/NSAttributedString+Attachments.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ extension NSAttributedString
9999
}
100100

101101
// MARK: - Captions
102-
103-
open func caption(for attachment: NSTextAttachment) -> NSAttributedString? {
102+
public func caption(for attachment: NSTextAttachment) -> NSAttributedString? {
104103
guard let captionRange = self.captionRange(for: attachment) else {
105104
return nil
106105
}

Aztec/Classes/Extensions/String+RangeConversion.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ public extension String {
8989
///
9090
private func findValidLowerBound(for utf16Range: Range<String.UTF16View.Index>) -> String.Index {
9191

92+
guard isValidRange(utf16Range) else {
93+
return String.UTF16View.Index(utf16Offset: 0, in: self)
94+
}
95+
9296
guard self.utf16.count >= utf16Range.lowerBound.utf16Offset(in: self) else {
9397
return String.UTF16View.Index(utf16Offset: 0, in: self)
9498
}
@@ -106,6 +110,10 @@ public extension String {
106110
///
107111
private func findValidUpperBound(for utf16Range: Range<String.UTF16View.Index>) -> String.Index {
108112

113+
guard isValidRange(utf16Range) else {
114+
return String.Index(utf16Offset: self.utf16.count, in: self)
115+
}
116+
109117
guard self.utf16.count >= utf16Range.upperBound.utf16Offset(in: self) else {
110118
return String.Index(utf16Offset: self.utf16.count, in: self)
111119
}
@@ -241,4 +249,12 @@ public extension String {
241249

242250
return startIndex ..< endIndex
243251
}
252+
253+
func isValidRange(_ range: Range<String.UTF16View.Index>) -> Bool {
254+
isValidIndex(range.lowerBound) && isValidIndex(range.upperBound)
255+
}
256+
257+
func isValidIndex(_ index: String.UTF16View.Index) -> Bool {
258+
(self.startIndex ..< self.endIndex).contains(index)
259+
}
244260
}

Aztec/Classes/Extensions/StringUTF16+RangeConversion.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ extension String.UTF16View {
1212
func range(from nsRange: NSRange) -> Range<String.UTF16View.Index> {
1313
let start = index(startIndex, offsetBy: nsRange.location)
1414
let offset = count < nsRange.length ? count : nsRange.length
15+
16+
guard nsRange.length > 0 else {
17+
return start ..< start
18+
}
19+
1520
let end = index(start, offsetBy: offset)
1621

1722
return start ..< end

Aztec/Classes/Extensions/UIColor+Parsers.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ public extension UIColor {
88
convenience init?(hexString: String) {
99

1010
let hex = hexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
11-
var int = UInt32()
12-
if !Scanner(string: hex).scanHexInt32(&int) {
11+
var int = UInt64()
12+
if !Scanner(string: hex).scanHexInt64(&int) {
1313
return nil
1414
}
15-
let a, r, g, b: UInt32
15+
let a, r, g, b: UInt64
1616
switch hex.count {
1717
case 3: // RGB (12-bit)
1818
(a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)

Aztec/Classes/Extensions/UIPasteboard+Helpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private extension UIPasteboard {
5151
return nil
5252
}
5353

54-
return NSAttributedString.unarchive(with: data)
54+
return try? NSAttributedString.unarchive(with: data)
5555
}
5656

5757
/// Attempts to unarchive the Pasteboard's Plain Text contents into an Attributed String

Aztec/Classes/TextKit/TextStorage.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@ open class TextStorage: NSTextStorage {
437437
}
438438
}
439439

440+
// MARK: – Plain Text Interaction
441+
open func getPlainText(range: NSRange) -> String {
442+
self.attributedSubstring(from: range).string
443+
}
444+
440445
// MARK: - HTML Interaction
441446

442447
open func getHTML(prettify: Bool = false) -> String {

0 commit comments

Comments
 (0)