Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
realh opened this issue Jun 5, 2023 · 1 comment

Comments

@realh
Copy link

realh commented Jun 5, 2023

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.

@luca992
Copy link
Owner

luca992 commented Jun 16, 2023

Honestly I'm not an expert of how swift package works. But, did you try making your own Package.swift instead of just running ./gradlew createSwiftPackage?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants