Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump mini supported Swift version to 5.9 #21

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-12
xcode-version: "14.2" # Swift 5.7.2
- os: macos-13
xcode-version: "15.1" # Swift 5.9.2
xcode-version: "15.2" # Swift 5.9.2
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-12
xcode-version: "14.2" # Swift 5.7.2
- os: macos-13
xcode-version: "14.3.1" # Swift 5.8.1
- os: macos-13
xcode-version: "15.1" # Swift 5.9.2
xcode-version: "15.2" # Swift 5.9.2
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version:5.9

import Foundation
import PackageDescription
Expand All @@ -16,6 +16,7 @@ let supportedPlatforms: [Platform] = [
.android,
.windows,
.wasi,
.visionOS,
]

let cOpenCombineHelpersTarget: Target = .target(
Expand Down
147 changes: 0 additions & 147 deletions [email protected]

This file was deleted.

3 changes: 0 additions & 3 deletions Sources/OpenCombine/ObservableObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ private protocol _ObservableObjectProperty {
var objectWillChange: ObservableObjectPublisher? { get nonmutating set }
}

#if swift(>=5.1)
extension Published: _ObservableObjectProperty {}

extension ObservableObject where ObjectWillChangePublisher == ObservableObjectPublisher {
Expand Down Expand Up @@ -92,8 +91,6 @@ extension ObservableObject where ObjectWillChangePublisher == ObservableObjectPu
}
}

#endif

/// A publisher that publishes changes from observable objects.
public final class ObservableObjectPublisher: Publisher {

Expand Down
9 changes: 0 additions & 9 deletions Sources/OpenCombine/Published.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// Created by Евгений Богомолов on 01/09/2019.
//

#if swift(>=5.1)

extension Publisher where Failure == Never {

/// Republishes elements received from a publisher, by assigning them to a property
Expand Down Expand Up @@ -79,7 +77,6 @@ extension Publisher where Failure == Never {
/// ### See Also
///
/// - `Publisher.assign(to:)`
@available(swift, introduced: 5.1)
@propertyWrapper
public struct Published<Value> {

Expand Down Expand Up @@ -218,9 +215,3 @@ public struct Published<Value> {
// TODO: Benchmark and explore a possibility to use _modify
}
}
#else

@available(swift, introduced: 5.1)
public typealias Published = Never

#endif // swift(>=5.1)
5 changes: 0 additions & 5 deletions Sources/OpenCombineFoundation/Helpers/Portability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,7 @@ extension RunLoop.Mode {
return CFRunLoopMode(rawValue as CFString)
#else
return rawValue.withCString {
#if swift(>=5.3)
let encoding = CFStringBuiltInEncodings.UTF8.rawValue
#else
let encoding = CFStringEncoding(kCFStringEncodingUTF8)
#endif // swift(>=5.3)

return CFStringCreateWithCString(
nil,
$0,
Expand Down
4 changes: 0 additions & 4 deletions Tests/OpenCombineTests/Helpers/CommonTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,7 @@ func fromNever<T>(_ resultType: T.Type) -> (Never) -> T {
//
// The second variant compiles with all Swift versions,
// but produces a warning in Swift 5.1.
#if swift(>=5.1)
return { (_: Never) -> T in }
#else
return { switch $0 {} }
#endif
}

// swiftlint:enable generic_type_name
57 changes: 0 additions & 57 deletions Tests/OpenCombineTests/Helpers/XCTUnwrap.swift

This file was deleted.

4 changes: 0 additions & 4 deletions Tests/OpenCombineTests/ObservableObjectTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import XCTest

#if swift(>=5.1)

#if OPENCOMBINE_COMPATIBILITY_TEST
import Combine

Expand Down Expand Up @@ -420,5 +418,3 @@ private final class TestObject: ObservableObject {
nonPublished = initialValue
}
}

#endif
4 changes: 0 additions & 4 deletions Tests/OpenCombineTests/PublishedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import XCTest

#if swift(>=5.1)

#if OPENCOMBINE_COMPATIBILITY_TEST
import Combine

Expand Down Expand Up @@ -322,5 +320,3 @@ private final class TestObject: ObservableObject {
_state = Published(initialValue: initialValue)
}
}

#endif
39 changes: 0 additions & 39 deletions Tests/OpenCombineTests/PublisherTests/MapKeyPathTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ final class MapKeyPathTests: XCTestCase {
}
}

#if swift(>=5.8)
#if Xcode
func testMapKeyPathReflection() throws {
try testReflection(parentInput: Int.self,
Expand Down Expand Up @@ -191,44 +190,6 @@ final class MapKeyPathTests: XCTestCase {
{ $0.map(\.doubled, \.tripled, \.quadrupled) })
}
#endif
#else
// WASM Platform CI still use Swift 5.7
// which will get old KeyPath.description behavior
func testMapKeyPathReflection() throws {
try testReflection(parentInput: Int.self,
parentFailure: Never.self,
description: "ValueForKey",
customMirror: expectedChildren(
("keyPath", .contains("KeyPath"))
),
playgroundDescription: "ValueForKey",
subscriberIsAlsoSubscription: false,
{ $0.map(\.doubled) })

try testReflection(parentInput: Int.self,
parentFailure: Never.self,
description: "ValueForKeys",
customMirror: expectedChildren(
("keyPath0", .contains("KeyPath")),
("keyPath1", .contains("KeyPath"))
),
playgroundDescription: "ValueForKeys",
subscriberIsAlsoSubscription: false,
{ $0.map(\.doubled, \.tripled) })

try testReflection(parentInput: Int.self,
parentFailure: Never.self,
description: "ValueForKeys",
customMirror: expectedChildren(
("keyPath0", .contains("KeyPath")),
("keyPath1", .contains("KeyPath")),
("keyPath2", .contains("KeyPath"))
),
playgroundDescription: "ValueForKeys",
subscriberIsAlsoSubscription: false,
{ $0.map(\.doubled, \.tripled, \.quadrupled) })
}
#endif

func testMapKeyPathReceiveValueBeforeSubscription() {
testReceiveValueBeforeSubscription(value: 0,
Expand Down
Loading