Skip to content

Commit

Permalink
fix(): update get bundle with SPM
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Ec committed Oct 19, 2021
1 parent f617982 commit 81043ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ let package = Package(
],
resources: [
.process("Native/gherkin-languages.json")
],
swiftSettings: [
.define("SWIFT_PACKAGE")
])
]
)
6 changes: 5 additions & 1 deletion Pod/Native/Language.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ class Language {
private init() {}

private(set) var vocabulary: [String: [String: [String]]]? = {
let bundle = Bundle(for: NativeFeature.self)
var bundle = Bundle(for: NativeFeature.self)
#if SWIFT_PACKAGE
bundle = Bundle.module
#endif

guard let path = bundle.path(forResource: "gherkin-languages", ofType: ".json"),
let data = FileManager.default.contents(atPath: path),
let json = (try? JSONSerialization.jsonObject(with: data)) as? [String: [String: [String]]]
Expand Down

0 comments on commit 81043ad

Please sign in to comment.