In Objective-C I use the following code to
Convert an Int variable into NSData, a packet of bytes.
Int
NSData
int myScore = 0; NS
With Swift 3.x to 5.0:
var myInt = 77 var myIntData = Data(bytes: &myInt, count: MemoryLayout.size(ofValue: myInt))