From 820ec0934d23c760b0be5d3d69e175d109ca9409 Mon Sep 17 00:00:00 2001 From: Chris Brakebill Date: Mon, 3 Oct 2022 13:12:25 -0400 Subject: [PATCH 1/3] Add primary associated types to SignalProducerConvertible & SignalProducerProtocol --- Sources/SignalProducer.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/SignalProducer.swift b/Sources/SignalProducer.swift index 6740b5e67..52fa990d9 100644 --- a/Sources/SignalProducer.swift +++ b/Sources/SignalProducer.swift @@ -539,7 +539,7 @@ extension SignalProducer where Error == Swift.Error { } /// Represents reactive primitives that can be represented by `SignalProducer`. -public protocol SignalProducerConvertible { +public protocol SignalProducerConvertible { /// The type of values being sent by `self`. associatedtype Value @@ -551,7 +551,7 @@ public protocol SignalProducerConvertible { } /// A protocol for constraining associated types to `SignalProducer`. -public protocol SignalProducerProtocol { +public protocol SignalProducerProtocol { /// The type of values being sent by `self`. associatedtype Value From a4f4f7f18c153bc872302c2022aa23bef3f275e0 Mon Sep 17 00:00:00 2001 From: Chris Brakebill Date: Wed, 5 Oct 2022 11:07:22 -0400 Subject: [PATCH 2/3] Wrap SignalProducer protocol declarations in a swift version check --- Sources/SignalProducer.swift | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Sources/SignalProducer.swift b/Sources/SignalProducer.swift index 52fa990d9..431adb83a 100644 --- a/Sources/SignalProducer.swift +++ b/Sources/SignalProducer.swift @@ -538,6 +538,7 @@ extension SignalProducer where Error == Swift.Error { } } +#if swift(>=5.7) /// Represents reactive primitives that can be represented by `SignalProducer`. public protocol SignalProducerConvertible { /// The type of values being sent by `self`. @@ -549,7 +550,21 @@ public protocol SignalProducerConvertible { /// The `SignalProducer` representation of `self`. var producer: SignalProducer { get } } +#else +/// Represents reactive primitives that can be represented by `SignalProducer`. +public protocol SignalProducerConvertible { + /// The type of values being sent by `self`. + associatedtype Value + + /// The type of error that can occur on `self`. + associatedtype Error: Swift.Error + + /// The `SignalProducer` representation of `self`. + var producer: SignalProducer { get } +} +#endif +#if swift(>=5.7) /// A protocol for constraining associated types to `SignalProducer`. public protocol SignalProducerProtocol { /// The type of values being sent by `self`. @@ -561,6 +576,19 @@ public protocol SignalProducerProtocol { /// The materialized `self`. var producer: SignalProducer { get } } +#else +/// A protocol for constraining associated types to `SignalProducer`. +public protocol SignalProducerProtocol { + /// The type of values being sent by `self`. + associatedtype Value + + /// The type of error that can occur on `self`. + associatedtype Error: Swift.Error + + /// The materialized `self`. + var producer: SignalProducer { get } +} +#endif extension SignalProducer: SignalProducerConvertible, SignalProducerProtocol { public var producer: SignalProducer { From c5018aec921cf9804544bf3d6c9831569cd098c7 Mon Sep 17 00:00:00 2001 From: Chris Brakebill Date: Sat, 12 Nov 2022 08:57:52 -0500 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7eab21ff1..b27284923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # master *Please add new entries at the top.* +1. Add primary associated types to SignalProducerConvertible & SignalProducerProtocol (#855, kudos to @braker1nine) 1. Refactor Github Actions to cover more swift versions (#858, kudos to @braker1nine) 1.Use `OSAllocatedUnfairLock` instead of `os_unfair_lock` on supported Apple platforms (#856, kudos to @mluisbrown)