Skip to content

Making a "fake" package so that I can edit my swift code in a usable editor #4

@realh

Description

@realh

I'm trying to make a dummy Swift package so that I can edit my code in VS Code or vim with coc/sourcekit_lsp etc. XCode is bad enough at the best of times, and this bug makes it barely usable. By creating a Package.swift and getting a successful build by tricking the swift compiler with some flags I should be able to get live error reporting and completion etc in VS Code. I had this working once before in an iOS-only app, but I can't get it to work with KMM.

If, in my Package.swift, I only use

  dependencies: [
    .package(path: "../GCshared/swiftpackage"),
    //...
  ],
  targets: [
    .target(
      name: packageName,
      dependencies: [
        .product(name: "GCshared", package: "swiftpackage"),
        //...
      ],
      //...
    )
  ]

I get

... error: no such module 'GCshared'
import GCshared
       ^

all over the place. I tried adding:

    .binaryTarget(
      name: "GCshared",
      path: "../GCshared/swiftpackage/GCshared.xcframework"
    )

but then I get this: error: multiple targets named 'GCshared' in: 'gcios', 'swiftpackage'; consider using the moduleAliases parameter in manifest to provide unique names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions