Swift Reading Binary Data

[Solved] Swift Reading Binary Data | Swift - Code Explorer | yomemimo.com
Question : swift reading binary data

Answered by : combative-cheetah-7ja5gd7pp49o

func getFile(forResource resource: String, withExtension fileExt: String?) -> [UInt8]? { // See if the file exists. guard let fileUrl: URL = Bundle.main.url(forResource: resource, withExtension: fileExt) else { return nil } do { // Get the raw data from the file. let rawData: Data = try Data(contentsOf: fileUrl) // Return the raw data as an array of bytes. return [UInt8](rawData) } catch { // Couldn't read the file. return nil }
}

Source : https://stackoverflow.com/questions/59036569/read-integers-from-binary-file-in-swift | Last Update : Sat, 12 Jun 21

Answers related to swift reading binary data

Code Explorer Popular Question For Swift