Skip to content

Commit

Permalink
Merge pull request #7 from groue/Swift-5.9
Browse files Browse the repository at this point in the history
Swift 5.9+
  • Loading branch information
groue committed Sep 4, 2023
2 parents 35b61f8 + 981d81c commit 868bc74
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 39 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,10 @@ Release Notes

All notable changes to this project will be documented in this file.

**2023-09-04**

- Swift 5.9+

**2021-06-02**

- Expose the `AsynchronousOperation` target.
Expand Down
24 changes: 11 additions & 13 deletions Package.resolved
@@ -1,16 +1,14 @@
{
"object": {
"pins": [
{
"package": "CombineExpectations",
"repositoryURL": "https://github.com/groue/CombineExpectations.git",
"state": {
"branch": null,
"revision": "5c36f3199960776fc055196a93ca04bfc00e1857",
"version": "0.7.0"
}
"pins" : [
{
"identity" : "combineexpectations",
"kind" : "remoteSourceControl",
"location" : "https://github.com/groue/CombineExpectations.git",
"state" : {
"revision" : "04d4e4b21c9e8361925f03f64a7ecda89ef9974f",
"version" : "0.10.0"
}
]
},
"version": 1
}
],
"version" : 2
}
44 changes: 31 additions & 13 deletions Package.swift
@@ -1,15 +1,21 @@
// swift-tools-version:5.3
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let swiftSettings: [SwiftSetting] = [
// Uncomment in order to perform complete concurrency checking
// .enableExperimentalFeature("StrictConcurrency"),
.enableExperimentalFeature("ExistentialAny"),
]

let package = Package(
name: "CombineTraits",
platforms: [
.iOS("13.0"),
.macOS("10.15"),
.tvOS("13.0"),
.watchOS("6.0"),
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.watchOS(.v6),
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
Expand All @@ -18,7 +24,7 @@ let package = Package(
targets: ["AsynchronousOperation"]),
.library(
name: "CombineTraits",
targets: ["CombineTraits"]),
targets: ["CombineTraits", "AsynchronousOperation", "CancelBag"]),
.library(
name: "CancelBag",
targets: ["CancelBag"]),
Expand All @@ -33,24 +39,36 @@ let package = Package(
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "CombineTraits",
dependencies: ["AsynchronousOperation", "CancelBag"]),
dependencies: ["AsynchronousOperation", "CancelBag"],
swiftSettings: swiftSettings
),
.testTarget(
name: "CombineTraitsTests",
dependencies: ["CombineTraits", "CombineExpectations"]),
dependencies: ["CombineTraits", "AsynchronousOperation", "CancelBag", "CombineExpectations"],
swiftSettings: swiftSettings
),
.testTarget(
name: "CombineTraitsAsynchronousOperationTests",
dependencies: ["CombineTraits", "CombineExpectations"]),
dependencies: ["CombineTraits", "AsynchronousOperation", "CancelBag", "CombineExpectations"],
swiftSettings: swiftSettings
),
.testTarget(
name: "CombineTraitsCancelBagTests",
dependencies: ["CombineTraits"]),
dependencies: ["CombineTraits", "AsynchronousOperation", "CancelBag"],
swiftSettings: swiftSettings
),
.target(
name: "CancelBag",
dependencies: []),
swiftSettings: swiftSettings
),
.testTarget(
name: "CancelBagTests",
dependencies: ["CancelBag"]),
dependencies: ["CancelBag"],
swiftSettings: swiftSettings
),
.target(
name: "AsynchronousOperation",
dependencies: []),
swiftSettings: swiftSettings
),
]
)
4 changes: 2 additions & 2 deletions README.md
@@ -1,9 +1,9 @@
CombineTraits [![Swift 5.3](https://img.shields.io/badge/swift-5.3-orange.svg?style=flat)](https://developer.apple.com/swift/)
CombineTraits [![Swift 5.9](https://img.shields.io/badge/swift-5.9-orange.svg?style=flat)](https://developer.apple.com/swift/)
=============

### Combine Publishers with Guarantees

**Requirements**: iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+ • Swift 5.3+ / Xcode 12.0+
**Requirements**: iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+ • Swift 5.9+ / Xcode 15.0+

---

Expand Down
2 changes: 1 addition & 1 deletion Sources/AsynchronousOperation/AsynchronousOperation.swift
Expand Up @@ -89,7 +89,7 @@ open class AsynchronousOperation<Output, Failure: Error>: Operation {
completionBlock = { [unowned self] in
let result = self.result
assert(result != nil || self.isCancelled)
if let queue = queue {
if let queue {
queue.async {
resultHandler(result)
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/CancelBag/CancelBag.swift
Expand Up @@ -117,12 +117,12 @@ extension Publisher {
receiveCancel: { [weak cancellables] in
// Postpone cleanup in case subscription finishes
// before cancellable is set.
if let unmanagedCancellable = unmanagedCancellable {
if let unmanagedCancellable {
cancellables?.remove(unmanagedCancellable.takeUnretainedValue())
unmanagedCancellable.release()
} else {
DispatchQueue.main.async {
if let unmanagedCancellable = unmanagedCancellable {
if let unmanagedCancellable {
cancellables?.remove(unmanagedCancellable.takeUnretainedValue())
unmanagedCancellable.release()
}
Expand All @@ -134,12 +134,12 @@ extension Publisher {
receiveCompletion(completion)
// Postpone cleanup in case subscription finishes
// before cancellable is set.
if let unmanagedCancellable = unmanagedCancellable {
if let unmanagedCancellable {
cancellables?.remove(unmanagedCancellable.takeUnretainedValue())
unmanagedCancellable.release()
} else {
DispatchQueue.main.async {
if let unmanagedCancellable = unmanagedCancellable {
if let unmanagedCancellable {
cancellables?.remove(unmanagedCancellable.takeUnretainedValue())
unmanagedCancellable.release()
}
Expand Down
2 changes: 0 additions & 2 deletions Sources/CombineTraits/Exported.swift

This file was deleted.

2 changes: 1 addition & 1 deletion Sources/CombineTraits/ImmediatePublisher.swift
Expand Up @@ -275,7 +275,7 @@ extension AnyImmediatePublisher where Failure == Never {
extension AnyImmediatePublisher {
/// Creates an `AnyImmediatePublisher` which emits one value, and
/// then finishes.
public static func just(_ value: Output, failureType: Failure.Type = Self.Failure) -> Self {
public static func just(_ value: Output, failureType: Failure.Type = Self.Failure.self) -> Self {
Just(value)
.setFailureType(to: failureType)
.eraseToAnyImmediatePublisher()
Expand Down
4 changes: 2 additions & 2 deletions Sources/CombineTraits/MaybePublisher.swift
Expand Up @@ -137,7 +137,7 @@ extension MaybePublisher {
map { Optional.some($0) }
.replaceEmpty(with: nil)
.flatMap { output -> AnySinglePublisher<Output, Failure> in
if let output = output {
if let output {
return .just(output)
} else {
return .fail(error)
Expand Down Expand Up @@ -374,7 +374,7 @@ extension AnyMaybePublisher {

/// Creates an `AnyMaybePublisher` which emits one value, and
/// then finishes.
public static func just(_ value: Output, failureType: Failure.Type = Self.Failure) -> Self {
public static func just(_ value: Output, failureType: Failure.Type = Self.Failure.self) -> Self {
Just(value)
.setFailureType(to: failureType)
.eraseToAnyMaybePublisher()
Expand Down
2 changes: 1 addition & 1 deletion Sources/CombineTraits/SinglePublisher.swift
Expand Up @@ -330,7 +330,7 @@ extension AnySinglePublisher where Failure == Never {
extension AnySinglePublisher {
/// Creates an `AnySinglePublisher` which emits one value, and
/// then finishes.
public static func just(_ value: Output, failureType: Failure.Type = Self.Failure) -> Self {
public static func just(_ value: Output, failureType: Failure.Type = Self.Failure.self) -> Self {
Just(value)
.setFailureType(to: failureType)
.eraseToAnySinglePublisher()
Expand Down
@@ -1,3 +1,4 @@
import CancelBag
import Combine
import CombineTraits
import XCTest
Expand Down
@@ -1,3 +1,4 @@
import CancelBag
import Combine
import CombineTraits
import XCTest
Expand Down

0 comments on commit 868bc74

Please sign in to comment.