Swift Package Manager Library with multiple files
I have and Swift Package Manager Executable project that also includes a library. Inside that library I want to have multiple files that all combine into one library.
// swift-tools-version:5.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "sandbox", products: [ .library(name: "library", targets: ["library"]), .executable(name: "sandbox", targets: ["sandbox"]), ], dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), .package(url: "https://github.com/apple/swift-package-manager.git", from: "0.4.0"), .package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.2.0"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "library", dependencies: ["SwiftSoup",]), .target( name: "sandbox", dependencies: ["library", "SPMUtility"]), .testTarget( name: "sandboxTests", dependencies: ["sandbox"]), ] )
Sources --sandbox |--main.swift --library |--library.swift |--class1.swift |--class2.swift
I can call methods from the library.swift in main.swift but I cant call methods from class1.swift and class2.swift in main.swift.
What do I have to do to get this working properly? I would like to keep the files split up for organization purposes instead of putting all the code inside library.swift.