diff --git a/COpenCombineHelpers.podspec b/COpenCombineHelpers.podspec deleted file mode 100644 index 6ec6f3b..0000000 --- a/COpenCombineHelpers.podspec +++ /dev/null @@ -1,28 +0,0 @@ -Pod::Spec.new do |spec| - spec.name = "COpenCombineHelpers" - spec.version = "0.6.0" - spec.summary = "C++ Helpers for OpenCombine" - - spec.description = <<-DESC - C++ helpers necessary for the implementation of OpenCombine - DESC - - spec.homepage = "https://github.com/broadwaylamb/OpenCombine/" - spec.license = "MIT" - - spec.authors = { "Sergej Jaskiewicz" => "jaskiewiczs@icloud.com" } - spec.source = { :git => "https://github.com/broadwaylamb/OpenCombine.git", :tag => "#{spec.version}" } - - spec.osx.deployment_target = "10.10" - spec.ios.deployment_target = "8.0" - spec.watchos.deployment_target = "2.0" - spec.tvos.deployment_target = "9.0" - - spec.header_mappings_dir = "Sources/COpenCombineHelpers/include" - spec.source_files = "Sources/COpenCombineHelpers/**/*.{cpp,h}" - spec.libraries = "c++" - - spec.pod_target_xcconfig = { - "DEFINES_MODULE" => "YES" - } -end \ No newline at end of file diff --git a/OpenCombine.podspec b/OpenCombine.podspec index f7986ca..710bead 100644 --- a/OpenCombine.podspec +++ b/OpenCombine.podspec @@ -20,6 +20,8 @@ Pod::Spec.new do |spec| spec.watchos.deployment_target = "2.0" spec.tvos.deployment_target = "9.0" - spec.source_files = "Sources/OpenCombine/**/*.swift" - spec.dependency "COpenCombineHelpers" + spec.source_files = "Sources/COpenCombineHelpers/**/*.{h,cpp}", "Sources/OpenCombine/**/*.swift" + spec.public_header_files = "Sources/COpenCombineHelpers/include/*.h" + + spec.libraries = "c++" end \ No newline at end of file diff --git a/Sources/COpenCombineHelpers/include/COpenCombineHelpers.h b/Sources/COpenCombineHelpers/include/COpenCombineHelpers.h index d16cde1..8513c68 100644 --- a/Sources/COpenCombineHelpers/include/COpenCombineHelpers.h +++ b/Sources/COpenCombineHelpers/include/COpenCombineHelpers.h @@ -30,55 +30,55 @@ extern "C" { #pragma mark - CombineIdentifier uint64_t opencombine_next_combine_identifier(void) - OPENCOMBINE_SWIFT_NAME(nextCombineIdentifier()); + OPENCOMBINE_SWIFT_NAME(__nextCombineIdentifier()); #pragma mark - OpenCombineUnfairLock /// A wrapper around an opaque pointer for type safety in Swift. typedef struct OpenCombineUnfairLock { void* _Nonnull opaque; -} OPENCOMBINE_SWIFT_NAME(UnfairLock) OpenCombineUnfairLock; +} OPENCOMBINE_SWIFT_NAME(__UnfairLock) OpenCombineUnfairLock; /// Allocates a lock object. The allocated object must be destroyed by calling /// the destroy() method. OpenCombineUnfairLock opencombine_unfair_lock_alloc(void) - OPENCOMBINE_SWIFT_NAME(UnfairLock.allocate()); + OPENCOMBINE_SWIFT_NAME(__UnfairLock.allocate()); void opencombine_unfair_lock_lock(OpenCombineUnfairLock) - OPENCOMBINE_SWIFT_NAME(UnfairLock.lock(self:)); + OPENCOMBINE_SWIFT_NAME(__UnfairLock.lock(self:)); void opencombine_unfair_lock_unlock(OpenCombineUnfairLock) - OPENCOMBINE_SWIFT_NAME(UnfairLock.unlock(self:)); + OPENCOMBINE_SWIFT_NAME(__UnfairLock.unlock(self:)); void opencombine_unfair_lock_assert_owner(OpenCombineUnfairLock mutex) - OPENCOMBINE_SWIFT_NAME(UnfairLock.assertOwner(self:)); + OPENCOMBINE_SWIFT_NAME(__UnfairLock.assertOwner(self:)); void opencombine_unfair_lock_dealloc(OpenCombineUnfairLock lock) - OPENCOMBINE_SWIFT_NAME(UnfairLock.deallocate(self:)); + OPENCOMBINE_SWIFT_NAME(__UnfairLock.deallocate(self:)); #pragma mark - OpenCombineUnfairRecursiveLock /// A wrapper around an opaque pointer for type safety in Swift. typedef struct OpenCombineUnfairRecursiveLock { void* _Nonnull opaque; -} OPENCOMBINE_SWIFT_NAME(UnfairRecursiveLock) OpenCombineUnfairRecursiveLock; +} OPENCOMBINE_SWIFT_NAME(__UnfairRecursiveLock) OpenCombineUnfairRecursiveLock; OpenCombineUnfairRecursiveLock opencombine_unfair_recursive_lock_alloc(void) - OPENCOMBINE_SWIFT_NAME(UnfairRecursiveLock.allocate()); + OPENCOMBINE_SWIFT_NAME(__UnfairRecursiveLock.allocate()); void opencombine_unfair_recursive_lock_lock(OpenCombineUnfairRecursiveLock) - OPENCOMBINE_SWIFT_NAME(UnfairRecursiveLock.lock(self:)); + OPENCOMBINE_SWIFT_NAME(__UnfairRecursiveLock.lock(self:)); void opencombine_unfair_recursive_lock_unlock(OpenCombineUnfairRecursiveLock) - OPENCOMBINE_SWIFT_NAME(UnfairRecursiveLock.unlock(self:)); + OPENCOMBINE_SWIFT_NAME(__UnfairRecursiveLock.unlock(self:)); void opencombine_unfair_recursive_lock_dealloc(OpenCombineUnfairRecursiveLock lock) - OPENCOMBINE_SWIFT_NAME(UnfairRecursiveLock.deallocate(self:)); + OPENCOMBINE_SWIFT_NAME(__UnfairRecursiveLock.deallocate(self:)); #pragma mark - Breakpoint OPENCOMBINE_ALWAYS_INLINE -inline void opencombine_stop_in_debugger(void) OPENCOMBINE_SWIFT_NAME(stopInDebugger()); +inline void opencombine_stop_in_debugger(void) OPENCOMBINE_SWIFT_NAME(__stopInDebugger()); void opencombine_stop_in_debugger(void) { raise(SIGTRAP); diff --git a/Sources/OpenCombine/CombineIdentifier.swift b/Sources/OpenCombine/CombineIdentifier.swift index e8fe535..bdede01 100644 --- a/Sources/OpenCombine/CombineIdentifier.swift +++ b/Sources/OpenCombine/CombineIdentifier.swift @@ -5,14 +5,16 @@ // Created by Sergej Jaskiewicz on 10.06.2019. // -import func COpenCombineHelpers.nextCombineIdentifier +#if canImport(COpenCombineHelpers) +import COpenCombineHelpers +#endif public struct CombineIdentifier: Hashable, CustomStringConvertible { private let value: UInt64 public init() { - value = nextCombineIdentifier() + value = __nextCombineIdentifier() } public init(_ obj: AnyObject) { diff --git a/Sources/OpenCombine/CurrentValueSubject.swift b/Sources/OpenCombine/CurrentValueSubject.swift index e3ff254..87dca6e 100644 --- a/Sources/OpenCombine/CurrentValueSubject.swift +++ b/Sources/OpenCombine/CurrentValueSubject.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 11.06.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif /// A subject that wraps a single value and publishes a new element whenever the value /// changes. diff --git a/Sources/OpenCombine/Future.swift b/Sources/OpenCombine/Future.swift index 7903509..18ee64e 100644 --- a/Sources/OpenCombine/Future.swift +++ b/Sources/OpenCombine/Future.swift @@ -5,7 +5,9 @@ // Created by Max Desiatov on 24/11/2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif /// A publisher that eventually produces one value and then finishes or fails. public final class Future: Publisher where Failure: Error { diff --git a/Sources/OpenCombine/Helpers/FilterProducer.swift b/Sources/OpenCombine/Helpers/FilterProducer.swift index 203403a..2e4d20d 100644 --- a/Sources/OpenCombine/Helpers/FilterProducer.swift +++ b/Sources/OpenCombine/Helpers/FilterProducer.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 23.10.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif /// A helper class that acts like both subscriber and subscription. /// diff --git a/Sources/OpenCombine/Helpers/Locking.swift b/Sources/OpenCombine/Helpers/Locking.swift index 0ead44a..fca1b58 100644 --- a/Sources/OpenCombine/Helpers/Locking.swift +++ b/Sources/OpenCombine/Helpers/Locking.swift @@ -5,7 +5,12 @@ // Created by Sergej Jaskiewicz on 11.06.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif + +internal typealias UnfairLock = __UnfairLock +internal typealias UnfairRecursiveLock = __UnfairRecursiveLock extension UnfairRecursiveLock { diff --git a/Sources/OpenCombine/Helpers/ReduceProducer.swift b/Sources/OpenCombine/Helpers/ReduceProducer.swift index 931cb0e..f86e728 100644 --- a/Sources/OpenCombine/Helpers/ReduceProducer.swift +++ b/Sources/OpenCombine/Helpers/ReduceProducer.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 22.09.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif /// A helper class that acts like both subscriber and subscription. /// diff --git a/Sources/OpenCombine/Helpers/SubjectSubscriber.swift b/Sources/OpenCombine/Helpers/SubjectSubscriber.swift index 53963eb..61b2054 100644 --- a/Sources/OpenCombine/Helpers/SubjectSubscriber.swift +++ b/Sources/OpenCombine/Helpers/SubjectSubscriber.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 16/09/2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif // NOTE: This class has been audited for thread safety. internal final class SubjectSubscriber diff --git a/Sources/OpenCombine/PassthroughSubject.swift b/Sources/OpenCombine/PassthroughSubject.swift index b549df3..49892e8 100644 --- a/Sources/OpenCombine/PassthroughSubject.swift +++ b/Sources/OpenCombine/PassthroughSubject.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 11.06.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif /// A subject that passes along values and completion. /// diff --git a/Sources/OpenCombine/Publishers/Publishers.Autoconnect.swift b/Sources/OpenCombine/Publishers/Publishers.Autoconnect.swift index d46a645..f60741b 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Autoconnect.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Autoconnect.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 18/09/2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension ConnectablePublisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.Breakpoint.swift b/Sources/OpenCombine/Publishers/Publishers.Breakpoint.swift index 58a20b8..afecd75 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Breakpoint.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Breakpoint.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 03.12.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { @@ -148,21 +150,21 @@ extension Publishers.Breakpoint { func receive(subscription: Subscription) { if breakpoint.receiveSubscription?(subscription) == true { - stopInDebugger() + __stopInDebugger() } downstream.receive(subscription: subscription) } func receive(_ input: Upstream.Output) -> Subscribers.Demand { if breakpoint.receiveOutput?(input) == true { - stopInDebugger() + __stopInDebugger() } return downstream.receive(input) } func receive(completion: Subscribers.Completion) { if breakpoint.receiveCompletion?(completion) == true { - stopInDebugger() + __stopInDebugger() } downstream.receive(completion: completion) } diff --git a/Sources/OpenCombine/Publishers/Publishers.Delay.swift b/Sources/OpenCombine/Publishers/Publishers.Delay.swift index e5f5254..5a6f100 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Delay.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Delay.swift @@ -5,7 +5,9 @@ // Created by Евгений Богомолов on 07/09/2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.Drop.swift b/Sources/OpenCombine/Publishers/Publishers.Drop.swift index e353527..f0db237 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Drop.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Drop.swift @@ -5,7 +5,9 @@ // Created by Sven Weidauer on 03.10.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { /// Omits the specified number of elements before republishing subsequent elements. diff --git a/Sources/OpenCombine/Publishers/Publishers.DropWhile.swift b/Sources/OpenCombine/Publishers/Publishers.DropWhile.swift index 9a35ea5..362b8c7 100644 --- a/Sources/OpenCombine/Publishers/Publishers.DropWhile.swift +++ b/Sources/OpenCombine/Publishers/Publishers.DropWhile.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 16.06.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.FlatMap.swift b/Sources/OpenCombine/Publishers/Publishers.FlatMap.swift index 32e046c..2288614 100644 --- a/Sources/OpenCombine/Publishers/Publishers.FlatMap.swift +++ b/Sources/OpenCombine/Publishers/Publishers.FlatMap.swift @@ -4,7 +4,9 @@ // Created by Eric Patey on 16.08.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { /// Transforms all elements from an upstream publisher into a new or existing diff --git a/Sources/OpenCombine/Publishers/Publishers.HandleEvents.swift b/Sources/OpenCombine/Publishers/Publishers.HandleEvents.swift index 8db42cd..29b62e9 100644 --- a/Sources/OpenCombine/Publishers/Publishers.HandleEvents.swift +++ b/Sources/OpenCombine/Publishers/Publishers.HandleEvents.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 03.12.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.IgnoreOutput.swift b/Sources/OpenCombine/Publishers/Publishers.IgnoreOutput.swift index a34b8b2..8fce777 100644 --- a/Sources/OpenCombine/Publishers/Publishers.IgnoreOutput.swift +++ b/Sources/OpenCombine/Publishers/Publishers.IgnoreOutput.swift @@ -4,7 +4,9 @@ // Created by Eric Patey on 16.08.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.Map.swift b/Sources/OpenCombine/Publishers/Publishers.Map.swift index 47f9110..e1bca80 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Map.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Map.swift @@ -5,7 +5,9 @@ // Created by Anton Nazarov on 25.06.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.MeasureInterval.swift b/Sources/OpenCombine/Publishers/Publishers.MeasureInterval.swift index db6f41e..85a958b 100644 --- a/Sources/OpenCombine/Publishers/Publishers.MeasureInterval.swift +++ b/Sources/OpenCombine/Publishers/Publishers.MeasureInterval.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 03.12.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.Multicast.swift b/Sources/OpenCombine/Publishers/Publishers.Multicast.swift index 84f84e1..c6a3197 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Multicast.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Multicast.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 14.06.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.Output.swift b/Sources/OpenCombine/Publishers/Publishers.Output.swift index 2e5c892..ba1ba94 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Output.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Output.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 24.10.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.Print.swift b/Sources/OpenCombine/Publishers/Publishers.Print.swift index 4987335..9347948 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Print.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Print.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 16.06.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.ReceiveOn.swift b/Sources/OpenCombine/Publishers/Publishers.ReceiveOn.swift index 7e236d9..8cdca56 100644 --- a/Sources/OpenCombine/Publishers/Publishers.ReceiveOn.swift +++ b/Sources/OpenCombine/Publishers/Publishers.ReceiveOn.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 02.12.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { /// Specifies the scheduler on which to receive elements from the publisher. diff --git a/Sources/OpenCombine/Publishers/Publishers.ReplaceError.swift b/Sources/OpenCombine/Publishers/Publishers.ReplaceError.swift index a38a77e..3de0b75 100644 --- a/Sources/OpenCombine/Publishers/Publishers.ReplaceError.swift +++ b/Sources/OpenCombine/Publishers/Publishers.ReplaceError.swift @@ -5,7 +5,9 @@ // Created by Bogdan Vlad on 8/29/19. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { /// Replaces any errors in the stream with the provided element. diff --git a/Sources/OpenCombine/Publishers/Publishers.Scan.swift b/Sources/OpenCombine/Publishers/Publishers.Scan.swift index 9a0cc3b..3a96a8c 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Scan.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Scan.swift @@ -4,7 +4,9 @@ // Created by Eric Patey on 26.08.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Publishers.Sequence.swift b/Sources/OpenCombine/Publishers/Publishers.Sequence.swift index c73a3b9..0036d4f 100644 --- a/Sources/OpenCombine/Publishers/Publishers.Sequence.swift +++ b/Sources/OpenCombine/Publishers/Publishers.Sequence.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 19.06.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publishers { diff --git a/Sources/OpenCombine/Publishers/Publishers.SubscribeOn.swift b/Sources/OpenCombine/Publishers/Publishers.SubscribeOn.swift index 6e63b9f..7b4f02f 100644 --- a/Sources/OpenCombine/Publishers/Publishers.SubscribeOn.swift +++ b/Sources/OpenCombine/Publishers/Publishers.SubscribeOn.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 02.12.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif extension Publisher { diff --git a/Sources/OpenCombine/Publishers/Record.swift b/Sources/OpenCombine/Publishers/Record.swift index e304e08..daa824f 100644 --- a/Sources/OpenCombine/Publishers/Record.swift +++ b/Sources/OpenCombine/Publishers/Record.swift @@ -5,7 +5,9 @@ // Created by Sergej Jaskiewicz on 12.11.2019. // +#if canImport(COpenCombineHelpers) import COpenCombineHelpers +#endif /// A publisher that allows for recording a series of inputs and a completion for later /// playback to each subscriber.