我需要您的帮助才能将此 Python 脚本转换为 Swift :
startcmd = b'0s000000000000000000'
data = NSData.dataWithBytes_length_(self.startcmd, len(self.startcmd))
确实是我写的,但是我知道...我错了:
let bytes : [UInt8] = [ 0x0, 0x73, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
let data = Data(bytes:bytes)