I have recently found a source code in swift and I am trying to get it to objective-C. The one thing I was unable to understand is this:
var theData:UInt8!
In Swift,
Data has a native init method.
// Foundation -> Data
/// Creates a new instance of a collection containing the elements of a
/// sequence.
///
/// - Parameter elements: The sequence of elements for the new collection.
/// `elements` must be finite.
@inlinable public init(_ elements: S) where S : Sequence, S.Element == UInt8
@available(swift 4.2)
@available(swift, deprecated: 5, message: "use `init(_:)` instead")
public init(bytes elements: S) where S : Sequence, S.Element == UInt8
So, the following will work.
let values: [UInt8] = [1, 2, 3, 4]
let data = Data(values)