Context: Xcode Version 11.0 beta 2/Swift 5
I want to create a bundle to access on a physical iOS device. I tried all the solutions on How to make an iOS asset bundle?, but to no avail.
I have created a bundle in finder containing the file and subsequently moved to Xcode such that my directory structure looks like this:
- *Project Name*
- *Project Name*Tests
- Products
- somebundle.bundle
- somefile.csv
I keep getting the error
the file "somefile.csv" couldn't be opened because there is no such file
when testing.
I am accessing the file through let text = try String(contentsOfFile: Bundle.main.resourcePath! + "/somebundle.bundle/somefile.csv")
But actually, printing the contents of Bundle.main.resourcePath (FileManager.default.contentsOfDirectory(atPath: Bundle.main.resourcePath!)
) shows that the bundle is not located in Bundle.main.resourcePath, as this is the output:
["_CodeSignature", "PlugIns", "Base.lproj", "*Project Name*", "Frameworks", "Info.plist", "PkgInfo"]
So, how do I get the bundle into Bundle.main.resourcePath, as the answers to the question at the top seem to suggest should be the case?