Skip to content

Commit

Permalink
Swift 6
Browse files Browse the repository at this point in the history
  • Loading branch information
swhitty committed Aug 19, 2024
1 parent b542a92 commit c628ef3
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 30 deletions.
36 changes: 26 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ on:
workflow_dispatch:

jobs:
xcode_15_2:
xcode_16:
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 🔍 Xcode Select
run: |
XCODE_PATH=`mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode' && kMDItemVersion == '16.0'" -onlyin /Applications | head -1`
echo "DEVELOPER_DIR=$XCODE_PATH/Contents/Developer" >> $GITHUB_ENV
- name: Version
run: swift --version
- name: Build
Expand All @@ -27,10 +29,24 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage_report.lcov

xcode_14_3_1:
runs-on: macos-13
xcode_15_4:
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Version
run: swift --version
- name: Build
run: swift build --build-tests
- name: Test
run: swift test --skip-build

xcode_15_2:
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -54,9 +70,9 @@ jobs:
- name: Test
run: swift test --skip-build

linux_swift_5_9_2:
linux_swift_5_9:
runs-on: ubuntu-latest
container: swift:5.9.2
container: swift:5.9
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -67,9 +83,9 @@ jobs:
- name: Test
run: swift test --skip-build

linux_swift_5_8:
linux_swift_6_0:
runs-on: ubuntu-latest
container: swift:5.8
container: swiftlang/swift:nightly-6.0-jammy
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// swift-tools-version:5.8
// swift-tools-version:6.0
import PackageDescription

let package = Package(
name: "KeyValueCoder",
platforms: [
.macOS(.v13), .iOS(.v15)
.macOS(.v13), .iOS(.v15), .tvOS(.v15), .watchOS(.v8)
],
products: [
.library(
Expand Down Expand Up @@ -32,7 +32,7 @@ extension Array where Element == SwiftSetting {
static var upcomingFeatures: [SwiftSetting] {
[
.enableUpcomingFeature("ExistentialAny"),
.enableExperimentalFeature("StrictConcurrency")
.swiftLanguageMode(.v6)
]
}
}
38 changes: 38 additions & 0 deletions Package@swift-5.9.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// swift-tools-version:5.9
import PackageDescription

let package = Package(
name: "KeyValueCoder",
platforms: [
.macOS(.v13), .iOS(.v15), .tvOS(.v15), .watchOS(.v8)
],
products: [
.library(
name: "KeyValueCoder",
targets: ["KeyValueCoder"]
),
],
targets: [
.target(
name: "KeyValueCoder",
path: "Sources",
swiftSettings: .upcomingFeatures
),
.testTarget(
name: "KeyValueCoderTests",
dependencies: ["KeyValueCoder"],
path: "Tests",
swiftSettings: .upcomingFeatures
)
]
)

extension Array where Element == SwiftSetting {

static var upcomingFeatures: [SwiftSetting] {
[
.enableUpcomingFeature("ExistentialAny"),
.enableExperimentalFeature("StrictConcurrency")
]
}
}
14 changes: 0 additions & 14 deletions Sources/KeyValueDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,20 +213,6 @@ private extension KeyValueDecoder {
}
}

// func getDoubleValue(from value: Any, using strategy: IntDecodingStrategy) -> Double? {
// guard let double = (value as? NSNumber)?.getDoubleValue() else {
// return nil
// }
// switch strategy {
// case .exact:
// return double
// case .rounded(rule: let rule):
// return double.rounded(rule)
// case .clamping(rule: let rule):
// return double.rounded(rule)
// }
// }

func decode(_ type: Bool.Type) throws -> Bool {
try getValue()
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/KeyValueEncoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class KeyValueEncodedTests: XCTestCase {
}

func testSingleContainer_Encodes_Duration() throws {
guard #available(iOS 16.0, macOS 13.0, *) else { return }
guard #available(iOS 16.0, tvOS 16.0, watchOS 9.0, *) else { return }
XCTAssertEqual(
try KeyValueEncoder.encodeSingleValue {
try $0.encode(Duration.nanoseconds(1))
Expand Down Expand Up @@ -716,7 +716,7 @@ private struct StubEncoder: Encodable {
}
}

extension AnyCodingKey: ExpressibleByStringLiteral {
extension AnyCodingKey: Swift.ExpressibleByStringLiteral {
public init(stringLiteral value: String) {
self.init(stringValue: value)
}
Expand All @@ -737,7 +737,7 @@ struct Node: Codable, Equatable {
}
}

extension KeyValueEncoder.EncodedValue: Equatable {
extension KeyValueEncoder.EncodedValue: Swift.Equatable {

public static func ==(lhs: Self, rhs: Self) -> Bool {
do {
Expand Down

0 comments on commit c628ef3

Please sign in to comment.