Skip to content

Commit

Permalink
Add support for SPM module resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Liquidsoul committed Nov 17, 2020
1 parent 121ec59 commit 28b6fe5
Show file tree
Hide file tree
Showing 33 changed files with 34 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ Pods

Packages
.build
.swiftpm
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0
5.3.1
25 changes: 25 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"object": {
"pins": [
{
"package": "Nimble",
"repositoryURL": "https://github.com/Quick/Nimble.git",
"state": {
"branch": null,
"revision": "7a46a5fc86cb917f69e3daf79fcb045283d8f008",
"version": "8.1.2"
}
},
{
"package": "Quick",
"repositoryURL": "https://github.com/Quick/Quick.git",
"state": {
"branch": null,
"revision": "09b3becb37cb2163919a3842a4c5fa6ec7130792",
"version": "2.2.1"
}
}
]
},
"version": 1
}
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.0
// swift-tools-version:5.3

import PackageDescription

Expand All @@ -14,7 +14,7 @@ let package = Package(

],
targets: [
.target(name: "Fakery"),
.target(name: "Fakery", resources: [.copy("Resources")]),
.testTarget(name: "FakeryTests", dependencies: ["Fakery","Quick", "Nimble"], path: "Tests/Fakery")
]
)
1 change: 1 addition & 0 deletions Resources
4 changes: 4 additions & 0 deletions Sources/Fakery/Data/Provider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ public final class Provider {
if let translationData = translations[locale] {
translation = translationData
} else {
#if SWIFT_PACKAGE
let bundle = Bundle.module
#else
let bundle = Bundle(for: Provider.self)
#endif

var path = bundle.path(forResource: locale,
ofType: Config.pathExtension,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 28b6fe5

Please sign in to comment.