Convert byte array to double in Swift
问题 How can one convert an array of bytes into a double value in Swift? (It's an NSInputStream extension) My snippet attached below, but it's not returning correct double value: func readDouble() -> Double { var readBuffer = Array<UInt8>(count:sizeof(Double), repeatedValue: 0) let numberOfBytesRead = self.read(&readBuffer, maxLength: readBuffer.count) let help1 = Int(readBuffer[0] & 0xff) << 56 | Int(readBuffer[1] & 0xff) << 48 let help2 = Int(readBuffer[2] & 0xff) << 40 | Int(readBuffer[3] &