Skip to content

Commit

Permalink
Merge pull request #172 from freshOS/swift_6
Browse files Browse the repository at this point in the history
Swift 6
  • Loading branch information
s4cha authored Sep 22, 2024
2 parents 090ffdd + ff8b1f1 commit 93cc468
Show file tree
Hide file tree
Showing 26 changed files with 187 additions and 171 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# 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:

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
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.9
// swift-tools-version:6.0

import PackageDescription

Expand Down
68 changes: 34 additions & 34 deletions Sources/Stevia/Stevia+Alignment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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
}
Expand All @@ -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)
}

Expand All @@ -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)
}

Expand All @@ -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)
}
Expand All @@ -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)
}

Expand All @@ -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 {
Expand All @@ -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)
Expand All @@ -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)
}

Expand All @@ -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
}
Expand All @@ -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)
}

Expand All @@ -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
}
Expand All @@ -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)
}

Expand All @@ -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
}
Expand All @@ -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)
}

Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions Sources/Stevia/Stevia+Baselines.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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, *) {
Expand Down Expand Up @@ -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, *) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Stevia/Stevia+Constraints.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 93cc468

Please sign in to comment.