Type 'Bundle' has no member "module"

Viewed 1432

I have tried solutions in this question: Generating resource_bundle_accessor, Type 'Bundle' has no member 'module' however it still does not work.

I am trying to access a simple JSON file in my unit tests. Here is my Package.swift:

// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "MyLibrary",
    platforms: [.iOS("11.0"), .macOS(SupportedPlatform.MacOSVersion.v10_12)],
    products: [
        .library(name: "MyLibrary", targets: ["MyLibrary"])], dependencies: [],
    targets: [
        .target(name: "MyLibrary", dependencies: []), .testTarget(name: "MyLibraryTests", resources: [.process("recommendations.json"], dependencies: ["MyLibrary"]),
    ]
)
  • I am using swift-tools 5.3
  • I have added the recommendations.json to my package.swift.

I have closed and re-opened Xcode 5 times, yet still it does not create the Bundle.module extension. Here is my file structure:

enter image description here

How can I access my JSON file in my unit tests?

0 Answers
Related