I have a txt file that loads fine in the client app using:
let fileURLProject = Bundle.main.path(forResource: filename, ofType: "txt")
do {
let data = try String(contentsOfFile: fileURLProject!, encoding: String.Encoding.utf8)
} catch (etc..)
But when adding the same file to the server target (SwiftWebSocketServer in the same Xcode project workspace), the do statement breaks. I tried many solutions including:
Bundle.main.path(forResource... always returns nil when looking for xml file
But thinking has to do with adding it to Target --> Build Phases --> ? .. Tried adding it to the compile source (doesn't work out), moving the file to root, into folders (groups and references), thinking it has something to do with adding to Target --> Build Phases --> 'copy files', but not sure of the destination/path etc.
Any advice would be appreciated.