Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions Aztec.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,7 @@
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1867,7 +1867,7 @@
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -1899,7 +1899,6 @@
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
Expand Down Expand Up @@ -1927,7 +1926,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
Expand All @@ -1947,7 +1945,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -1965,7 +1962,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down Expand Up @@ -2070,7 +2066,7 @@
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -2100,7 +2096,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 1;
};
name = Profiling;
Expand All @@ -2119,7 +2114,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
};
name = Profiling;
};
Expand Down Expand Up @@ -2183,7 +2177,7 @@
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -2214,7 +2208,6 @@
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 1;
};
name = "Release-Alpha";
Expand All @@ -2234,7 +2227,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
};
name = "Release-Alpha";
};
Expand Down
4 changes: 2 additions & 2 deletions Aztec/Classes/Extensions/Array+Attribute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public extension Array where Element == Attribute {
}

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

append(newAttribute)
Expand All @@ -33,7 +33,7 @@ public extension Array where Element == Attribute {
}

mutating func remove(named name: String) {
guard let attributeIndex = index(where: { $0.name == name }) else {
guard let attributeIndex = firstIndex(where: { $0.name == name }) else {
return
}

Expand Down
4 changes: 2 additions & 2 deletions Aztec/Classes/Extensions/Array+ShortcodeAttribute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public extension Array where Element == ShortcodeAttribute {
mutating func set(_ value: ShortcodeAttribute.Value, forKey key: String) {
let newAttribute = ShortcodeAttribute(key: key, value: value)

guard let attributeIndex = index(where: { $0.key == key }) else {
guard let attributeIndex = firstIndex(where: { $0.key == key }) else {
append(newAttribute)
return
}
Expand All @@ -24,7 +24,7 @@ public extension Array where Element == ShortcodeAttribute {
}

mutating func remove(key: String) {
guard let attributeIndex = index(where: { $0.key == key }) else {
guard let attributeIndex = firstIndex(where: { $0.key == key }) else {
return
}

Expand Down
4 changes: 2 additions & 2 deletions Aztec/Classes/Libxml2/DOM/Data/ElementNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public class ElementNode: Node {
private func updateParentForChildren() {
for child in children where child.parent !== self {
if let oldParent = child.parent,
let childIndex = oldParent.children.index(where: { child === $0 }) {
let childIndex = oldParent.children.firstIndex(where: { child === $0 }) {

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

Expand Down
2 changes: 1 addition & 1 deletion Aztec/Classes/Libxml2/DOM/Data/Node.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public class Node: Equatable, CustomReflectable, Hashable {
return nil
}

let index = parent.children.index { node -> Bool in
let index = parent.children.firstIndex { node -> Bool in
return node === self
}!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ private extension AttributedStringParser {
var nonDuplicates = [ElementNode]()

for node in previous where current.contains(node) {
guard let index = current.index(of: node) else {
guard let index = current.firstIndex(of: node) else {
continue
}

Expand Down
2 changes: 1 addition & 1 deletion Aztec/Classes/TextKit/ParagraphStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ open class ParagraphStyle: NSMutableParagraphStyle, CustomReflectable {
public var blockquoteIndent: CGFloat {
let blockquoteIndex = properties.filter({ property in
return property is Blockquote || property is TextList
}).index(where: { property in
}).firstIndex(where: { property in
return property is Blockquote
})

Expand Down
2 changes: 1 addition & 1 deletion Aztec/Classes/TextKit/TextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ open class TextView: UITextView {
}
storage.attachmentsDelegate = self
font = defaultFont
linkTextAttributes = [.underlineStyle: NSNumber(value: NSUnderlineStyle.single.rawValue), .foregroundColor: self.tintColor]
linkTextAttributes = [.underlineStyle: NSNumber(value: NSUnderlineStyle.single.rawValue), .foregroundColor: self.tintColor!]
typingAttributes = defaultAttributes
setupMenuController()
setupAttachmentTouchDetection()
Expand Down
16 changes: 4 additions & 12 deletions Example/AztecExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -641,7 +641,7 @@
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -664,7 +664,6 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "Aztec Example Development";
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -687,7 +686,6 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "Aztec Example Ad Hoc";
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -704,7 +702,6 @@
PRODUCT_BUNDLE_IDENTIFIER = WP.AztecUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.2;
TEST_TARGET_NAME = AztecExample;
};
name = Debug;
Expand All @@ -719,7 +716,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = WP.AztecUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TEST_TARGET_NAME = AztecExample;
};
name = "Release-Alpha";
Expand All @@ -734,7 +730,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = WP.AztecUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TEST_TARGET_NAME = AztecExample;
};
name = Release;
Expand All @@ -749,7 +744,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = WP.AztecUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TEST_TARGET_NAME = AztecExample;
};
name = Profiling;
Expand Down Expand Up @@ -804,7 +798,7 @@
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Profiling;
};
Expand All @@ -826,7 +820,6 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "Aztec Example Development";
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Profiling;
Expand Down Expand Up @@ -887,7 +880,7 @@
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = "Release-Alpha";
};
Expand All @@ -909,7 +902,6 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "Aztec Example Alpha Distribution";
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Release-Alpha";
Expand Down
4 changes: 2 additions & 2 deletions Example/Example/EditorDemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ extension EditorDemoController {
return OptionsTableViewOption(image: headerType.iconImage, title: title)
}

let selectedIndex = Constants.headers.index(of: headerLevelForSelectedText())
let selectedIndex = Constants.headers.firstIndex(of: headerLevelForSelectedText())
let optionsTableViewController = OptionsTableViewController(options: options)
optionsTableViewController.cellDeselectedTintColor = .gray

Expand Down Expand Up @@ -665,7 +665,7 @@ extension EditorDemoController {

var index: Int? = nil
if let listType = listTypeForSelectedText() {
index = Constants.lists.index(of: listType)
index = Constants.lists.firstIndex(of: listType)
}

let optionsTableViewController = OptionsTableViewController(options: options)
Expand Down
12 changes: 3 additions & 9 deletions WordPressEditor/WordPressEditor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -795,7 +795,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPress;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Profiling;
Expand All @@ -814,7 +813,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Profiling;
Expand Down Expand Up @@ -878,7 +876,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -936,7 +934,7 @@
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -963,7 +961,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPress;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -988,7 +985,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPress;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -1007,7 +1003,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -1026,7 +1021,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ public class OptionsTablePresenter: NSObject {
//
extension OptionsTablePresenter: UIPopoverPresentationControllerDelegate {

private func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
public func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
return .none
}

private func popoverPresentationControllerDidDismissPopover(_ popoverPresentationController: UIPopoverPresentationController) {
public func popoverPresentationControllerDidDismissPopover(_ popoverPresentationController: UIPopoverPresentationController) {
if optionsTableViewController != nil {
optionsTableViewController = nil
}
Expand Down