Skip to content

Commit acde6fa

Browse files
Merge pull request #1210 from wordpress-mobile/issue/update_Swift_5_Xcode11
Update project to Swift 5 and xCode11
2 parents 983ac6e + 1b7ee91 commit acde6fa

22 files changed

Lines changed: 72 additions & 69 deletions

File tree

.circleci/config.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@ version: 2.1
22

33
orbs:
44
# This uses the iOS Orb located at https://github.com/wordpress-mobile/circleci-orbs
5-
ios: wordpress-mobile/ios@0.0.25
5+
ios: wordpress-mobile/ios@0.0.32
66

77
workflows:
88
test_and_validate:
99
jobs:
1010
- ios/test:
1111
name: Test
12-
xcode-version: "10.2.0"
12+
xcode-version: "11.0"
1313
carthage-update: true
1414
carthage-working-directory: Example
1515
bundle-install: false
1616
pod-install: false
1717
workspace: Aztec.xcworkspace
1818
scheme: AztecExample
19-
device: iPhone XS
20-
ios-version: "12.2"
19+
device: iPhone 11
20+
ios-version: "13.0"
2121

2222
- ios/validate-podspec:
2323
name: Validate WordPress-Aztec-iOS.podspec
24-
xcode-version: "10.2.0"
24+
xcode-version: "11.0"
2525
podspec-path: WordPress-Aztec-iOS.podspec
2626

2727
- ios/validate-podspec:
2828
name: Validate WordPress-Editor-iOS.podspec
29-
xcode-version: "10.2.0"
29+
xcode-version: "11.0"
3030
podspec-path: WordPress-Editor-iOS.podspec
3131
# Updating specs is needed since WordPress-Editor-iOS depends on WordPress-Aztec-iOS
3232
update-specs-repo: true

Aztec.xcodeproj/project.pbxproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,12 +1435,12 @@
14351435
5951CB8D1D8BC93600E1866F = {
14361436
CreatedOnToolsVersion = 8.0;
14371437
DevelopmentTeam = PZYM8XX95Q;
1438-
LastSwiftMigration = 1010;
1438+
LastSwiftMigration = 1100;
14391439
ProvisioningStyle = Manual;
14401440
};
14411441
5951CB961D8BC93600E1866F = {
14421442
CreatedOnToolsVersion = 8.0;
1443-
LastSwiftMigration = 1010;
1443+
LastSwiftMigration = 1100;
14441444
ProvisioningStyle = Automatic;
14451445
};
14461446
E8CE3EFE1F213AAA003254AB = {
@@ -1899,7 +1899,7 @@
18991899
SKIP_INSTALL = YES;
19001900
STRIP_INSTALLED_PRODUCT = NO;
19011901
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1902-
SWIFT_VERSION = 4.2;
1902+
SWIFT_VERSION = 5.0;
19031903
TARGETED_DEVICE_FAMILY = 1;
19041904
};
19051905
name = Debug;
@@ -1927,7 +1927,7 @@
19271927
PRODUCT_NAME = "$(TARGET_NAME)";
19281928
SKIP_INSTALL = YES;
19291929
STRIP_INSTALLED_PRODUCT = NO;
1930-
SWIFT_VERSION = 4.2;
1930+
SWIFT_VERSION = 5.0;
19311931
TARGETED_DEVICE_FAMILY = 1;
19321932
};
19331933
name = Release;
@@ -1947,7 +1947,7 @@
19471947
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
19481948
PRODUCT_NAME = "$(TARGET_NAME)";
19491949
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1950-
SWIFT_VERSION = 4.2;
1950+
SWIFT_VERSION = 5.0;
19511951
};
19521952
name = Debug;
19531953
};
@@ -1965,7 +1965,7 @@
19651965
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
19661966
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
19671967
PRODUCT_NAME = "$(TARGET_NAME)";
1968-
SWIFT_VERSION = 4.2;
1968+
SWIFT_VERSION = 5.0;
19691969
};
19701970
name = Release;
19711971
};
@@ -2100,7 +2100,7 @@
21002100
PRODUCT_NAME = "$(TARGET_NAME)";
21012101
SKIP_INSTALL = YES;
21022102
STRIP_INSTALLED_PRODUCT = NO;
2103-
SWIFT_VERSION = 4.2;
2103+
SWIFT_VERSION = 5.0;
21042104
TARGETED_DEVICE_FAMILY = 1;
21052105
};
21062106
name = Profiling;
@@ -2119,7 +2119,7 @@
21192119
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
21202120
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
21212121
PRODUCT_NAME = "$(TARGET_NAME)";
2122-
SWIFT_VERSION = 4.2;
2122+
SWIFT_VERSION = 5.0;
21232123
};
21242124
name = Profiling;
21252125
};
@@ -2214,7 +2214,7 @@
22142214
SKIP_INSTALL = YES;
22152215
STRIP_INSTALLED_PRODUCT = NO;
22162216
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
2217-
SWIFT_VERSION = 4.2;
2217+
SWIFT_VERSION = 5.0;
22182218
TARGETED_DEVICE_FAMILY = 1;
22192219
};
22202220
name = "Release-Alpha";
@@ -2234,7 +2234,7 @@
22342234
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
22352235
PRODUCT_NAME = "$(TARGET_NAME)";
22362236
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
2237-
SWIFT_VERSION = 4.2;
2237+
SWIFT_VERSION = 5.0;
22382238
};
22392239
name = "Release-Alpha";
22402240
};

Aztec/Classes/EditorView/EditorView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ extension EditorView: UITextInput {
323323
}
324324

325325
set {
326-
activeView.selectedTextRange = selectedTextRange
326+
activeView.selectedTextRange = newValue
327327
}
328328
}
329329
}

Aztec/Classes/Extensions/Array+Attribute.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public extension Array where Element == Attribute {
2222
}
2323

2424
mutating func set(_ value: Attribute.Value, for name: String) {
25-
guard let attributeIndex = index(where: { $0.name == name }) else {
25+
guard let attributeIndex = firstIndex(where: { $0.name == name }) else {
2626
let newAttribute = Attribute(name: name, value: value)
2727

2828
append(newAttribute)
@@ -33,7 +33,7 @@ public extension Array where Element == Attribute {
3333
}
3434

3535
mutating func remove(named name: String) {
36-
guard let attributeIndex = index(where: { $0.name == name }) else {
36+
guard let attributeIndex = firstIndex(where: { $0.name == name }) else {
3737
return
3838
}
3939

Aztec/Classes/Extensions/Array+ShortcodeAttribute.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public extension Array where Element == ShortcodeAttribute {
1515
mutating func set(_ value: ShortcodeAttribute.Value, forKey key: String) {
1616
let newAttribute = ShortcodeAttribute(key: key, value: value)
1717

18-
guard let attributeIndex = index(where: { $0.key == key }) else {
18+
guard let attributeIndex = firstIndex(where: { $0.key == key }) else {
1919
append(newAttribute)
2020
return
2121
}
@@ -24,7 +24,7 @@ public extension Array where Element == ShortcodeAttribute {
2424
}
2525

2626
mutating func remove(key: String) {
27-
guard let attributeIndex = index(where: { $0.key == key }) else {
27+
guard let attributeIndex = firstIndex(where: { $0.key == key }) else {
2828
return
2929
}
3030

Aztec/Classes/GUI/FormatBar/FormatBar.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,8 @@ private extension FormatBar {
712712
constant: 0
713713
)
714714
self.overflowToggleItemRTLLeadingConstraint = overflowLeadingConstraint
715+
@unknown default:
716+
overflowLeadingConstraint = overflowToggleItem.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.trailingAnchor)
715717
}
716718

717719
///Trailing item
@@ -726,6 +728,8 @@ private extension FormatBar {
726728
trailingItemLeadingConstraint = trailingItemContainer.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.trailingAnchor)
727729
case .rightToLeft:
728730
trailingItemLeadingConstraint = trailingItemContainer.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.leadingAnchor)
731+
@unknown default:
732+
trailingItemLeadingConstraint = trailingItemContainer.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.trailingAnchor)
729733
}
730734

731735
NSLayoutConstraint.activate([

Aztec/Classes/Libxml2/DOM/Data/ElementNode.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public class ElementNode: Node {
115115
private func updateParentForChildren() {
116116
for child in children where child.parent !== self {
117117
if let oldParent = child.parent,
118-
let childIndex = oldParent.children.index(where: { child === $0 }) {
118+
let childIndex = oldParent.children.firstIndex(where: { child === $0 }) {
119119

120120
oldParent.children.remove(at: childIndex)
121121
}
@@ -349,7 +349,7 @@ public class ElementNode: Node {
349349
/// - Returns: the index of the specified child node.
350350
///
351351
func indexOf(childNode: Node) -> Int {
352-
guard let index = children.index(where: { childNode === $0 } ) else {
352+
guard let index = children.firstIndex(where: { childNode === $0 } ) else {
353353
fatalError("Broken parent-child relationship found.")
354354
}
355355

Aztec/Classes/Libxml2/DOM/Data/Node.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public class Node: Equatable, CustomReflectable, Hashable {
167167
return nil
168168
}
169169

170-
let index = parent.children.index { node -> Bool in
170+
let index = parent.children.firstIndex { node -> Bool in
171171
return node === self
172172
}!
173173

Aztec/Classes/NSAttributedString/Conversions/AttributedStringParser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ private extension AttributedStringParser {
333333
var nonDuplicates = [ElementNode]()
334334

335335
for node in previous where current.contains(node) {
336-
guard let index = current.index(of: node) else {
336+
guard let index = current.firstIndex(of: node) else {
337337
continue
338338
}
339339

Aztec/Classes/TextKit/ParagraphStyle.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ open class ParagraphStyle: NSMutableParagraphStyle, CustomReflectable {
181181
public var blockquoteIndent: CGFloat {
182182
let blockquoteIndex = properties.filter({ property in
183183
return property is Blockquote || property is TextList
184-
}).index(where: { property in
184+
}).firstIndex(where: { property in
185185
return property is Blockquote
186186
})
187187

0 commit comments

Comments
 (0)