From 05234054a0c6435412243b6b8b969256126799fb Mon Sep 17 00:00:00 2001 From: Sacha DSO Date: Fri, 20 Sep 2024 07:50:00 -1000 Subject: [PATCH 1/3] WIP: Migrates main project to Swift 6 --- Package.swift | 2 +- Sources/Stevia/Stevia+Alignment.swift | 68 +++++++++++----------- Sources/Stevia/Stevia+Baselines.swift | 8 +-- Sources/Stevia/Stevia+Constraints.swift | 2 +- Sources/Stevia/Stevia+DoubleDash.swift | 40 ++++++------- Sources/Stevia/Stevia+Equation.swift | 28 ++++----- Sources/Stevia/Stevia+FlexibleMargin.swift | 8 +-- Sources/Stevia/Stevia+GetConstraint.swift | 2 +- Sources/Stevia/Stevia+LayoutAnchors.swift | 4 +- Sources/Stevia/Stevia+Notifications.swift | 2 +- Sources/Stevia/Stevia+Operators.swift | 38 ++++++------ Sources/Stevia/Stevia+Size.swift | 26 ++++----- 12 files changed, 114 insertions(+), 114 deletions(-) diff --git a/Package.swift b/Package.swift index c46de15e..6e87d563 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.9 +// swift-tools-version:6.0 import PackageDescription diff --git a/Sources/Stevia/Stevia+Alignment.swift b/Sources/Stevia/Stevia+Alignment.swift index 0a8c2262..d20d92d5 100644 --- a/Sources/Stevia/Stevia+Alignment.swift +++ b/Sources/Stevia/Stevia+Alignment.swift @@ -25,13 +25,13 @@ import UIKit */ @discardableResult -public func align(horizontally views: UIView...) -> [UIView] { +@MainActor public func align(horizontally views: UIView...) -> [UIView] { return align(horizontally: views) } @available(*, deprecated, renamed: "align(horizontally:)") @discardableResult -public func alignHorizontally(_ views: UIView...) -> [UIView] { +@MainActor public func alignHorizontally(_ views: UIView...) -> [UIView] { return align(horizontally: views) } @@ -51,14 +51,14 @@ public func alignHorizontally(_ views: UIView...) -> [UIView] { */ @discardableResult -public func align(horizontally views: [UIView]) -> [UIView] { +@MainActor public func align(horizontally views: [UIView]) -> [UIView] { align(.horizontal, views: views) return views } @available(*, deprecated, renamed: "align(horizontally:)") @discardableResult -public func alignHorizontally(_ views: [UIView]) -> [UIView] { +@MainActor public func alignHorizontally(_ views: [UIView]) -> [UIView] { align(.horizontal, views: views) return views } @@ -73,12 +73,12 @@ public func alignHorizontally(_ views: [UIView]) -> [UIView] { - Returns: The array of views, enabling chaining, */ -public func align(vertically views: UIView...) { +@MainActor public func align(vertically views: UIView...) { align(vertically: views) } @available(*, deprecated, renamed: "align(vertically:)") -public func alignVertically(_ views: UIView...) { +@MainActor public func alignVertically(_ views: UIView...) { align(vertically: views) } @@ -92,12 +92,12 @@ public func alignVertically(_ views: UIView...) { - Returns: The array of views, enabling chaining, */ -public func align(vertically views: [UIView]) { +@MainActor public func align(vertically views: [UIView]) { align(.vertical, views: views) } @available(*, deprecated, renamed: "align(vertically:)") -public func alignVertically(_ views: [UIView]) { +@MainActor public func alignVertically(_ views: [UIView]) { align(.vertical, views: views) } @@ -108,7 +108,7 @@ public func alignVertically(_ views: [UIView]) { alignCenter(button, with:image) ``` */ -public func alignCenter(_ v1: UIView, with v2: UIView) { +@MainActor public func alignCenter(_ v1: UIView, with v2: UIView) { alignHorizontally(v1, with: v2) alignVertically(v1, with: v2) } @@ -121,7 +121,7 @@ public func alignCenter(_ v1: UIView, with v2: UIView) { ``` */ -public func alignHorizontally(_ v1: UIView, with v2: UIView, offset: Double = 0) { +@MainActor public func alignHorizontally(_ v1: UIView, with v2: UIView, offset: Double = 0) { align(.horizontal, v1: v1, with: v2, offset: offset) } @@ -133,11 +133,11 @@ public func alignHorizontally(_ v1: UIView, with v2: UIView, offset: Double = 0) ``` */ -public func alignVertically(_ v1: UIView, with v2: UIView, offset: Double = 0) { +@MainActor public func alignVertically(_ v1: UIView, with v2: UIView, offset: Double = 0) { align(.vertical, v1: v1, with: v2, offset: offset) } -private func align(_ axis: NSLayoutConstraint.Axis, views: [UIView]) { +@MainActor private func align(_ axis: NSLayoutConstraint.Axis, views: [UIView]) { for (i, v) in views.enumerated() where views.count > i+1 { let v2 = views[i+1] if axis == .horizontal { @@ -148,7 +148,7 @@ private func align(_ axis: NSLayoutConstraint.Axis, views: [UIView]) { } } -func align(_ axis: NSLayoutConstraint.Axis, v1: UIView, with v2: UIView, offset: Double) { +@MainActor func align(_ axis: NSLayoutConstraint.Axis, v1: UIView, with v2: UIView, offset: Double) { if let spv = v1.superview { let center: NSLayoutConstraint.Attribute = axis == .horizontal ? .centerY : .centerX let c = constraint(item: v1, attribute: center, toItem: v2, constant: offset) @@ -174,13 +174,13 @@ func align(_ axis: NSLayoutConstraint.Axis, v1: UIView, with v2: UIView, offset: */ @discardableResult -public func align(tops views: UIView...) -> [UIView] { +@MainActor public func align(tops views: UIView...) -> [UIView] { return align(tops: views) } @available(*, deprecated, renamed: "align(tops:)") @discardableResult -public func alignTops(_ views: UIView...) -> [UIView] { +@MainActor public func alignTops(_ views: UIView...) -> [UIView] { return align(tops: views) } @@ -200,14 +200,14 @@ public func alignTops(_ views: UIView...) -> [UIView] { */ @discardableResult -public func align(tops views: [UIView]) -> [UIView] { +@MainActor public func align(tops views: [UIView]) -> [UIView] { align(.top, views: views) return views } @available(*, deprecated, renamed: "align(tops:)") @discardableResult -public func alignTops(_ views: [UIView]) -> [UIView] { +@MainActor public func alignTops(_ views: [UIView]) -> [UIView] { align(.top, views: views) return views } @@ -228,13 +228,13 @@ public func alignTops(_ views: [UIView]) -> [UIView] { */ @discardableResult -public func align(bottoms views: UIView...) -> [UIView] { +@MainActor public func align(bottoms views: UIView...) -> [UIView] { return align(bottoms: views) } @available(*, deprecated, renamed: "align(bottoms:)") @discardableResult -public func alignBottoms(_ views: UIView...) -> [UIView] { +@MainActor public func alignBottoms(_ views: UIView...) -> [UIView] { return align(bottoms: views) } @@ -254,14 +254,14 @@ public func alignBottoms(_ views: UIView...) -> [UIView] { */ @discardableResult -public func align(bottoms views: [UIView]) -> [UIView] { +@MainActor public func align(bottoms views: [UIView]) -> [UIView] { align(.bottom, views: views) return views } @available(*, deprecated, renamed: "align(bottoms:)") @discardableResult -public func alignBottoms(_ views: [UIView]) -> [UIView] { +@MainActor public func alignBottoms(_ views: [UIView]) -> [UIView] { align(.bottom, views: views) return views } @@ -277,13 +277,13 @@ public func alignBottoms(_ views: [UIView]) -> [UIView] { */ @discardableResult -public func align(lefts views: UIView...) -> [UIView] { +@MainActor public func align(lefts views: UIView...) -> [UIView] { return align(lefts: views) } @available(*, deprecated, renamed: "align(lefts:)") @discardableResult -public func alignLefts(_ views: UIView...) -> [UIView] { +@MainActor public func alignLefts(_ views: UIView...) -> [UIView] { return align(lefts: views) } @@ -298,14 +298,14 @@ public func alignLefts(_ views: UIView...) -> [UIView] { */ @discardableResult -public func align(lefts views: [UIView]) -> [UIView] { +@MainActor public func align(lefts views: [UIView]) -> [UIView] { align(.left, views: views) return views } @available(*, deprecated, renamed: "align(lefts:)") @discardableResult -public func alignLefts(_ views: [UIView]) -> [UIView] { +@MainActor public func alignLefts(_ views: [UIView]) -> [UIView] { align(.left, views: views) return views } @@ -321,13 +321,13 @@ public func alignLefts(_ views: [UIView]) -> [UIView] { */ @discardableResult -public func align(rights views: UIView...) -> [UIView] { +@MainActor public func align(rights views: UIView...) -> [UIView] { return align(rights: views) } @available(*, deprecated, renamed: "align(rights:)") @discardableResult -public func alignRights(_ views: UIView...) -> [UIView] { +@MainActor public func alignRights(_ views: UIView...) -> [UIView] { return align(rights: views) } @@ -342,14 +342,14 @@ public func alignRights(_ views: UIView...) -> [UIView] { */ @discardableResult -public func align(rights views: [UIView]) -> [UIView] { +@MainActor public func align(rights views: [UIView]) -> [UIView] { align(.right, views: views) return views } @available(*, deprecated, renamed: "align(rights:)") @discardableResult -public func alignRights(_ views: [UIView]) -> [UIView] { +@MainActor public func alignRights(_ views: [UIView]) -> [UIView] { align(.right, views: views) return views } @@ -365,7 +365,7 @@ align(leadings: [label,field,button]) */ @discardableResult -public func align(leadings views: [UIView]) -> [UIView] { +@MainActor public func align(leadings views: [UIView]) -> [UIView] { align(.leading, views: views) return views } @@ -381,7 +381,7 @@ align(leadings: label,field,button) */ @discardableResult -public func align(leadings views: UIView...) -> [UIView] { +@MainActor public func align(leadings views: UIView...) -> [UIView] { align(.leading, views: views) return views } @@ -397,7 +397,7 @@ align(trailing: [label,field,button]) */ @discardableResult -public func align(trailings views: [UIView]) -> [UIView] { +@MainActor public func align(trailings views: [UIView]) -> [UIView] { align(.trailing, views: views) return views } @@ -413,13 +413,13 @@ align(trailing: label,field,button) */ @discardableResult -public func align(trailings views: UIView...) -> [UIView] { +@MainActor public func align(trailings views: UIView...) -> [UIView] { align(.trailing, views: views) return views } @discardableResult -public func align(_ attribute: NSLayoutConstraint.Attribute, views: [UIView]) -> [UIView] { +@MainActor public func align(_ attribute: NSLayoutConstraint.Attribute, views: [UIView]) -> [UIView] { for (i, v) in views.enumerated() where views.count > i+1 { let v2 = views[i+1] if let spv = v.superview { diff --git a/Sources/Stevia/Stevia+Baselines.swift b/Sources/Stevia/Stevia+Baselines.swift index 419dfcdd..4e956bd7 100644 --- a/Sources/Stevia/Stevia+Baselines.swift +++ b/Sources/Stevia/Stevia+Baselines.swift @@ -25,12 +25,12 @@ import UIKit */ @discardableResult -public func align(lastBaselines views: UIView...) -> [UIView] { +@MainActor public func align(lastBaselines views: UIView...) -> [UIView] { return align(lastBaselines: views) } @discardableResult -public func align(lastBaselines views: [UIView]) -> [UIView] { +@MainActor public func align(lastBaselines views: [UIView]) -> [UIView] { for (i, v) in views.enumerated() where views.count > i+1 { let v2 = views[i+1] if #available(iOS 9.0, *) { @@ -59,12 +59,12 @@ public func align(lastBaselines views: [UIView]) -> [UIView] { */ @discardableResult -public func align(firstBaselines views: UIView...) -> [UIView] { +@MainActor public func align(firstBaselines views: UIView...) -> [UIView] { return align(firstBaselines: views) } @discardableResult -public func align(firstBaselines views: [UIView]) -> [UIView] { +@MainActor public func align(firstBaselines views: [UIView]) -> [UIView] { for (i, v) in views.enumerated() where views.count > i+1 { let v2 = views[i+1] if #available(iOS 9.0, *) { diff --git a/Sources/Stevia/Stevia+Constraints.swift b/Sources/Stevia/Stevia+Constraints.swift index 35599117..eac541d9 100644 --- a/Sources/Stevia/Stevia+Constraints.swift +++ b/Sources/Stevia/Stevia+Constraints.swift @@ -69,7 +69,7 @@ public extension UIView { - Returns: The NSLayoutConstraint created. */ -func constraint(item view1: AnyObject, +@MainActor func constraint(item view1: AnyObject, attribute attr1: NSLayoutConstraint.Attribute, relatedBy: NSLayoutConstraint.Relation = .equal, toItem view2: AnyObject? = nil, diff --git a/Sources/Stevia/Stevia+DoubleDash.swift b/Sources/Stevia/Stevia+DoubleDash.swift index b3239077..c84032eb 100644 --- a/Sources/Stevia/Stevia+DoubleDash.swift +++ b/Sources/Stevia/Stevia+DoubleDash.swift @@ -26,27 +26,27 @@ public func -- (left: UIView, right: Int) -> PartialConstraint { } @discardableResult -public func -- (left: SideConstraint, right: UIView) -> UIView { +@MainActor public func -- (left: SideConstraint, right: UIView) -> UIView { return left-right } @discardableResult -public func -- (left: [UIView], right: SideConstraint) -> [UIView] { +@MainActor public func -- (left: [UIView], right: SideConstraint) -> [UIView] { return left-right } @discardableResult -public func -- (left: UIView, right: SideConstraint) -> UIView { +@MainActor public func -- (left: UIView, right: SideConstraint) -> UIView { return left-right } @discardableResult -public func -- (left: PartialConstraint, right: UIView) -> [UIView] { +@MainActor public func -- (left: PartialConstraint, right: UIView) -> [UIView] { return left-right } @discardableResult -public func -- (left: UIView, right: UIView) -> [UIView] { +@MainActor public func -- (left: UIView, right: UIView) -> [UIView] { return left-right } @@ -66,7 +66,7 @@ public func -- (left: [UIView], right: Int) -> PartialConstraint { } @discardableResult -public func -- (left: [UIView], right: UIView) -> [UIView] { +@MainActor public func -- (left: [UIView], right: UIView) -> [UIView] { return left-right } @@ -98,22 +98,22 @@ public func -- (left: [UIView], } @discardableResult -public func -- (left: PartialFlexibleConstraint, right: UIView) -> [UIView] { +@MainActor public func -- (left: PartialFlexibleConstraint, right: UIView) -> [UIView] { return left-right } @discardableResult -public func -- (left: SteviaLeftFlexibleMargin, right: UIView) -> UIView { +@MainActor public func -- (left: SteviaLeftFlexibleMargin, right: UIView) -> UIView { return left-right } @discardableResult -public func -- (left: UIView, right: SteviaRightFlexibleMargin) -> UIView { +@MainActor public func -- (left: UIView, right: SteviaRightFlexibleMargin) -> UIView { return left-right } @discardableResult -public func -- (left: [UIView], right: SteviaRightFlexibleMargin) -> [UIView] { +@MainActor public func -- (left: [UIView], right: SteviaRightFlexibleMargin) -> [UIView] { return left-right } #endif @@ -141,27 +141,27 @@ public func ⁃ (left: UIView, right: Int) -> PartialConstraint { } @discardableResult -public func ⁃ (left: SideConstraint, right: UIView) -> UIView { +@MainActor public func ⁃ (left: SideConstraint, right: UIView) -> UIView { return left-right } @discardableResult -public func ⁃ (left: [UIView], right: SideConstraint) -> [UIView] { +@MainActor public func ⁃ (left: [UIView], right: SideConstraint) -> [UIView] { return left-right } @discardableResult -public func ⁃ (left: UIView, right: SideConstraint) -> UIView { +@MainActor public func ⁃ (left: UIView, right: SideConstraint) -> UIView { return left-right } @discardableResult -public func ⁃ (left: PartialConstraint, right: UIView) -> [UIView] { +@MainActor public func ⁃ (left: PartialConstraint, right: UIView) -> [UIView] { return left-right } @discardableResult -public func ⁃ (left: UIView, right: UIView) -> [UIView] { +@MainActor public func ⁃ (left: UIView, right: UIView) -> [UIView] { return left-right } @@ -181,7 +181,7 @@ public func ⁃ (left: [UIView], right: Int) -> PartialConstraint { } @discardableResult -public func ⁃ (left: [UIView], right: UIView) -> [UIView] { +@MainActor public func ⁃ (left: [UIView], right: UIView) -> [UIView] { return left-right } @@ -213,22 +213,22 @@ public func ⁃ (left: [UIView], } @discardableResult -public func ⁃ (left: PartialFlexibleConstraint, right: UIView) -> [UIView] { +@MainActor public func ⁃ (left: PartialFlexibleConstraint, right: UIView) -> [UIView] { return left-right } @discardableResult -public func ⁃ (left: SteviaLeftFlexibleMargin, right: UIView) -> UIView { +@MainActor public func ⁃ (left: SteviaLeftFlexibleMargin, right: UIView) -> UIView { return left-right } @discardableResult -public func ⁃ (left: UIView, right: SteviaRightFlexibleMargin) -> UIView { +@MainActor public func ⁃ (left: UIView, right: SteviaRightFlexibleMargin) -> UIView { return left-right } @discardableResult -public func ⁃ (left: [UIView], right: SteviaRightFlexibleMargin) -> [UIView] { +@MainActor public func ⁃ (left: [UIView], right: SteviaRightFlexibleMargin) -> [UIView] { return left-right } #endif diff --git a/Sources/Stevia/Stevia+Equation.swift b/Sources/Stevia/Stevia+Equation.swift index 9a35b15b..6083f84a 100644 --- a/Sources/Stevia/Stevia+Equation.swift +++ b/Sources/Stevia/Stevia+Equation.swift @@ -84,7 +84,7 @@ public extension UIView { // MARK: - Equations of type v.P == v'.P' + X @discardableResult -public func == (left: SteviaAttribute, right: SteviaAttribute) -> NSLayoutConstraint { +@MainActor public func == (left: SteviaAttribute, right: SteviaAttribute) -> NSLayoutConstraint { let constant = right.constant ?? left.constant ?? 0 let multiplier = right.multiplier ?? left.multiplier ?? 1 @@ -138,7 +138,7 @@ public func == (left: SteviaAttribute, right: SteviaAttribute) -> NSLayoutConstr return NSLayoutConstraint() } -func commonParent(with viewA: UIView, and viewB: UIView) -> UIView? { +@MainActor func commonParent(with viewA: UIView, and viewB: UIView) -> UIView? { // Both views should have a superview guard viewA.superview != nil && viewB.superview != nil else { @@ -158,16 +158,16 @@ func commonParent(with viewA: UIView, and viewB: UIView) -> UIView? { } @discardableResult -public func >= (left: SteviaAttribute, right: SteviaAttribute) -> NSLayoutConstraint { +@MainActor public func >= (left: SteviaAttribute, right: SteviaAttribute) -> NSLayoutConstraint { return applyRelation(left: left, right: right, relateBy: .greaterThanOrEqual) } @discardableResult -public func <= (left: SteviaAttribute, right: SteviaAttribute) -> NSLayoutConstraint { +@MainActor public func <= (left: SteviaAttribute, right: SteviaAttribute) -> NSLayoutConstraint { return applyRelation(left: left, right: right, relateBy: .lessThanOrEqual) } -private func applyRelation(left: SteviaAttribute, right: SteviaAttribute, relateBy: NSLayoutConstraint.Relation) -> NSLayoutConstraint { +@MainActor private func applyRelation(left: SteviaAttribute, right: SteviaAttribute, relateBy: NSLayoutConstraint.Relation) -> NSLayoutConstraint { let constant = right.constant ?? 0 let multiplier = right.multiplier ?? 1 if let spv = left.view.superview { @@ -262,7 +262,7 @@ public func % (left: Int, right: SteviaAttribute) -> SteviaAttribute { // MARK: - Equations of type v.P == X @discardableResult -public func == (left: SteviaAttribute, right: Double) -> NSLayoutConstraint { +@MainActor public func == (left: SteviaAttribute, right: Double) -> NSLayoutConstraint { if let spv = left.view.superview { var toItem: UIView? = spv var constant = right @@ -281,17 +281,17 @@ public func == (left: SteviaAttribute, right: Double) -> NSLayoutConstraint { } @discardableResult -public func == (left: SteviaAttribute, right: CGFloat) -> NSLayoutConstraint { +@MainActor public func == (left: SteviaAttribute, right: CGFloat) -> NSLayoutConstraint { left == Double(right) } @discardableResult -public func == (left: SteviaAttribute, right: Int) -> NSLayoutConstraint { +@MainActor public func == (left: SteviaAttribute, right: Int) -> NSLayoutConstraint { left == Double(right) } @discardableResult -public func >= (left: SteviaAttribute, right: Double) -> NSLayoutConstraint { +@MainActor public func >= (left: SteviaAttribute, right: Double) -> NSLayoutConstraint { if let spv = left.view.superview { var toItem: UIView? = spv var constant = right @@ -311,17 +311,17 @@ public func >= (left: SteviaAttribute, right: Double) -> NSLayoutConstraint { } @discardableResult -public func >= (left: SteviaAttribute, right: CGFloat) -> NSLayoutConstraint { +@MainActor public func >= (left: SteviaAttribute, right: CGFloat) -> NSLayoutConstraint { left >= Double(right) } @discardableResult -public func >= (left: SteviaAttribute, right: Int) -> NSLayoutConstraint { +@MainActor public func >= (left: SteviaAttribute, right: Int) -> NSLayoutConstraint { left >= Double(right) } @discardableResult -public func <= (left: SteviaAttribute, right: Double) -> NSLayoutConstraint { +@MainActor public func <= (left: SteviaAttribute, right: Double) -> NSLayoutConstraint { if let spv = left.view.superview { var toItem: UIView? = spv var constant = right @@ -341,12 +341,12 @@ public func <= (left: SteviaAttribute, right: Double) -> NSLayoutConstraint { } @discardableResult -public func <= (left: SteviaAttribute, right: CGFloat) -> NSLayoutConstraint { +@MainActor public func <= (left: SteviaAttribute, right: CGFloat) -> NSLayoutConstraint { left <= Double(right) } @discardableResult -public func <= (left: SteviaAttribute, right: Int) -> NSLayoutConstraint { +@MainActor public func <= (left: SteviaAttribute, right: Int) -> NSLayoutConstraint { left <= Double(right) } #endif diff --git a/Sources/Stevia/Stevia+FlexibleMargin.swift b/Sources/Stevia/Stevia+FlexibleMargin.swift index bfc32152..7116fc3f 100644 --- a/Sources/Stevia/Stevia+FlexibleMargin.swift +++ b/Sources/Stevia/Stevia+FlexibleMargin.swift @@ -65,7 +65,7 @@ public func - (left: [UIView], } @discardableResult -public func - (left: PartialFlexibleConstraint, right: UIView) -> [UIView] { +@MainActor public func - (left: PartialFlexibleConstraint, right: UIView) -> [UIView] { if let views = left.views { if let spv = right.superview { let c = constraint(item: right, attribute: .leading, @@ -99,7 +99,7 @@ public prefix func |- (fm: SteviaFlexibleMargin) -> SteviaLeftFlexibleMargin { } @discardableResult -public func - (left: SteviaLeftFlexibleMargin, right: UIView) -> UIView { +@MainActor public func - (left: SteviaLeftFlexibleMargin, right: UIView) -> UIView { if let spv = right.superview { let c = constraint(item: right, attribute: .leading, relatedBy: left.fm.relation, toItem: spv, @@ -122,7 +122,7 @@ public postfix func -| (fm: SteviaFlexibleMargin) -> SteviaRightFlexibleMargin { } @discardableResult -public func - (left: UIView, right: SteviaRightFlexibleMargin) -> UIView { +@MainActor public func - (left: UIView, right: SteviaRightFlexibleMargin) -> UIView { if let spv = left.superview { let c = constraint(item: spv, attribute: .trailing, relatedBy: right.fm.relation, toItem: left, @@ -134,7 +134,7 @@ public func - (left: UIView, right: SteviaRightFlexibleMargin) -> UIView { } @discardableResult -public func - (left: [UIView], right: SteviaRightFlexibleMargin) -> [UIView] { +@MainActor public func - (left: [UIView], right: SteviaRightFlexibleMargin) -> [UIView] { if let spv = left.last!.superview { let c = constraint(item: spv, attribute: .trailing, relatedBy: right.fm.relation, diff --git a/Sources/Stevia/Stevia+GetConstraint.swift b/Sources/Stevia/Stevia+GetConstraint.swift index 4cf6a69c..52556ab1 100644 --- a/Sources/Stevia/Stevia+GetConstraint.swift +++ b/Sources/Stevia/Stevia+GetConstraint.swift @@ -171,7 +171,7 @@ public extension UIView { } } -func constraintForView(_ v: UIView, attribute: NSLayoutConstraint.Attribute) -> NSLayoutConstraint? { +@MainActor func constraintForView(_ v: UIView, attribute: NSLayoutConstraint.Attribute) -> NSLayoutConstraint? { func lookForConstraint(in view: UIView?) -> NSLayoutConstraint? { guard let constraints = view?.constraints else { diff --git a/Sources/Stevia/Stevia+LayoutAnchors.swift b/Sources/Stevia/Stevia+LayoutAnchors.swift index 2bf5d708..4990d9ad 100644 --- a/Sources/Stevia/Stevia+LayoutAnchors.swift +++ b/Sources/Stevia/Stevia+LayoutAnchors.swift @@ -69,7 +69,7 @@ public extension UILayoutGuide { @available(iOS 9.0, *) @discardableResult -public func == (left: SteviaAttribute, right: SteviaLayoutYAxisAnchor) -> NSLayoutConstraint { +@MainActor public func == (left: SteviaAttribute, right: SteviaLayoutYAxisAnchor) -> NSLayoutConstraint { var constraint = NSLayoutConstraint() @@ -91,7 +91,7 @@ public func == (left: SteviaAttribute, right: SteviaLayoutYAxisAnchor) -> NSLayo @available(iOS 9.0, *) @discardableResult -public func == (left: SteviaAttribute, right: SteviaLayoutXAxisAnchor) -> NSLayoutConstraint { +@MainActor public func == (left: SteviaAttribute, right: SteviaLayoutXAxisAnchor) -> NSLayoutConstraint { var constraint = NSLayoutConstraint() diff --git a/Sources/Stevia/Stevia+Notifications.swift b/Sources/Stevia/Stevia+Notifications.swift index 1bc88fd0..ff1e2c30 100644 --- a/Sources/Stevia/Stevia+Notifications.swift +++ b/Sources/Stevia/Stevia+Notifications.swift @@ -11,7 +11,7 @@ import UIKit public extension NSObject { - func on(_ event: String, _ callback:@escaping () -> Void) { + func on(_ event: String, _ callback:@escaping @Sendable() -> Void) { _ = NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: event), object: nil, queue: nil) { _ in diff --git a/Sources/Stevia/Stevia+Operators.swift b/Sources/Stevia/Stevia+Operators.swift index 3ecc5e76..e4a11c13 100644 --- a/Sources/Stevia/Stevia+Operators.swift +++ b/Sources/Stevia/Stevia+Operators.swift @@ -11,13 +11,13 @@ import UIKit prefix operator | @discardableResult -public prefix func | (p: UIView) -> UIView { +@MainActor public prefix func | (p: UIView) -> UIView { p.leading(0) } postfix operator | @discardableResult -public postfix func | (p: UIView) -> UIView { +@MainActor public postfix func | (p: UIView) -> UIView { p.trailing(0) } @@ -28,48 +28,48 @@ precedencegroup HeightPrecedence { } @discardableResult -public func ~ (left: UIView, right: Double) -> UIView { +@MainActor public func ~ (left: UIView, right: Double) -> UIView { left.height(right) } @discardableResult -public func ~ (left: UIView, right: CGFloat) -> UIView { +@MainActor public func ~ (left: UIView, right: CGFloat) -> UIView { left ~ Double(right) } @discardableResult -public func ~ (left: UIView, right: Int) -> UIView { +@MainActor public func ~ (left: UIView, right: Int) -> UIView { left ~ Double(right) } @discardableResult -public func ~ (left: UIView, right: SteviaPercentage) -> UIView { +@MainActor public func ~ (left: UIView, right: SteviaPercentage) -> UIView { left.height(right) } @discardableResult -public func ~ (left: UIView, right: SteviaFlexibleMargin) -> UIView { +@MainActor public func ~ (left: UIView, right: SteviaFlexibleMargin) -> UIView { left.height(right) } @discardableResult -public func ~ (left: [UIView], right: Double) -> [UIView] { +@MainActor public func ~ (left: [UIView], right: Double) -> [UIView] { for l in left { l.height(right) } return left } @discardableResult -public func ~ (left: [UIView], right: CGFloat) -> [UIView] { +@MainActor public func ~ (left: [UIView], right: CGFloat) -> [UIView] { left ~ Double(right) } @discardableResult -public func ~ (left: [UIView], right: Int) -> [UIView] { +@MainActor public func ~ (left: [UIView], right: Int) -> [UIView] { left ~ Double(right) } @discardableResult -public func ~ (left: [UIView], right: SteviaFlexibleMargin) -> [UIView] { +@MainActor public func ~ (left: [UIView], right: SteviaFlexibleMargin) -> [UIView] { for l in left { l.height(right) } return left } @@ -93,7 +93,7 @@ public prefix func |- (p: Int) -> SideConstraint { } @discardableResult -public prefix func |- (v: UIView) -> UIView { +@MainActor public prefix func |- (v: UIView) -> UIView { v.leading(8) } @@ -116,7 +116,7 @@ public postfix func -| (p: Int) -> SideConstraint { } @discardableResult -public postfix func -| (v: UIView) -> UIView { +@MainActor public postfix func -| (v: UIView) -> UIView { v.trailing(8) } @@ -151,7 +151,7 @@ public func - (left: UIView, right: Int) -> PartialConstraint { // Side Constraints @discardableResult -public func - (left: SideConstraint, right: UIView) -> UIView { +@MainActor public func - (left: SideConstraint, right: UIView) -> UIView { if let spv = right.superview { let c = constraint(item: right, attribute: .leading, toItem: spv, attribute: .leading, @@ -162,7 +162,7 @@ public func - (left: SideConstraint, right: UIView) -> UIView { } @discardableResult -public func - (left: [UIView], right: SideConstraint) -> [UIView] { +@MainActor public func - (left: [UIView], right: SideConstraint) -> [UIView] { let lastView = left[left.count-1] if let spv = lastView.superview { let c = constraint(item: lastView, attribute: .trailing, @@ -174,7 +174,7 @@ public func - (left: [UIView], right: SideConstraint) -> [UIView] { } @discardableResult -public func - (left: UIView, right: SideConstraint) -> UIView { +@MainActor public func - (left: UIView, right: SideConstraint) -> UIView { if let spv = left.superview { let c = constraint(item: left, attribute: .trailing, toItem: spv, attribute: .trailing, @@ -185,7 +185,7 @@ public func - (left: UIView, right: SideConstraint) -> UIView { } @discardableResult -public func - (left: PartialConstraint, right: UIView) -> [UIView] { +@MainActor public func - (left: PartialConstraint, right: UIView) -> [UIView] { if let views = left.views { if let spv = right.superview { let lastView = views[views.count-1] @@ -209,7 +209,7 @@ public func - (left: PartialConstraint, right: UIView) -> [UIView] { } @discardableResult -public func - (left: UIView, right: UIView) -> [UIView] { +@MainActor public func - (left: UIView, right: UIView) -> [UIView] { if let spv = left.superview { let c = constraint(item: right, attribute: .leading, toItem: left, attribute: .trailing, @@ -239,7 +239,7 @@ public func - (left: [UIView], right: Int) -> PartialConstraint { @discardableResult -public func - (left: [UIView], right: UIView) -> [UIView] { +@MainActor public func - (left: [UIView], right: UIView) -> [UIView] { let lastView = left[left.count-1] if let spv = lastView.superview { let c = constraint(item: lastView, attribute: .trailing, diff --git a/Sources/Stevia/Stevia+Size.swift b/Sources/Stevia/Stevia+Size.swift index 24fd2d55..9746acb5 100644 --- a/Sources/Stevia/Stevia+Size.swift +++ b/Sources/Stevia/Stevia+Size.swift @@ -268,13 +268,13 @@ public extension UIView { */ @discardableResult -public func equal(sizes views: UIView...) -> [UIView] { +@MainActor public func equal(sizes views: UIView...) -> [UIView] { return equal(sizes: views) } @available(*, deprecated, renamed:"equal(sizes:)") @discardableResult -public func equalSizes(_ views: UIView...) -> [UIView] { +@MainActor public func equalSizes(_ views: UIView...) -> [UIView] { return equal(sizes: views) } @@ -289,7 +289,7 @@ public func equalSizes(_ views: UIView...) -> [UIView] { */ @discardableResult -public func equal(sizes views: [UIView]) -> [UIView] { +@MainActor public func equal(sizes views: [UIView]) -> [UIView] { equal(heights: views) equal(widths: views) return views @@ -297,7 +297,7 @@ public func equal(sizes views: [UIView]) -> [UIView] { @available(*, deprecated, renamed:"equal(sizes:)") @discardableResult -public func equalSizes(_ views: [UIView]) -> [UIView] { +@MainActor public func equalSizes(_ views: [UIView]) -> [UIView] { equal(heights: views) equal(widths: views) return views @@ -314,13 +314,13 @@ public func equalSizes(_ views: [UIView]) -> [UIView] { */ @discardableResult -public func equal(widths views: UIView...) -> [UIView] { +@MainActor public func equal(widths views: UIView...) -> [UIView] { return equal(widths: views) } @available(*, deprecated, renamed:"equal(widths:)") @discardableResult -public func equalWidths(_ views: UIView...) -> [UIView] { +@MainActor public func equalWidths(_ views: UIView...) -> [UIView] { return equal(widths: views) } @@ -335,14 +335,14 @@ public func equalWidths(_ views: UIView...) -> [UIView] { */ @discardableResult -public func equal(widths views: [UIView]) -> [UIView] { +@MainActor public func equal(widths views: [UIView]) -> [UIView] { equal(.width, views: views) return views } @available(*, deprecated, renamed:"equal(widths:)") @discardableResult -public func equalWidths(_ views: [UIView]) -> [UIView] { +@MainActor public func equalWidths(_ views: [UIView]) -> [UIView] { equal(.width, views: views) return views } @@ -358,13 +358,13 @@ public func equalWidths(_ views: [UIView]) -> [UIView] { */ @discardableResult -public func equal(heights views: UIView...) -> [UIView] { +@MainActor public func equal(heights views: UIView...) -> [UIView] { return equal(heights: views) } @available(*, deprecated, renamed:"equal(heights:)") @discardableResult -public func equalHeights(_ views: UIView...) -> [UIView] { +@MainActor public func equalHeights(_ views: UIView...) -> [UIView] { return equal(heights: views) } @@ -379,19 +379,19 @@ public func equalHeights(_ views: UIView...) -> [UIView] { */ @discardableResult -public func equal(heights views: [UIView]) -> [UIView] { +@MainActor public func equal(heights views: [UIView]) -> [UIView] { equal(.height, views: views) return views } @available(*, deprecated, renamed:"equal(heights:)") @discardableResult -public func equalHeights(_ views: [UIView]) -> [UIView] { +@MainActor public func equalHeights(_ views: [UIView]) -> [UIView] { equal(.height, views: views) return views } -private func equal(_ attribute: NSLayoutConstraint.Attribute, views: [UIView]) { +@MainActor private func equal(_ attribute: NSLayoutConstraint.Attribute, views: [UIView]) { var previousView: UIView? for v in views { if let pv = previousView { From c3ecd9b35c6b45a02be539e2fd0696323ee43022 Mon Sep 17 00:00:00 2001 From: Sacha DSO Date: Fri, 20 Sep 2024 07:59:38 -1000 Subject: [PATCH 2/3] WIP: Fixes unit tests --- Tests/SteviaTests/BaselineTests.swift | 6 +++-- Tests/SteviaTests/CenterTests.swift | 6 ++--- Tests/SteviaTests/ContentTests.swift | 25 +++++++++++---------- Tests/SteviaTests/EquationTests.swift | 6 ++--- Tests/SteviaTests/FillTests.swift | 6 ++--- Tests/SteviaTests/FlexibleMarginTests.swift | 6 ++--- Tests/SteviaTests/FullLayoutTests.swift | 6 ++--- Tests/SteviaTests/GetConstraintsTests.swift | 22 +++++++++--------- Tests/SteviaTests/HierarchyTests.swift | 2 +- Tests/SteviaTests/LayoutTests.swift | 6 ++--- Tests/SteviaTests/PositionTests.swift | 6 ++--- Tests/SteviaTests/SizeTests.swift | 16 ++++++++++--- Tests/SteviaTests/StyleTests.swift | 2 +- 13 files changed, 64 insertions(+), 51 deletions(-) diff --git a/Tests/SteviaTests/BaselineTests.swift b/Tests/SteviaTests/BaselineTests.swift index 1213b921..35c5dcf5 100644 --- a/Tests/SteviaTests/BaselineTests.swift +++ b/Tests/SteviaTests/BaselineTests.swift @@ -9,14 +9,14 @@ import XCTest import Stevia -class BaselineTests: XCTestCase { +@MainActor class BaselineTests: XCTestCase { var win: UIWindow! var ctrler: UIViewController! var label1 = UILabel() var label2 = UILabel() - override func setUp() { + override func setUp() async throws { win = UIWindow(frame: UIScreen.main.bounds) ctrler = UIViewController() win.rootViewController = ctrler @@ -29,6 +29,8 @@ class BaselineTests: XCTestCase { } } + + func testAlignLastBaselines() { label1.top(100) align(lastBaselines: label1, label2) diff --git a/Tests/SteviaTests/CenterTests.swift b/Tests/SteviaTests/CenterTests.swift index cadf6ce4..e08537af 100644 --- a/Tests/SteviaTests/CenterTests.swift +++ b/Tests/SteviaTests/CenterTests.swift @@ -10,14 +10,14 @@ import XCTest let magicalIphoneXShift = 0.17 -class CenterTests: XCTestCase { +@MainActor class CenterTests: XCTestCase { var win: UIWindow! var ctrler: UIViewController! var v: UIView! - override func setUp() { - super.setUp() + override func setUp() async throws { +// try await super.setUp() win = UIWindow(frame: UIScreen.main.bounds) ctrler = UIViewController() win.rootViewController = ctrler diff --git a/Tests/SteviaTests/ContentTests.swift b/Tests/SteviaTests/ContentTests.swift index 5eeb8f4e..aaaebf2b 100644 --- a/Tests/SteviaTests/ContentTests.swift +++ b/Tests/SteviaTests/ContentTests.swift @@ -12,11 +12,11 @@ import Stevia let title = "TitleTest" -class UIButtonContentTests: XCTestCase { +@MainActor class UIButtonContentTests: XCTestCase { var button = UIButton() - override func setUp() { - super.setUp() + override func setUp() async throws { +// button = UIButton() } @@ -41,11 +41,12 @@ class UIButtonContentTests: XCTestCase { } } -class UILabelContentTests: XCTestCase { + +@MainActor class UILabelContentTests: XCTestCase { var label = UILabel() - override func setUp() { - super.setUp() + override func setUp() async throws { +// super.setUp() label = UILabel() } @@ -64,11 +65,11 @@ class UILabelContentTests: XCTestCase { } } -class UITextFieldContentTests: XCTestCase { +@MainActor class UITextFieldContentTests: XCTestCase { var textField = UITextField() - override func setUp() { - super.setUp() + override func setUp() async throws { +// super.setUp() textField = UITextField() } @@ -82,11 +83,11 @@ class UITextFieldContentTests: XCTestCase { } } -class UIImageViewContentTests: XCTestCase { +@MainActor class UIImageViewContentTests: XCTestCase { var imageView = UIImageView() - override func setUp() { - super.setUp() + override func setUp() async throws { +// super.setUp() imageView = UIImageView() } diff --git a/Tests/SteviaTests/EquationTests.swift b/Tests/SteviaTests/EquationTests.swift index 4c67fa67..5c1eff0d 100644 --- a/Tests/SteviaTests/EquationTests.swift +++ b/Tests/SteviaTests/EquationTests.swift @@ -9,13 +9,13 @@ import XCTest import Stevia -class EquationTests: XCTestCase { +@MainActor class EquationTests: XCTestCase { var win: UIWindow! var ctrler: UIViewController! - override func setUp() { - super.setUp() + override func setUp() async throws { +// super.setUp() win = UIWindow(frame: UIScreen.main.bounds) ctrler = UIViewController() win.rootViewController = ctrler diff --git a/Tests/SteviaTests/FillTests.swift b/Tests/SteviaTests/FillTests.swift index ad815411..38311eba 100644 --- a/Tests/SteviaTests/FillTests.swift +++ b/Tests/SteviaTests/FillTests.swift @@ -10,12 +10,12 @@ import XCTest import Stevia -class FillTests: XCTestCase { +@MainActor class FillTests: XCTestCase { var win: UIWindow! var ctrler: UIViewController! - override func setUp() { - super.setUp() + override func setUp() async throws { +// super.setUp() win = UIWindow(frame: UIScreen.main.bounds) ctrler = UIViewController() win.rootViewController = ctrler diff --git a/Tests/SteviaTests/FlexibleMarginTests.swift b/Tests/SteviaTests/FlexibleMarginTests.swift index f3f26842..246a67bd 100644 --- a/Tests/SteviaTests/FlexibleMarginTests.swift +++ b/Tests/SteviaTests/FlexibleMarginTests.swift @@ -9,14 +9,14 @@ import XCTest import Stevia -class FlexibleMarginTests: XCTestCase { +@MainActor class FlexibleMarginTests: XCTestCase { var win: UIWindow! var ctrler: UIViewController! var v: UIView! - override func setUp() { - super.setUp() + override func setUp() async throws { +// super.setUp() win = UIWindow(frame: UIScreen.main.bounds) ctrler = UIViewController() win.rootViewController = ctrler diff --git a/Tests/SteviaTests/FullLayoutTests.swift b/Tests/SteviaTests/FullLayoutTests.swift index 26960413..006e01dd 100644 --- a/Tests/SteviaTests/FullLayoutTests.swift +++ b/Tests/SteviaTests/FullLayoutTests.swift @@ -53,14 +53,14 @@ class TestView: UIView { } } -class FullLayoutTests: XCTestCase { +@MainActor class FullLayoutTests: XCTestCase { var win: UIWindow! var vc: UIViewController! var v: TestView! - override func setUp() { - super.setUp() + override func setUp() async throws { +// super.setUp() win = UIWindow(frame: UIScreen.main.bounds) vc = UIViewController()///TestVC() win.rootViewController = vc diff --git a/Tests/SteviaTests/GetConstraintsTests.swift b/Tests/SteviaTests/GetConstraintsTests.swift index 2a33b2fa..8b594103 100644 --- a/Tests/SteviaTests/GetConstraintsTests.swift +++ b/Tests/SteviaTests/GetConstraintsTests.swift @@ -9,14 +9,14 @@ import XCTest import Stevia -class GetConstraintsTests: XCTestCase { +@MainActor class GetConstraintsTests: XCTestCase { var v: UIView! var spv: UIView! - override func setUp() { - spv = UIView() - v = UIView() + override func setUp() async throws { + spv = await UIView() + v = await UIView() spv.subviews { v! } } @@ -68,7 +68,7 @@ class GetConstraintsTests: XCTestCase { XCTAssertEqual(c?.isActive, true) } - func testCanGetBottomConstraint() { + @MainActor func testCanGetBottomConstraint() { XCTAssertNil(v.bottomConstraint) v.bottom(145) let c = v.bottomConstraint @@ -84,7 +84,7 @@ class GetConstraintsTests: XCTestCase { XCTAssertEqual(c?.isActive, true) } - func testCanGetHeightConstraint() { + @MainActor func testCanGetHeightConstraint() { XCTAssertNil(v.heightConstraint) v.height(35) let c = v.heightConstraint @@ -100,7 +100,7 @@ class GetConstraintsTests: XCTestCase { XCTAssertEqual(c?.isActive, true) } - func testCanGetWidthConstraint() { + @MainActor func testCanGetWidthConstraint() { XCTAssertNil(v.widthConstraint) v.width(51) let c = v.widthConstraint @@ -116,7 +116,7 @@ class GetConstraintsTests: XCTestCase { XCTAssertEqual(c?.isActive, true) } - func testCanGetTrailingConstraint() { + @MainActor func testCanGetTrailingConstraint() { XCTAssertNil(v.trailingConstraint) v.trailingAnchor.constraint(equalTo: spv.trailingAnchor, constant: 104).isActive = true let c = v.trailingConstraint @@ -132,7 +132,7 @@ class GetConstraintsTests: XCTestCase { XCTAssertEqual(c?.isActive, true) } - func testCanGetLeadingonstraint() { + @MainActor func testCanGetLeadingonstraint() { XCTAssertNil(v.leadingConstraint) v.leadingAnchor.constraint(equalTo: spv.leadingAnchor, constant: 73).isActive = true let c = v.leadingConstraint @@ -148,7 +148,7 @@ class GetConstraintsTests: XCTestCase { XCTAssertEqual(c?.isActive, true) } - func testCanGetCenterXConstraint() { + @MainActor func testCanGetCenterXConstraint() { XCTAssertNil(v.centerXConstraint) v.CenterX == spv.CenterX + 27 let c = v.centerXConstraint @@ -164,7 +164,7 @@ class GetConstraintsTests: XCTestCase { XCTAssertEqual(c?.isActive, true) } - func testCanGetCenterYConstraint() { + @MainActor func testCanGetCenterYConstraint() { XCTAssertNil(v.centerYConstraint) v.CenterY == spv.CenterY - 32 let c = v.centerYConstraint diff --git a/Tests/SteviaTests/HierarchyTests.swift b/Tests/SteviaTests/HierarchyTests.swift index 38fbd0fd..db0573e8 100644 --- a/Tests/SteviaTests/HierarchyTests.swift +++ b/Tests/SteviaTests/HierarchyTests.swift @@ -9,7 +9,7 @@ import XCTest import Stevia -class HierarchyTests: XCTestCase { +@MainActor class HierarchyTests: XCTestCase { override func setUp() { super.setUp() diff --git a/Tests/SteviaTests/LayoutTests.swift b/Tests/SteviaTests/LayoutTests.swift index 77a0628f..2a3bf424 100644 --- a/Tests/SteviaTests/LayoutTests.swift +++ b/Tests/SteviaTests/LayoutTests.swift @@ -9,14 +9,14 @@ import XCTest import Stevia -class LayoutTests: XCTestCase { +@MainActor class LayoutTests: XCTestCase { var win: UIWindow! var ctrler: UIViewController! var v: UIView! - override func setUp() { - super.setUp() + override func setUp() async throws { +// super.setUp() win = UIWindow(frame: UIScreen.main.bounds) ctrler = UIViewController() win.rootViewController = ctrler diff --git a/Tests/SteviaTests/PositionTests.swift b/Tests/SteviaTests/PositionTests.swift index e20af419..a98aaf97 100644 --- a/Tests/SteviaTests/PositionTests.swift +++ b/Tests/SteviaTests/PositionTests.swift @@ -9,14 +9,14 @@ import XCTest import Stevia -class PositionTests: XCTestCase { +@MainActor class PositionTests: XCTestCase { var win: UIWindow! var ctrler: UIViewController! var v: UIView! - override func setUp() { - super.setUp() + override func setUp() async throws { +// super.setUp() win = UIWindow(frame: UIScreen.main.bounds) ctrler = UIViewController() win.rootViewController = ctrler diff --git a/Tests/SteviaTests/SizeTests.swift b/Tests/SteviaTests/SizeTests.swift index b1b6fef1..0ad681d0 100644 --- a/Tests/SteviaTests/SizeTests.swift +++ b/Tests/SteviaTests/SizeTests.swift @@ -9,14 +9,24 @@ import XCTest import Stevia -class SizeTests: XCTestCase { +@MainActor class SizeTests: XCTestCase { var win: UIWindow! var ctrler: UIViewController! var v: UIView! - override func setUp() { - super.setUp() + override func setUp() async throws { +// try await super.setUp() + win = UIWindow(frame: UIScreen.main.bounds) + ctrler = UIViewController() + win.rootViewController = ctrler + v = UIView() + ctrler.view.subviews { + v! + } + } + + func uiSetUp() { win = UIWindow(frame: UIScreen.main.bounds) ctrler = UIViewController() win.rootViewController = ctrler diff --git a/Tests/SteviaTests/StyleTests.swift b/Tests/SteviaTests/StyleTests.swift index 326b2ecc..6c7a173a 100644 --- a/Tests/SteviaTests/StyleTests.swift +++ b/Tests/SteviaTests/StyleTests.swift @@ -9,7 +9,7 @@ import XCTest import Stevia -class StyleTests: XCTestCase { +@MainActor class StyleTests: XCTestCase { func styleView(_ view: UIView) { view.backgroundColor = UIColor.yellow From ff8b1f186ec4e1719f854177d101b57b9bdc310d Mon Sep 17 00:00:00 2001 From: Sacha DSO Date: Sat, 21 Sep 2024 17:24:51 -1000 Subject: [PATCH 3/3] Update swift.yml --- .github/workflows/swift.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 2d936587..5645dcd8 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -1,10 +1,13 @@ +# This workflow will build a Swift project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift + name: Swift on: push: - branches: [ master ] + branches: [ "master" ] pull_request: - branches: [ master ] + branches: [ "master" ] jobs: build: @@ -12,8 +15,8 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Build - run: swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios13.0-simulator" -# - name: Run tests -# run: swift test -v + run: swift build -v + - name: Run tests + run: swift test -v