I want to read file content into a variable in swift.
The reason why
String(contentsOf:)fails is that these are binary files and String can’t cope with arbitrary binary data. To load binary data, use the
Data(contentsOf:). However, that’ll just give you a blob of bytes. How you proceed from there depends on your further goạls, but ksigiscar@cmc suggestions seem pretty relevant to me.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"