From 3442d3d046800f1974bda096faaf0ac510b21154 Mon Sep 17 00:00:00 2001 From: gsl-anthonymerle Date: Tue, 25 Jun 2024 17:11:33 +0200 Subject: [PATCH] Fix AsyncSubject's Failure type conflincting with Apple addition to AsyncSequence starting from Xcode 16 (iOS 18, MacOS 15, Vision OS 2, etc.) --- Sources/AsyncSubjects/AsyncSubject.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Sources/AsyncSubjects/AsyncSubject.swift b/Sources/AsyncSubjects/AsyncSubject.swift index 3511b29..8ba56ce 100644 --- a/Sources/AsyncSubjects/AsyncSubject.swift +++ b/Sources/AsyncSubjects/AsyncSubject.swift @@ -6,12 +6,17 @@ // #if swift(>=5.7) -public protocol AsyncSubject: AnyObject, AsyncSequence, Sendable where AsyncIterator: AsyncSubjectIterator { - associatedtype Failure: Error +public protocol AsyncSubjectable: AnyObject, AsyncSequence, Sendable where AsyncIterator: AsyncSubjectIterator { + func send(_ element: Element) +} - func send(_ element: Element) - func send(_ termination: Termination) +public protocol AsyncSubjectTerminable { + associatedtype Failure: Error + + func send(_ termination: Termination) } + +public typealias AsyncSubject = AsyncSubjectable & AsyncSubjectTerminable #else public protocol AsyncSubject: AnyObject, AsyncSequence, Sendable where AsyncIterator: AsyncSubjectIterator { associatedtype Failure: Error