File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -262,10 +262,19 @@ let info2 = BookInfo.with {
262
262
}
263
263
264
264
// Serialize to binary protobuf format: you can choose to serialize into
265
- // any type conforming to SwiftProtobufContiguousBytes. For example:
265
+ // any type conforming to `SwiftProtobufContiguousBytes`. For example:
266
+ // Resolve the `SwiftProtobufContiguousBytes` return value to `Data`
266
267
let binaryData: Data = try info.serializedBytes ()
268
+ // Resolve the `SwiftProtobufContiguousBytes` return value to `[UInt8]`
267
269
let binaryDataAsBytes: [UInt8 ] = try info.serializedBytes ()
268
270
271
+ // Note that while the `serializedBytes()` spelling is generally preferred,
272
+ // you may also use `serializedData()` to get the bytes as an instance of
273
+ // `Data` where required.
274
+ // This means that the following two statements are equivalent:
275
+ // let binaryData: Data = try info.serializedBytes()
276
+ // let binaryData: Data = try info.serializedData()
277
+
269
278
// Deserialize a received Data object from `binaryData`
270
279
let decodedInfo = try BookInfo (serializedData : binaryData)
271
280
You can’t perform that action at this time.
0 commit comments