Skip to content

Commit

Permalink
Wrap SignalProducer protocol declarations in a swift version check
Browse files Browse the repository at this point in the history
  • Loading branch information
braker1nine committed Nov 12, 2022
1 parent 820ec09 commit a4f4f7f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Sources/SignalProducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Value, Error> {
/// The type of values being sent by `self`.
Expand All @@ -549,7 +550,21 @@ public protocol SignalProducerConvertible<Value, Error> {
/// The `SignalProducer` representation of `self`.
var producer: SignalProducer<Value, Error> { 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<Value, Error> { get }
}
#endif

#if swift(>=5.7)
/// A protocol for constraining associated types to `SignalProducer`.
public protocol SignalProducerProtocol<Value, Error> {
/// The type of values being sent by `self`.
Expand All @@ -561,6 +576,19 @@ public protocol SignalProducerProtocol<Value, Error> {
/// The materialized `self`.
var producer: SignalProducer<Value, Error> { 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<Value, Error> { get }
}
#endif

extension SignalProducer: SignalProducerConvertible, SignalProducerProtocol {
public var producer: SignalProducer {
Expand Down

0 comments on commit a4f4f7f

Please sign in to comment.