Swift-Atem
Swift-Atem copied to clipboard
Missing public initializer for `Message.Title`
The public struct MessageTitle (renamed Message.Title on master) does not expose its init method publicly, preventing the developer to create new Atem Messages.
For example, here's the implementation of a VideoOutput command, driving the Atems video output.
public struct VideoOutput: Serializable {
public enum Output {
case in1
case in2
case in3
case in4
case multiview
case program
case preview
}
let output: Output
public static var title = MessageTitle(string: "CAuS")
public init(with bytes: ArraySlice<UInt8>) throws {
throw AtemMessageError.notImplemented
}
public init(output: Output) {
self.output = output
}
public var dataBytes: [UInt8] {
return switch output {
case .in1: [1, 0, 0, 1]
case .in2: [1, 0, 0, 2]
case .in3: [1, 0, 0, 3]
case .in4: [1, 0, 0, 4]
case .multiview: [1, 0, 35, 41]
case .program: [1, 0, 39, 26]
case .preview: [1, 0, 39, 27]
}
}
public var debugDescription: String {
return "Video output set to \(output)"
}
}
Without the public MessageTitle init, the compiler produces the following error:
'MessageTitle' initializer is inaccessible due to 'internal' protection level
Adding a public MessageTitle initializer would make this possible.