I used a project fresh from swift package init --type=library and only changed main.swift:
// main.swift
public struct SomeStruct {
public var text = "Hello, World!"
public init() { }
}
I then build the project and run Swift REPL by invoking:
swift build -c release
swift -I/path/to/proj/.build/x86_64-apple-macosx10.10/release
In REPL, I tried to create SomeStruct but failed with error.
Welcome to Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1). Type :help for assistance.
1> import SomeLibrary
2> SomeStruct()
error: Couldn't lookup symbols:
SomeLibrary.SomeStruct.init() -> SomeLibrary.SomeStruct
Thank you in advance for any help!
I'm using Swift 4.2.1 installed with Xcode on macOS 10.14.2
Then, build it. Finally, run swift -I/path/to/proj/.build/x86_64-apple-macosx10.10/release -L/path/to/proj/.build/x86_64-apple-macosx10.10/release -lpackage. (Replace "package" with whatever appears in the name: field of the .library product).