From 9ba3b7b4c62f4b0029e37e297f0fcf2073e4c4c1 Mon Sep 17 00:00:00 2001 From: Nick Lockwood Date: Fri, 1 May 2020 01:07:18 +0100 Subject: [PATCH] Fix `override` specifier ordering --- Rules.md | 4 +- Snapshots/Layout/Layout/LayoutNode.swift | 2 +- Snapshots/Layout/Layout/RuntimeType.swift | 6 +- .../Layout/Layout/Shared/XMLParser.swift | 2 +- .../Layout/UICollectionView+Layout.swift | 46 ++++---- .../Layout/Layout/UIScrollView+Layout.swift | 8 +- .../Layout/Layout/UIStackView+Layout.swift | 8 +- .../Layout/Layout/UITableView+Layout.swift | 62 +++++------ Snapshots/Layout/Layout/UIView+Layout.swift | 102 +++++++++--------- .../Layout/UIViewController+Layout.swift | 50 ++++----- .../Layout/LayoutTests/PropertiesTests.swift | 2 +- Sources/Examples.swift | 4 +- Sources/ParsingHelpers.swift | 2 +- Tests/RulesTests.swift | 6 +- 14 files changed, 152 insertions(+), 152 deletions(-) diff --git a/Rules.md b/Rules.md index 9079f7470..3d359e26c 100644 --- a/Rules.md +++ b/Rules.md @@ -1268,8 +1268,8 @@ Use consistent ordering for member specifiers. ``` ```diff -- override public final func foo() -+ public final override func foo() +- final public override func foo() ++ override public final func foo() ``` ```diff diff --git a/Snapshots/Layout/Layout/LayoutNode.swift b/Snapshots/Layout/Layout/LayoutNode.swift index 7c741196e..0e88d4a8e 100755 --- a/Snapshots/Layout/Layout/LayoutNode.swift +++ b/Snapshots/Layout/Layout/LayoutNode.swift @@ -275,7 +275,7 @@ public class LayoutNode: NSObject { } } - public override func observeValue( + override public func observeValue( forKeyPath _: String?, of _: Any?, change _: [NSKeyValueChangeKey: Any]?, diff --git a/Snapshots/Layout/Layout/RuntimeType.swift b/Snapshots/Layout/Layout/RuntimeType.swift index ee52b498e..f513a6465 100755 --- a/Snapshots/Layout/Layout/RuntimeType.swift +++ b/Snapshots/Layout/Layout/RuntimeType.swift @@ -375,7 +375,7 @@ public class RuntimeType: NSObject { availability = .available } - public override var description: String { + override public var description: String { switch availability { case .available: return kind.description @@ -384,7 +384,7 @@ public class RuntimeType: NSObject { } } - public override func isEqual(_ object: Any?) -> Bool { + override public func isEqual(_ object: Any?) -> Bool { guard let object = object as? RuntimeType else { return false } @@ -401,7 +401,7 @@ public class RuntimeType: NSObject { } } - public override var hash: Int { + override public var hash: Int { return description.hashValue } diff --git a/Snapshots/Layout/Layout/Shared/XMLParser.swift b/Snapshots/Layout/Layout/Shared/XMLParser.swift index 023070dd6..6fda652c3 100755 --- a/Snapshots/Layout/Layout/Shared/XMLParser.swift +++ b/Snapshots/Layout/Layout/Shared/XMLParser.swift @@ -144,7 +144,7 @@ class XMLParser: NSObject, XMLParserDelegate { super.init() } - private override init() { + override private init() { preconditionFailure() } diff --git a/Snapshots/Layout/Layout/UICollectionView+Layout.swift b/Snapshots/Layout/Layout/UICollectionView+Layout.swift index a405f1ad0..35ed851da 100755 --- a/Snapshots/Layout/Layout/UICollectionView+Layout.swift +++ b/Snapshots/Layout/Layout/UICollectionView+Layout.swift @@ -29,7 +29,7 @@ extension UICollectionViewLayout { } private class LayoutCollectionView: UICollectionView { - open override var intrinsicContentSize: CGSize { + override open var intrinsicContentSize: CGSize { guard layoutNode != nil else { return super.intrinsicContentSize } @@ -39,7 +39,7 @@ private class LayoutCollectionView: UICollectionView { ) } - open override var contentSize: CGSize { + override open var contentSize: CGSize { didSet { if oldValue != contentSize, let layoutNode = layoutNode { layoutNode.contentSizeChanged() @@ -79,7 +79,7 @@ private extension UICollectionView { } extension UICollectionView: LayoutBacked { - open override class func create(with node: LayoutNode) throws -> UICollectionView { + override open class func create(with node: LayoutNode) throws -> UICollectionView { // UICollectionView cannot be created with a nil collectionViewLayout // so we cannot allow create(with:) to throw. Instead, we'll intercept the error let layout = node.attempt { @@ -103,7 +103,7 @@ extension UICollectionView: LayoutBacked { return collectionView } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes for (key, type) in UICollectionViewFlowLayout.allPropertyTypes() { types["collectionViewLayout.\(key)"] = type @@ -122,7 +122,7 @@ extension UICollectionView: LayoutBacked { return types } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "collectionViewLayout": setCollectionViewLayout(value as! UICollectionViewLayout, animated: true) @@ -131,7 +131,7 @@ extension UICollectionView: LayoutBacked { } } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "reorderingCadence", "collectionViewLayout.sectionInsetReference": // Does nothing on iOS 10 and earlier @@ -143,7 +143,7 @@ extension UICollectionView: LayoutBacked { } } - open override func shouldInsertChildNode(_ node: LayoutNode, at _: Int) -> Bool { + override open func shouldInsertChildNode(_ node: LayoutNode, at _: Int) -> Bool { if node.viewClass is UICollectionViewCell.Type { do { if let reuseIdentifier = try node.value(forExpression: "reuseIdentifier") as? String { @@ -159,7 +159,7 @@ extension UICollectionView: LayoutBacked { return true } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { if backgroundView == nil { backgroundView = node.view // TODO: this is a bit inconsistent with UITableView - reconsider? } else { @@ -167,7 +167,7 @@ extension UICollectionView: LayoutBacked { } } - open override func willRemoveChildNode(_ node: LayoutNode, at index: Int) { + override open func willRemoveChildNode(_ node: LayoutNode, at index: Int) { let hadView = (node._view != nil) super.willRemoveChildNode(node, at: index) if node._view == backgroundView { @@ -178,7 +178,7 @@ extension UICollectionView: LayoutBacked { assert(hadView || node._view == nil) } - open override func didUpdateLayout(for _: LayoutNode) { + override open func didUpdateLayout(for _: LayoutNode) { for cell in visibleCells { cell.layoutNode?.update() } @@ -195,7 +195,7 @@ extension UICollectionView: LayoutDelegate { } extension UICollectionViewController: LayoutBacked { - open override class func create(with node: LayoutNode) throws -> UICollectionViewController { + override open class func create(with node: LayoutNode) throws -> UICollectionViewController { let layout = try node.value(forExpression: "collectionViewLayout") as? UICollectionViewLayout ?? .defaultLayout(for: node) let viewController = self.init(collectionViewLayout: layout) guard let collectionView = viewController.collectionView else { @@ -209,7 +209,7 @@ extension UICollectionViewController: LayoutBacked { return viewController } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["collectionViewLayout"] = RuntimeType(UICollectionViewFlowLayout.self) for (key, type) in UICollectionViewFlowLayout.allPropertyTypes() { @@ -223,7 +223,7 @@ extension UICollectionViewController: LayoutBacked { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "collectionViewLayout": collectionView?.collectionViewLayout = value as! UICollectionViewLayout @@ -236,7 +236,7 @@ extension UICollectionViewController: LayoutBacked { } } - open override func shouldInsertChildNode(_ node: LayoutNode, at index: Int) -> Bool { + override open func shouldInsertChildNode(_ node: LayoutNode, at index: Int) -> Bool { switch node.viewClass { case is UICollectionViewCell.Type: return collectionView?.shouldInsertChildNode(node, at: index) ?? false @@ -245,7 +245,7 @@ extension UICollectionViewController: LayoutBacked { } } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { // TODO: what if more than one collectionView is added? if node.viewClass is UICollectionView.Type { let wasLoaded = (viewIfLoaded != nil) @@ -258,7 +258,7 @@ extension UICollectionViewController: LayoutBacked { collectionView?.didInsertChildNode(node, at: index) } - open override func willRemoveChildNode(_ node: LayoutNode, at index: Int) { + override open func willRemoveChildNode(_ node: LayoutNode, at index: Int) { if node.viewClass is UICollectionView.Type { collectionView = nil return @@ -383,14 +383,14 @@ extension UICollectionView { } private class LayoutCollectionViewCell: UICollectionViewCell { - open override var intrinsicContentSize: CGSize { + override open var intrinsicContentSize: CGSize { guard let layoutNode = layoutNode, layoutNode.children.isEmpty else { return super.intrinsicContentSize } return CGSize(width: UIView.noIntrinsicMetric, height: 44) } - open override func sizeThatFits(_ size: CGSize) -> CGSize { + override open func sizeThatFits(_ size: CGSize) -> CGSize { if let layoutNode = layoutNode { let height = (try? layoutNode.doubleValue(forSymbol: "height")) ?? 0 return CGSize(width: size.width, height: CGFloat(height)) @@ -427,15 +427,15 @@ private extension UICollectionViewCell { } extension UICollectionViewCell: LayoutBacked { - open override class func create(with _: LayoutNode) throws -> UICollectionViewCell { + override open class func create(with _: LayoutNode) throws -> UICollectionViewCell { throw LayoutError.message("UICollectionViewCells must be created by UICollectionView") } - open override class var parameterTypes: [String: RuntimeType] { + override open class var parameterTypes: [String: RuntimeType] { return ["reuseIdentifier": .string] } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes for (key, type) in UIView.cachedExpressionTypes { types["contentView.\(key)"] = type @@ -445,7 +445,7 @@ extension UICollectionViewCell: LayoutBacked { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { if name.hasPrefix("backgroundView."), backgroundView == nil { // Add a backgroundView view if required backgroundView = UIView(frame: bounds) @@ -456,7 +456,7 @@ extension UICollectionViewCell: LayoutBacked { try super.setValue(value, forExpression: name) } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { // Insert child views into `contentView` instead of directly contentView.didInsertChildNode(node, at: index) } diff --git a/Snapshots/Layout/Layout/UIScrollView+Layout.swift b/Snapshots/Layout/Layout/UIScrollView+Layout.swift index fb2dab229..fbd00611a 100755 --- a/Snapshots/Layout/Layout/UIScrollView+Layout.swift +++ b/Snapshots/Layout/Layout/UIScrollView+Layout.swift @@ -3,7 +3,7 @@ import Foundation extension UIScrollView { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["contentInsetAdjustmentBehavior"] = .uiScrollViewContentInsetAdjustmentBehavior types["indicatorStyle"] = .uiScrollViewIndicatorStyle @@ -38,7 +38,7 @@ extension UIScrollView { return types } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "contentOffset": setContentOffset(value as! CGPoint, animated: true) @@ -55,7 +55,7 @@ extension UIScrollView { } } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "contentInsetAdjustmentBehavior": // Does nothing on iOS 10 and earlier @@ -67,7 +67,7 @@ extension UIScrollView { } } - open override func didUpdateLayout(for _: LayoutNode) { + override open func didUpdateLayout(for _: LayoutNode) { // Prevents contentOffset glitch when rotating from portrait to landscape // TODO: needs improvement - result can be off by one page sometimes if isPagingEnabled { diff --git a/Snapshots/Layout/Layout/UIStackView+Layout.swift b/Snapshots/Layout/Layout/UIStackView+Layout.swift index 01b4a69be..2586800f8 100755 --- a/Snapshots/Layout/Layout/UIStackView+Layout.swift +++ b/Snapshots/Layout/Layout/UIStackView+Layout.swift @@ -3,7 +3,7 @@ import UIKit extension UIStackView { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["axis"] = .uiLayoutConstraintAxis types["distribution"] = .uiStackViewDistribution @@ -34,17 +34,17 @@ extension UIStackView { return types } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { super.didInsertChildNode(node, at: index) addArrangedSubview(node.view) } - open override func willRemoveChildNode(_ node: LayoutNode, at index: Int) { + override open func willRemoveChildNode(_ node: LayoutNode, at index: Int) { (node._view as UIView?).map(removeArrangedSubview) super.willRemoveChildNode(node, at: index) } - open override class var defaultExpressions: [String: String] { + override open class var defaultExpressions: [String: String] { return [ "width": "auto", "height": "auto", diff --git a/Snapshots/Layout/Layout/UITableView+Layout.swift b/Snapshots/Layout/Layout/UITableView+Layout.swift index e1f453d80..16d9deb27 100755 --- a/Snapshots/Layout/Layout/UITableView+Layout.swift +++ b/Snapshots/Layout/Layout/UITableView+Layout.swift @@ -3,7 +3,7 @@ import UIKit private class LayoutTableView: UITableView { - open override var intrinsicContentSize: CGSize { + override open var intrinsicContentSize: CGSize { guard layoutNode != nil else { return super.intrinsicContentSize } @@ -13,7 +13,7 @@ private class LayoutTableView: UITableView { ) } - open override var contentSize: CGSize { + override open var contentSize: CGSize { didSet { if oldValue != contentSize, let layoutNode = layoutNode { layoutNode.contentSizeChanged() @@ -53,7 +53,7 @@ private extension UITableView { } extension UITableView: LayoutBacked { - open override class func create(with node: LayoutNode) throws -> UITableView { + override open class func create(with node: LayoutNode) throws -> UITableView { let style = try node.value(forExpression: "style") as? UITableView.Style ?? .plain let tableView: UITableView = { if self == UITableView.self { @@ -82,13 +82,13 @@ extension UITableView: LayoutBacked { sectionFooterHeight = UITableView.automaticDimension } - open override class var parameterTypes: [String: RuntimeType] { + override open class var parameterTypes: [String: RuntimeType] { return [ "style": .uiTableViewStyle, ] } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["separatorStyle"] = .uiTableViewCellSeparatorStyle types["separatorInsetReference"] = .uiTableViewSeparatorInsetReference @@ -123,7 +123,7 @@ extension UITableView: LayoutBacked { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "separatorInsetReference": // Does nothing on iOS 10 and earlier @@ -135,7 +135,7 @@ extension UITableView: LayoutBacked { } } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "isEditing": setEditing(value as! Bool, animated: true) @@ -144,7 +144,7 @@ extension UITableView: LayoutBacked { } } - open override func shouldInsertChildNode(_ node: LayoutNode, at _: Int) -> Bool { + override open func shouldInsertChildNode(_ node: LayoutNode, at _: Int) -> Bool { do { switch node.viewClass { case is UITableViewCell.Type: @@ -168,7 +168,7 @@ extension UITableView: LayoutBacked { return false } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { if tableHeaderView == nil { tableHeaderView = node.view } else if tableFooterView == nil { @@ -178,7 +178,7 @@ extension UITableView: LayoutBacked { } } - open override func willRemoveChildNode(_ node: LayoutNode, at index: Int) { + override open func willRemoveChildNode(_ node: LayoutNode, at index: Int) { let hadView = (node._view != nil) super.willRemoveChildNode(node, at: index) guard let view = node._view else { return } @@ -192,7 +192,7 @@ extension UITableView: LayoutBacked { } } - open override func didUpdateLayout(for _: LayoutNode) { + override open func didUpdateLayout(for _: LayoutNode) { for cell in visibleCells { cell.layoutNode?.update() } @@ -200,7 +200,7 @@ extension UITableView: LayoutBacked { } extension UITableViewController: LayoutBacked { - open override class func create(with node: LayoutNode) throws -> UITableViewController { + override open class func create(with node: LayoutNode) throws -> UITableViewController { let style = try node.value(forExpression: "style") as? UITableView.Style ?? .plain let viewController = self.init(style: style) if !node.children.contains(where: { $0.viewClass is UITableView.Type }) { @@ -211,13 +211,13 @@ extension UITableViewController: LayoutBacked { return viewController } - open override class var parameterTypes: [String: RuntimeType] { + override open class var parameterTypes: [String: RuntimeType] { return [ "style": .uiTableViewStyle, ] } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes for (key, type) in UITableView.cachedExpressionTypes { types["tableView.\(key)"] = type @@ -225,7 +225,7 @@ extension UITableViewController: LayoutBacked { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case _ where name.hasPrefix("tableView."): try tableView.setValue(value, forExpression: String(name["tableView.".endIndex ..< name.endIndex])) @@ -234,7 +234,7 @@ extension UITableViewController: LayoutBacked { } } - open override func shouldInsertChildNode(_ node: LayoutNode, at index: Int) -> Bool { + override open func shouldInsertChildNode(_ node: LayoutNode, at index: Int) -> Bool { switch node.viewClass { case is UITableViewCell.Type, is UITableViewHeaderFooterView.Type: return tableView?.shouldInsertChildNode(node, at: index) ?? false @@ -243,7 +243,7 @@ extension UITableViewController: LayoutBacked { } } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { // TODO: what if more than one tableView is added? if node.viewClass is UITableView.Type { let wasLoaded = (viewIfLoaded != nil) @@ -256,7 +256,7 @@ extension UITableViewController: LayoutBacked { tableView.didInsertChildNode(node, at: index) } - open override func willRemoveChildNode(_ node: LayoutNode, at index: Int) { + override open func willRemoveChildNode(_ node: LayoutNode, at index: Int) { if node.viewClass is UITableView.Type { tableView = nil return @@ -465,7 +465,7 @@ extension UITableView { private class LayoutTableViewHeaderFooterView: UITableViewHeaderFooterView { // TODO: it looks like UITableView doesn't use this for auto-sizing sections header/footer - remove it? - open override func sizeThatFits(_ size: CGSize) -> CGSize { + override open func sizeThatFits(_ size: CGSize) -> CGSize { if let layoutNode = layoutNode { let height = (try? layoutNode.doubleValue(forSymbol: "height")) ?? 0 return CGSize(width: size.width, height: CGFloat(height)) @@ -490,7 +490,7 @@ private extension UITableViewHeaderFooterView { } extension UITableViewHeaderFooterView: LayoutBacked { - open override class func create(with node: LayoutNode) throws -> UITableViewHeaderFooterView { + override open class func create(with node: LayoutNode) throws -> UITableViewHeaderFooterView { let reuseIdentifier = try node.value(forExpression: "reuseIdentifier") as? String let view: UITableViewHeaderFooterView = { if self == UITableViewHeaderFooterView.self { @@ -512,13 +512,13 @@ extension UITableViewHeaderFooterView: LayoutBacked { return view } - open override class var parameterTypes: [String: RuntimeType] { + override open class var parameterTypes: [String: RuntimeType] { return [ "reuseIdentifier": .string, ] } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["backgroundColor"] = .unavailable("Setting backgroundColor on UITableViewHeaderFooterView is not supported. Use contentView.backgroundColor instead.") types["editingAccessoryType"] = types["accessoryType"] @@ -556,12 +556,12 @@ extension UITableViewHeaderFooterView: LayoutBacked { return types } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { // Insert child views into `contentView` instead of directly contentView.didInsertChildNode(node, at: index) } - open override var intrinsicContentSize: CGSize { + override open var intrinsicContentSize: CGSize { guard let layoutNode = layoutNode, layoutNode.children.isEmpty else { return super.intrinsicContentSize } @@ -573,7 +573,7 @@ extension UITableViewHeaderFooterView: LayoutBacked { } private class LayoutTableViewCell: UITableViewCell { - open override func sizeThatFits(_ size: CGSize) -> CGSize { + override open func sizeThatFits(_ size: CGSize) -> CGSize { if let layoutNode = layoutNode { let height = (try? layoutNode.doubleValue(forSymbol: "height")) ?? 0 return CGSize(width: size.width, height: CGFloat(height)) @@ -598,7 +598,7 @@ private extension UITableViewCell { } extension UITableViewCell: LayoutBacked { - open override class func create(with node: LayoutNode) throws -> UITableViewCell { + override open class func create(with node: LayoutNode) throws -> UITableViewCell { let style = try node.value(forExpression: "style") as? UITableViewCell.CellStyle ?? .default let reuseIdentifier = try node.value(forExpression: "reuseIdentifier") as? String let cell: UITableViewCell = { @@ -626,14 +626,14 @@ extension UITableViewCell: LayoutBacked { return cell } - open override class var parameterTypes: [String: RuntimeType] { + override open class var parameterTypes: [String: RuntimeType] { return [ "style": .uiTableViewCellStyle, "reuseIdentifier": .string, ] } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["selectionStyle"] = .uiTableViewCellSelectionStyle types["focusStyle"] = .uiTableViewCellFocusStyle @@ -688,11 +688,11 @@ extension UITableViewCell: LayoutBacked { return types } - open override class var bodyExpression: String? { + override open class var bodyExpression: String? { return "textLabel.attributedText" } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "isEditing": setEditing(value as! Bool, animated: true) @@ -705,7 +705,7 @@ extension UITableViewCell: LayoutBacked { } } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { // Insert child views into `contentView` instead of directly contentView.didInsertChildNode(node, at: index) } diff --git a/Snapshots/Layout/Layout/UIView+Layout.swift b/Snapshots/Layout/Layout/UIView+Layout.swift index 8dea2dbfe..4e595d632 100755 --- a/Snapshots/Layout/Layout/UIView+Layout.swift +++ b/Snapshots/Layout/Layout/UIView+Layout.swift @@ -367,7 +367,7 @@ extension UIView: LayoutManaged { } extension UIImageView { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["animationImages"] = .array(of: .uiImage) types["highlightedAnimationImages"] = .array(of: .uiImage) @@ -385,7 +385,7 @@ extension UIImageView { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "isAnimating": switch (value as! Bool, isAnimating) { @@ -433,7 +433,7 @@ private let controlStates: [String: UIControl.State] = [ private var layoutActionsKey: UInt8 = 0 extension UIControl { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["contentVerticalAlignment"] = .uiControlContentVerticalAlignment types["contentHorizontalAlignment"] = .uiControlContentHorizontalAlignment @@ -453,7 +453,7 @@ extension UIControl { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { if let action = value as? Selector, let event = controlEvents[name] { var actions = objc_getAssociatedObject(self, &layoutActionsKey) as? NSMutableDictionary if actions == nil { @@ -507,18 +507,18 @@ extension UIControl { } extension UIButton { - open override class func create(with node: LayoutNode) throws -> UIButton { + override open class func create(with node: LayoutNode) throws -> UIButton { if let type = try node.value(forExpression: "type") as? UIButton.ButtonType { return self.init(type: type) } return self.init(frame: .zero) } - open override class var parameterTypes: [String: RuntimeType] { + override open class var parameterTypes: [String: RuntimeType] { return ["type": .uiButtonType] } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["title"] = .string types["attributedTitle"] = .nsAttributedString @@ -553,7 +553,7 @@ extension UIButton { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "title": setTitle(value as? String, for: .normal) case "titleColor": setTitleColor(value as? UIColor, for: .normal) @@ -579,7 +579,7 @@ extension UIButton { } } - open override func value(forSymbol name: String) throws -> Any { + override open func value(forSymbol name: String) throws -> Any { switch name { case "title": return title(for: .normal) ?? "" case "titleColor": return titleColor(for: .normal) as Any @@ -620,7 +620,7 @@ private let textInputTraits: [String: RuntimeType] = [ ] extension UILabel { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["textAlignment"] = .nsTextAlignment types["lineBreakMode"] = .nsLineBreakMode @@ -651,7 +651,7 @@ extension UILabel { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { if #available(iOS 12.0, *) {} else { switch name { case "enablesMarqueeWhenAncestorFocused": @@ -671,7 +671,7 @@ private let dragAndDropOptions: [String: RuntimeType] = [ ] extension UITextField { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes for (name, type) in textInputTraits { types[name] = type @@ -735,7 +735,7 @@ extension UITextField { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "autocapitalizationType": autocapitalizationType = value as! UITextAutocapitalizationType case "autocorrectionType": autocorrectionType = value as! UITextAutocorrectionType @@ -784,7 +784,7 @@ extension UITextField { } extension UITextView { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["textAlignment"] = .nsTextAlignment types["dataDetectorTypes"] = .uiDataDetectorTypes @@ -819,7 +819,7 @@ extension UITextView { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "autocapitalizationType": autocapitalizationType = value as! UITextAutocapitalizationType case "autocorrectionType": autocorrectionType = value as! UITextAutocorrectionType @@ -856,7 +856,7 @@ extension UITextView { } extension UISearchBar { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["barPosition"] = .uiBarPosition types["barStyle"] = .uiBarStyle @@ -889,7 +889,7 @@ extension UISearchBar { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "autocapitalizationType": autocapitalizationType = value as! UITextAutocapitalizationType case "autocorrectionType": autocorrectionType = value as! UITextAutocorrectionType @@ -925,7 +925,7 @@ private let controlSegments = RuntimeType.uiSegmentedControlSegment.values.mapVa } extension UISegmentedControl: TitleTextAttributes { - open override class func create(with node: LayoutNode) throws -> UISegmentedControl { + override open class func create(with node: LayoutNode) throws -> UISegmentedControl { var items = [Any]() for item in try node.value(forExpression: "items") as? [Any] ?? [] { switch item { @@ -938,7 +938,7 @@ extension UISegmentedControl: TitleTextAttributes { return self.init(items: items) } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["items"] = RuntimeType(NSArray.self) // TODO: find a good naming scheme for left/right state variants @@ -1040,7 +1040,7 @@ extension UISegmentedControl: TitleTextAttributes { setTitleTextAttributes(attributes, for: state) } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "items": try setItems(value as? NSArray, animated: false) // TODO: find a good naming scheme for barMetrics variants @@ -1089,7 +1089,7 @@ extension UISegmentedControl: TitleTextAttributes { } } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "items": try setItems(value as? NSArray, animated: true) @@ -1100,7 +1100,7 @@ extension UISegmentedControl: TitleTextAttributes { } extension UIStepper { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes // TODO: find a good naming scheme for left/right state variants types["backgroundImage"] = .uiImage @@ -1115,7 +1115,7 @@ extension UIStepper { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "backgroundImage": setBackgroundImage(value as? UIImage, for: .normal) case "dividerImage": setDividerImage(value as? UIImage, forLeftSegmentState: .normal, rightSegmentState: .normal) @@ -1138,7 +1138,7 @@ extension UIStepper { } extension UIActivityIndicatorView { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["isAnimating"] = .bool types["activityIndicatorViewStyle"] = .uiActivityIndicatorViewStyle @@ -1172,7 +1172,7 @@ extension UIActivityIndicatorView { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "isAnimating": switch (value as! Bool, isAnimating) { @@ -1188,13 +1188,13 @@ extension UIActivityIndicatorView { } } - open override class var defaultExpressions: [String: String] { + override open class var defaultExpressions: [String: String] { return ["isAnimating": "true"] } } extension UISwitch { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes #if arch(i386) || arch(x86_64) @@ -1204,7 +1204,7 @@ extension UISwitch { return types } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "isOn": setOn(value as! Bool, animated: true) @@ -1215,7 +1215,7 @@ extension UISwitch { } extension UISlider { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["thumbImage"] = .uiImage types["minimumTrackImage"] = .uiImage @@ -1228,7 +1228,7 @@ extension UISlider { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "thumbImage": setThumbImage(value as? UIImage, for: .normal) case "minimumTrackImage": setMinimumTrackImage(value as? UIImage, for: .normal) @@ -1248,7 +1248,7 @@ extension UISlider { } } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "value": setValue(value as! Float, animated: true) @@ -1259,7 +1259,7 @@ extension UISlider { } extension UIProgressView { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["progressViewStyle"] = .uiProgressViewStyle @@ -1270,7 +1270,7 @@ extension UIProgressView { return types } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "progress": setProgress(value as! Float, animated: true) @@ -1281,16 +1281,16 @@ extension UIProgressView { } extension UIInputView { - open override class func create(with node: LayoutNode) throws -> UIInputView { + override open class func create(with node: LayoutNode) throws -> UIInputView { let inputViewStyle = try node.value(forExpression: "inputViewStyle") as? UIInputView.Style ?? .default return self.init(frame: .zero, inputViewStyle: inputViewStyle) } - open override class var parameterTypes: [String: RuntimeType] { + override open class var parameterTypes: [String: RuntimeType] { return ["inputViewStyle": .uiInputViewStyle] } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes // Read-only properties types["inputViewStyle"] = nil @@ -1315,7 +1315,7 @@ extension UIInputView { } extension UIDatePicker { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["datePickerMode"] = .uiDatePickerMode @@ -1332,7 +1332,7 @@ extension UIDatePicker { return types } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "date": setDate(value as! Date, animated: true) @@ -1343,7 +1343,7 @@ extension UIDatePicker { } extension UIRefreshControl { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["isRefreshing"] = .bool @@ -1354,7 +1354,7 @@ extension UIRefreshControl { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "isRefreshing": switch (value as! Bool, isRefreshing) { @@ -1372,7 +1372,7 @@ extension UIRefreshControl { } extension UIVisualEffectView { - open override class func create(with node: LayoutNode) throws -> UIVisualEffectView { + override open class func create(with node: LayoutNode) throws -> UIVisualEffectView { let defaultStyle = RuntimeType.uiBlurEffect_Style.values["regular"]! as! UIBlurEffect.Style var effect = try node.value(forExpression: "effect") as? UIVisualEffect let style = try node.value(forExpression: "effect.style") as? UIBlurEffect.Style @@ -1391,7 +1391,7 @@ extension UIVisualEffectView { return self.init(effect: effect) } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes for (key, type) in UIView.cachedExpressionTypes { types["contentView.\(key)"] = type @@ -1404,7 +1404,7 @@ extension UIVisualEffectView { return types } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { // Insert child views into `contentView` instead of directly contentView.didInsertChildNode(node, at: index) } @@ -1413,7 +1413,7 @@ extension UIVisualEffectView { private var baseURLKey = 1 extension UIWebView { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["baseURL"] = .url types["delegate"] = RuntimeType(UIWebViewDelegate.self) @@ -1434,7 +1434,7 @@ extension UIWebView { return types } - open override class var bodyExpression: String? { + override open class var bodyExpression: String? { return "htmlString" } @@ -1446,7 +1446,7 @@ extension UIWebView { } } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "baseURL": baseURL = value as? URL @@ -1463,18 +1463,18 @@ extension UIWebView { private var readAccessURLKey = 1 extension WKWebView { - open override class func create(with node: LayoutNode) throws -> WKWebView { + override open class func create(with node: LayoutNode) throws -> WKWebView { if let configuration = try node.value(forExpression: "configuration") as? WKWebViewConfiguration { return self.init(frame: .zero, configuration: configuration) } return self.init(frame: .zero) } - open override class var parameterTypes: [String: RuntimeType] { + override open class var parameterTypes: [String: RuntimeType] { return ["configuration": RuntimeType(WKWebViewConfiguration.self)] } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["baseURL"] = .url types["fileURL"] = .url @@ -1498,7 +1498,7 @@ extension WKWebView { return types } - open override class var bodyExpression: String? { + override open class var bodyExpression: String? { return "htmlString" } @@ -1518,7 +1518,7 @@ extension WKWebView { } } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "baseURL": baseURL = value as? URL diff --git a/Snapshots/Layout/Layout/UIViewController+Layout.swift b/Snapshots/Layout/Layout/UIViewController+Layout.swift index 3906aa6c5..0bfdde112 100755 --- a/Snapshots/Layout/Layout/UIViewController+Layout.swift +++ b/Snapshots/Layout/Layout/UIViewController+Layout.swift @@ -345,7 +345,7 @@ extension UIViewController: LayoutManaged { } extension UITabBar { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["selectedImageTintColor"] = .unavailable() // Deprecated types["itemPositioning"] = RuntimeType([ @@ -371,7 +371,7 @@ extension UITabBar { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "delegate": if viewController is UITabBarController { @@ -388,7 +388,7 @@ extension UITabBar { } extension UITabBarController { - open override class func create(with node: LayoutNode) throws -> UITabBarController { + override open class func create(with node: LayoutNode) throws -> UITabBarController { let tabBarController = self.init() let tabBarType = type(of: tabBarController.tabBar) if let child = node.children.first(where: { $0._class is UITabBar.Type && $0._class != tabBarType }) { @@ -397,7 +397,7 @@ extension UITabBarController { return tabBarController } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["delegate"] = RuntimeType(UITabBarControllerDelegate.self) types["selectedIndex"] = .int @@ -418,7 +418,7 @@ extension UITabBarController { return types } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "viewControllers": setViewControllers(value as? [UIViewController], animated: true) @@ -427,7 +427,7 @@ extension UITabBarController { } } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { if let viewController = node.viewController { var viewControllers = self.viewControllers ?? [] viewControllers.append(viewController) // Ignore index @@ -440,7 +440,7 @@ extension UITabBarController { } } - open override func willRemoveChildNode(_ node: LayoutNode, at index: Int) { + override open func willRemoveChildNode(_ node: LayoutNode, at index: Int) { if let viewController = node.viewController, var viewControllers = self.viewControllers, let index = viewControllers.index(of: viewController) { @@ -453,7 +453,7 @@ extension UITabBarController { } extension UINavigationBar: TitleTextAttributes { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["backgroundImage"] = .uiImage types["titleVerticalPositionAdjustment"] = .cgFloat @@ -488,7 +488,7 @@ extension UINavigationBar: TitleTextAttributes { set { titleTextAttributes?[NSAttributedString.Key.font] = newValue } } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "items": setItems(value as? [UINavigationItem], animated: true) @@ -497,7 +497,7 @@ extension UINavigationBar: TitleTextAttributes { } } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "backgroundImage": setBackgroundImage(value as? UIImage, for: .default) @@ -520,7 +520,7 @@ extension UINavigationBar: TitleTextAttributes { } extension UIToolbar { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["items"] = .array(of: UIBarButtonItem.self) types["backgroundImage"] = .uiImage @@ -536,7 +536,7 @@ extension UIToolbar { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "backgroundImage": setBackgroundImage(value as? UIImage, forToolbarPosition: .any, barMetrics: .default) @@ -554,7 +554,7 @@ extension UIToolbar { } extension UINavigationController { - open override class func create(with node: LayoutNode) throws -> UINavigationController { + override open class func create(with node: LayoutNode) throws -> UINavigationController { var navigationBarClass = try node.value(forExpression: "navigationBarClass") as? UINavigationBar.Type var toolbarClass = try node.value(forExpression: "toolbarClass") as? UIToolbar.Type for child in node.children { @@ -575,14 +575,14 @@ extension UINavigationController { return self.init(navigationBarClass: navigationBarClass, toolbarClass: toolbarClass) } - open override class var parameterTypes: [String: RuntimeType] { + override open class var parameterTypes: [String: RuntimeType] { return [ "navigationBarClass": RuntimeType(class: UINavigationBar.self), "toolbarClass": RuntimeType(class: UIToolbar.self), ] } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["viewControllers"] = .array(of: UIViewController.self) // Read-only properties @@ -613,7 +613,7 @@ extension UINavigationController { return types } - open override func setAnimatedValue(_ value: Any, forExpression name: String) throws { + override open func setAnimatedValue(_ value: Any, forExpression name: String) throws { switch name { case "isNavigationBarHidden": setNavigationBarHidden(value as! Bool, animated: true) @@ -626,7 +626,7 @@ extension UINavigationController { } } - open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { + override open func didInsertChildNode(_ node: LayoutNode, at index: Int) { if let viewController = node.viewController { var viewControllers = self.viewControllers viewControllers.append(viewController) // Ignore index @@ -642,7 +642,7 @@ extension UINavigationController { } } - open override func willRemoveChildNode(_ node: LayoutNode, at index: Int) { + override open func willRemoveChildNode(_ node: LayoutNode, at index: Int) { var viewControllers = self.viewControllers if let viewController = node.viewController, let index = viewControllers.index(of: viewController) { @@ -656,7 +656,7 @@ extension UINavigationController { // TODO: better support for alert actions and text fields extension UIAlertController { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["preferredStyle"] = .uiAlertControllerStyle #if arch(i386) || arch(x86_64) @@ -673,20 +673,20 @@ extension UIAlertController { } extension UIActivityViewController { - open override class func create(with node: LayoutNode) throws -> UIActivityViewController { + override open class func create(with node: LayoutNode) throws -> UIActivityViewController { let activityItems: [Any] = try node.value(forExpression: "activityItems") as? [Any] ?? [] let applicationActivities = try node.value(forExpression: "applicationActivities") as? [UIActivity] return self.init(activityItems: activityItems, applicationActivities: applicationActivities) } - open override class var parameterTypes: [String: RuntimeType] { + override open class var parameterTypes: [String: RuntimeType] { return [ "activityItems": .array(of: .any), // TODO: validate activity item types "applicationActivities": RuntimeType([UIActivity].self), ] } - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["excludedActivityTypes"] = .array(of: .uiActivityType) #if arch(i386) || arch(x86_64) @@ -735,7 +735,7 @@ extension UIActivityViewController { } extension UIInputViewController { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes #if arch(i386) || arch(x86_64) // Private property @@ -746,7 +746,7 @@ extension UIInputViewController { } extension UISplitViewController { - open override class var expressionTypes: [String: RuntimeType] { + override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["preferredDisplayMode"] = .uiSplitViewControllerDisplayMode types["viewControllers"] = .array(of: UIViewController.self) @@ -769,7 +769,7 @@ extension UISplitViewController { return types } - open override func setValue(_ value: Any, forExpression name: String) throws { + override open func setValue(_ value: Any, forExpression name: String) throws { switch name { case "primaryEdge": // Does nothing on iOS 10 and earlier diff --git a/Snapshots/Layout/LayoutTests/PropertiesTests.swift b/Snapshots/Layout/LayoutTests/PropertiesTests.swift index 2a0af50c6..d2e0395a5 100755 --- a/Snapshots/Layout/LayoutTests/PropertiesTests.swift +++ b/Snapshots/Layout/LayoutTests/PropertiesTests.swift @@ -6,7 +6,7 @@ import XCTest private class TestView: UIView { @objc var nestedTestView = TestView() - @objc open override class var expressionTypes: [String: RuntimeType] { + @objc override open class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["backgroundColor"] = .unavailable("For reasons") return types diff --git a/Sources/Examples.swift b/Sources/Examples.swift index a22548f23..e0434c42b 100644 --- a/Sources/Examples.swift +++ b/Sources/Examples.swift @@ -785,8 +785,8 @@ private struct Examples { ``` ```diff - - override public final func foo() - + public final override func foo() + - final public override func foo() + + override public final func foo() ``` ```diff diff --git a/Sources/ParsingHelpers.swift b/Sources/ParsingHelpers.swift index aad2ea1ca..4020856d7 100644 --- a/Sources/ParsingHelpers.swift +++ b/Sources/ParsingHelpers.swift @@ -1169,12 +1169,12 @@ extension _FormatRules { // Swift specifier keywords, in preferred order static let specifierOrder = [ + "override", "private", "fileprivate", "internal", "public", "open", "private(set)", "fileprivate(set)", "internal(set)", "public(set)", "final", "dynamic", // Can't be both "optional", "required", "convenience", - "override", "indirect", "lazy", "weak", "unowned", diff --git a/Tests/RulesTests.swift b/Tests/RulesTests.swift index b8bce3ffb..caa8e48ad 100644 --- a/Tests/RulesTests.swift +++ b/Tests/RulesTests.swift @@ -10878,7 +10878,7 @@ class RulesTests: XCTestCase { } class Bar: Foo, Equatable { - public override init() { + override public init() { super.init() } } @@ -10894,7 +10894,7 @@ class RulesTests: XCTestCase { } class Bar: Baz { - public override init() { + override public init() { super.init() } } @@ -10905,7 +10905,7 @@ class RulesTests: XCTestCase { } class Bar: Baz { - public override init() { + override public init() { super.init() } }