Skip to content

Commit

Permalink
Bump mini supported Swift version to 5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Jan 24, 2024
1 parent d81fffe commit 40ca239
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 273 deletions.
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

0 comments on commit 40ca239

Please sign in to comment.