[swift-users] How to define interdependent modules in a package?

David Turnbull dturnbull at gmail.com
Tue Dec 22 11:35:47 CST 2015


Is this in your package file?
targets: [
    Target(
        name: "Foo",
        dependencies: [.Target(name: "Bar")]),
    Target(
        name: "Bar")
]

-david

On Tue, Dec 22, 2015 at 3:02 AM, Tarun Joshi via swift-users <
swift-users at swift.org> wrote:

> Hi,
> I was following the github documentation to create multiple modules (
> https://github.com/apple/swift-package-manager/blob/master/Documentation/SourceLayouts.md )
> in a package.
>
> My package directory looks like this:
> SwiftTest/Package.swift
> SwiftTest/Sources/Bar/bar.swift
> SwiftTest/Sources/Foo/foo.swift
>
> bar.swift :
>   public func bar() {
>     print("bar")
>   }
>
> foo.swift :
>   import Bar
>   public func foo() {
>     bar()
>   }
>
> Compiling this produces an error saying : foo.swift: error: no such module
> 'Bar'
> When I remove dependency of 'Bar' module from foo.swift (by removing
> import statement and call to 'bar'), it compiles fine.
> Am I missing something here? Can't I use imports directly?
>
> --
> Regards,
> `Tarun`
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151222/d1ebe87a/attachment.html>


More information about the swift-users mailing list