Skip to content
Snippets Groups Projects
Commit 75cd8a63 authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Add NewBroadcastChannel functor

parent 265dd403
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!18Update Bindings
import Bindings
import XCTestDynamicOverlay
public struct NewBroadcastChannel {
public var run: (Int, ChannelDef) throws -> Channel
public func callAsFunction(
cmixId: Int,
channelDef: ChannelDef
) throws -> Channel {
try run(cmixId, channelDef)
}
}
extension NewBroadcastChannel {
public static let live = NewBroadcastChannel { cmixId, channelDef in
var error: NSError?
let bindingsChannel = BindingsNewBroadcastChannel(
cmixId,
try channelDef.encode(),
&error
)
if let error = error {
throw error
}
guard let bindingsChannel = bindingsChannel else {
fatalError("BindingsNewBroadcastChannel returned `nil` without providing error")
}
return .live(bindingsChannel)
}
}
extension NewBroadcastChannel {
public static let unimplemented = NewBroadcastChannel(
run: XCTUnimplemented("\(Self.self)")
)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment