-
-
Save laevandus/d6a386ec565e5e6778d8edcc7d18d0d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fileURL = Bundle.main.url(forResource: "DataFile", withExtension: nil)! | |
let reader = FileReader(fileURL: fileURL) | |
if reader.open() { | |
reader.read(byteRange: 0..<20) { data in | |
if let data = data { | |
print("Read bytes: \(data.map({ UInt8($0) }))") | |
} | |
else { | |
print("Failed to read data") | |
} | |
} | |
} | |
else { | |
print("Failed to open") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment