diff --git a/Aztec.xcodeproj/project.pbxproj b/Aztec.xcodeproj/project.pbxproj index d27d5faed..2c6f651e5 100644 --- a/Aztec.xcodeproj/project.pbxproj +++ b/Aztec.xcodeproj/project.pbxproj @@ -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 = ""; @@ -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"; @@ -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; @@ -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; @@ -1947,7 +1945,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -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; }; @@ -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 = ""; @@ -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; @@ -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; }; @@ -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 = ""; @@ -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"; @@ -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"; }; diff --git a/Aztec/Classes/Extensions/Array+Attribute.swift b/Aztec/Classes/Extensions/Array+Attribute.swift index 0bbb9f984..2b8ebba5f 100644 --- a/Aztec/Classes/Extensions/Array+Attribute.swift +++ b/Aztec/Classes/Extensions/Array+Attribute.swift @@ -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) @@ -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 } diff --git a/Aztec/Classes/Extensions/Array+ShortcodeAttribute.swift b/Aztec/Classes/Extensions/Array+ShortcodeAttribute.swift index 6243c5925..10b3db8e0 100644 --- a/Aztec/Classes/Extensions/Array+ShortcodeAttribute.swift +++ b/Aztec/Classes/Extensions/Array+ShortcodeAttribute.swift @@ -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 } @@ -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 } diff --git a/Aztec/Classes/Libxml2/DOM/Data/ElementNode.swift b/Aztec/Classes/Libxml2/DOM/Data/ElementNode.swift index 782bd2778..4aa2ec720 100644 --- a/Aztec/Classes/Libxml2/DOM/Data/ElementNode.swift +++ b/Aztec/Classes/Libxml2/DOM/Data/ElementNode.swift @@ -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) } @@ -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.") } diff --git a/Aztec/Classes/Libxml2/DOM/Data/Node.swift b/Aztec/Classes/Libxml2/DOM/Data/Node.swift index 93dd6b196..1bef92668 100644 --- a/Aztec/Classes/Libxml2/DOM/Data/Node.swift +++ b/Aztec/Classes/Libxml2/DOM/Data/Node.swift @@ -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 }! diff --git a/Aztec/Classes/NSAttributedString/Conversions/AttributedStringParser.swift b/Aztec/Classes/NSAttributedString/Conversions/AttributedStringParser.swift index 5c5317e24..94d4fcd3d 100644 --- a/Aztec/Classes/NSAttributedString/Conversions/AttributedStringParser.swift +++ b/Aztec/Classes/NSAttributedString/Conversions/AttributedStringParser.swift @@ -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 } diff --git a/Aztec/Classes/TextKit/ParagraphStyle.swift b/Aztec/Classes/TextKit/ParagraphStyle.swift index 1b2f04a1e..201dddee0 100644 --- a/Aztec/Classes/TextKit/ParagraphStyle.swift +++ b/Aztec/Classes/TextKit/ParagraphStyle.swift @@ -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 }) diff --git a/Aztec/Classes/TextKit/TextView.swift b/Aztec/Classes/TextKit/TextView.swift index 71295404d..be3191074 100644 --- a/Aztec/Classes/TextKit/TextView.swift +++ b/Aztec/Classes/TextKit/TextView.swift @@ -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() diff --git a/Example/AztecExample.xcodeproj/project.pbxproj b/Example/AztecExample.xcodeproj/project.pbxproj index dc334e39d..5174c0352 100644 --- a/Example/AztecExample.xcodeproj/project.pbxproj +++ b/Example/AztecExample.xcodeproj/project.pbxproj @@ -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; }; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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"; @@ -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; @@ -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; @@ -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; }; @@ -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; @@ -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"; }; @@ -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"; diff --git a/Example/Example/EditorDemoController.swift b/Example/Example/EditorDemoController.swift index 78ab2df54..4727051e8 100644 --- a/Example/Example/EditorDemoController.swift +++ b/Example/Example/EditorDemoController.swift @@ -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 @@ -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) diff --git a/WordPressEditor/WordPressEditor.xcodeproj/project.pbxproj b/WordPressEditor/WordPressEditor.xcodeproj/project.pbxproj index 24dcb3c53..728db1a26 100644 --- a/WordPressEditor/WordPressEditor.xcodeproj/project.pbxproj +++ b/WordPressEditor/WordPressEditor.xcodeproj/project.pbxproj @@ -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 = ""; }; @@ -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; @@ -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; @@ -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 = ""; }; @@ -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 = ""; @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/WordPressEditor/WordPressEditor/Classes/ViewControllers/OptionsTableViewController/OptionsTablePresenter.swift b/WordPressEditor/WordPressEditor/Classes/ViewControllers/OptionsTableViewController/OptionsTablePresenter.swift index f2ffb19da..5ba9c9a7e 100644 --- a/WordPressEditor/WordPressEditor/Classes/ViewControllers/OptionsTableViewController/OptionsTablePresenter.swift +++ b/WordPressEditor/WordPressEditor/Classes/ViewControllers/OptionsTableViewController/OptionsTablePresenter.swift @@ -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 }