Skip to content

Commit

Permalink
Merge pull request #142 from square/dfed--swift-6
Browse files Browse the repository at this point in the history
Adopt Swift 6
  • Loading branch information
dfed authored Oct 30, 2024
2 parents abd41b4 + 54ff2fe commit fd14642
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 18 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
path: .build/derivedData/**/Logs/Test/*.xcresult
pod-lint:
name: Lint Pod
runs-on: macOS-14
runs-on: macOS-15
steps:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -48,10 +48,10 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.4.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Lint Podspec
run: bundle exec pod lib lint --verbose --fail-fast
spm:
run: bundle exec pod lib lint --verbose --fail-fast --swift-version=6.0
spm-5:
name: SPM Build
runs-on: macOS-14
strategy:
Expand All @@ -69,6 +69,24 @@ jobs:
run: sudo xcode-select --switch /Applications/Xcode_15.4.app/Contents/Developer
- name: Build
run: Scripts/build.swift spm ${{ matrix.platform }} `which xcpretty`
spm-6:
name: SPM Build
runs-on: macOS-16
strategy:
matrix:
platform: ['iOS_18']
fail-fast: false
steps:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.4'
- name: Checkout Repo
uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Build
run: Scripts/build.swift spm ${{ matrix.platform }} `which xcpretty`
bazel:
name: Bazel
runs-on: macOS-14
Expand Down
12 changes: 7 additions & 5 deletions 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

//
// Copyright 2020 Square Inc.
Expand Down Expand Up @@ -35,14 +35,16 @@ let package = Package(
dependencies: [],
path: "Paralayout",
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency")
.swiftLanguageMode(.v6),
]
),
.testTarget(
name: "ParalayoutTests",
dependencies: ["Paralayout"],
path: "ParalayoutTests"
path: "ParalayoutTests",
swiftSettings: [
.swiftLanguageMode(.v6),
]
),
],
swiftLanguageVersions: [.v5]
]
)
48 changes: 48 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// swift-tools-version:5.9

//
// Copyright 2020 Square Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import PackageDescription

let package = Package(
name: "Paralayout",
platforms: [
.iOS(.v13),
],
products: [
.library(
name: "Paralayout",
targets: ["Paralayout"]
),
],
targets: [
.target(
name: "Paralayout",
dependencies: [],
path: "Paralayout",
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency")
]
),
.testTarget(
name: "ParalayoutTests",
dependencies: ["Paralayout"],
path: "ParalayoutTests"
),
],
swiftLanguageVersions: [.v5]
)
3 changes: 1 addition & 2 deletions Paralayout.podspec
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
Pod::Spec.new do |s|
s.name = 'Paralayout'
s.version = '1.1.0'
s.version = '2.0.0'
s.license = 'Apache License, Version 2.0'
s.summary = 'Paralayout is a simple set of assistive UI layout utilities. Size and position your UI with pixel-perfect precision. Design will love you!'
s.homepage = 'https://github.com/square/Paralayout'
s.authors = 'Square'
s.source = { :git => 'https://github.com/square/Paralayout.git', :tag => s.version }
s.source_files = 'Paralayout/*.{swift}'
s.ios.deployment_target = '13.0'
s.swift_version = '5.9'

s.test_spec 'Tests' do |test_spec|
test_spec.source_files = 'ParalayoutTests/*{.swift}'
Expand Down
4 changes: 2 additions & 2 deletions ParalayoutTests/UIViewFrameTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ final class UIViewFrameTests: XCTestCase {
// MARK: - Private Helper Methods

@MainActor
func assertUntransformedFrameIsAccurate(for view: UIView, file: StaticString = #file, line: UInt = #line) {
func assertUntransformedFrameIsAccurate(for view: UIView, file: StaticString = #filePath, line: UInt = #line) {
let actualValue = view.untransformedFrame

let originalTransform = view.layer.transform
Expand All @@ -231,7 +231,7 @@ final class UIViewFrameTests: XCTestCase {
for point: CGPoint,
in sourceView: UIView,
convertedTo targetView: UIView,
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) throws {
let actualValue = try targetView.untransformedConvert(point, from: sourceView)
Expand Down
2 changes: 1 addition & 1 deletion ParalayoutTests/ViewDistributionBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ final class ViewDistributionBuilderTests: XCTestCase {
}
#endif

extension ViewDistributionItem: Equatable {
extension ViewDistributionItem: Swift.Equatable { // TODO: `@retroactive Equatable` once we drop Xcode 15 support.
nonisolated
public static func == (lhs: ViewDistributionItem, rhs: ViewDistributionItem) -> Bool {
switch (lhs, rhs) {
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To install Paralayout via [Swift Package Manager](https://swift.org/package-mana

```swift
dependencies: [
.package(name: "Paralayout", url: "https://github.com/square/Paralayout.git", from: "1.0.0"),
.package(name: "Paralayout", url: "https://github.com/square/Paralayout.git", from: "2.0.0"),
]
```
</details>
Expand All @@ -39,7 +39,7 @@ dependencies: [
To install Paralayout via [Bazel](https://github.com/bazelbuild/bazel), add the following to your `MODULE.bazel`:

```starlark
bazel_dep(name = "paralayout", version = "1.0.0")
bazel_dep(name = "paralayout", version = "2.0.0")
```
</details>

Expand Down
7 changes: 5 additions & 2 deletions Scripts/build.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,17 @@ enum TaskError: Error {

enum Platform: String, CustomStringConvertible {
case iOS_17
case iOS_18
case iPadOS_17

var destination: String {
switch self {
case .iOS_17:
return "platform=iOS Simulator,OS=17.5,name=iPhone 15 Pro"
"platform=iOS Simulator,OS=17.5,name=iPhone 15 Pro"
case .iOS_18:
"platform=iOS Simulator,OS=18.0,name=iPhone 16 Pro"
case .iPadOS_17:
return "platform=iOS Simulator,OS=17.5,name=iPad (10th generation)"
"platform=iOS Simulator,OS=17.5,name=iPad (10th generation)"
}
}

Expand Down

0 comments on commit fd14642

Please sign in to comment.