Hi Swift Community,
I'm Toshihiro Suzuki and have a question about Swift Package Manager.
I'm trying out with new Xcode9-beta.
When I generate a new xcodeproj like this, `Resources` directory is
imported as a folder reference in xcodeproj.
$ swift -version Apple Swift version 4.0 (swiftlang-900.0.43 clang-900.0.22.8) Target: x86_64-apple-macosx10.9 $ swift package init --type library $ mkdir -p Resources/Fixtures/ $ touch Resources/Fixtures/test.txt $ swift package generate-xcodeproj
When I open the xcodeproj and hit Cmd+U, I want to access test.txt with
code like this.
let path = Bundle(for: Swift4sampleTests.self).path(forResource: "test.txt", ofType: nil)! let data = Data(contentsOf: URL(string: path)!)
To make it work, I need to manually
- add Resources/ as a group, instead of folder reference.
- add "Copy Files Phase" in Build Phase to copy test.txt as "Resources".
Can SwiftPM handle this use-case automatically?
Or is there a way to access test resources from generated xcodeproj test