Roadmap of SwiftPM Integration into Xcode

It's both. The biggest hole so far has been resources. SPM didn't have a way to define them for applications/libraries/tests. You can't create many interesting GUI applications without images (e.g. no application icon).

We just got bundle support for Linux. A proposal for SPM resources is apparently being worked on, and will be coming in the fall. That means it will finally become practical to define and build GUI applications using SwiftPM.

The Xcode team's goal is to improve the developer experience on- and for Apple platforms. I'm sure they would love to implement native integration with Swift's official package manager. It's not going to stop people editing, building or debugging their applications in Xcode. I find it surprising that anybody would suggest they might have some kind of pathological hatred of SwiftPM.

3 Likes

Support for SPM is about to land in CLion (from 2018.3).

3 Likes

And already available free of charge (albeit for limited time) in the EAP.

And entirely free of charge for higher education :wink:

1 Like

I noticed that there is an Eclipse-based IDE for the Swift programming language. Has anybody used it yet?

Eclipse-based IDE for the Swift programming language

Has anybody used it?

Xcode integration finally landed :tada:
Resources are still not supported, so let‘s hope this will be implemented soon.

7 Likes

I'm new to SwiftPM and first trying it in Xcode 11's new Swift Packages feature and was hoping to be able to make edits to the package which there isn't a menu options for, so in trying "swift package edit MyLibrary --branch bugFix" fails without a manifest, doesn't appear to be a Package.swift instead there is JSON at project.xcworkspace/xcshareddata/swiftpm/Package.resolved looking similar to a package.swift. The actual checkout is in the DerivedData again no Package.swift there either, there is a manifest.db however:

DerivedData/MyApp/xxx/SourcePackages/
checkouts/
dependencies-state.json/
manifest.db
ManifestLoading
repositories

Does anyone know how to run swift package commands for a Xcode 11 project?

The "Development" section of the forums is used for development of Swift, not development using Swift.

For help with using Swift, you can try the "Using Swift" section of the forums, and for help with Apple developer tools, the Apple developer forums.

Hi there,

I was at the WWDC and was happy that Swift Packages are now integrated on XCode. I did have some conversations at the packages lab, regarding resources support and he told me to better write directly here. So, my module now has a CoreML model which I usually ship it as a resource (in cocoapods and carthage). Since the file itself it's the CoreML model, as well as a wrapper for the type safe class and functions in swift, I was wondering if this will also work with the current bundle/ressource approach? The swift wrapper in every .mlmodel generates a class class MyModel { } and instantiates the model inside as

let bundle = Bundle(for: MyModel.self)

I was wondering if this autogenerated wrappers will still be available in XCode (they are generated at build time) or if the current resource approach will practically just copy the file and we will have to instantiate it "manually"? It would be nice to sill have a nice and tight XCode integration of CoreML models in Swift Packages so these autogenerated wrappers still work.

Is this the right place to discuss this? or if there are other threads I should take a look into, please let me know, this is my first post... :grimacing:

1 Like

I think that's a better fit for the resources conversation, since that's what's missing for that kind of support to happen.

2 Likes

Hello. I tried new Xcode that's a bomb. But I have a problem in some situation. I have a package with products.

products: [
    .library(name: "Vecors", targets: ["Vecors"]),
],
targets: [
    .target(
        name: "Vectors",
        dependencies: [...]),
    .target(
        name: "States",
        dependencies: [...]),
...

Then I installed that package in iOS project in Xcode. And the module Vectors appeared in the project. Thеn I change the product in the package to

products: [
    .library(name: "States", targets: ["States"]),
],
...

Then I update package in the Xcode project. But Xcode dose not see the new module States.

The .target(...) declarations are the modules. A .library(...) is a group of modules which can be used as a dependency by another package.

The way your first example is written, you had a Vectors library containing only the Vectors module. The States module was not formally accessible from outside the package. (Such modules are similar to internal declarations in source code, but at the package level.)

After your change, you have a States library containing only the States module. The Vectors module is internal to the package.

What you want is one of these two:

products: [
    .library(name: "Vecors", targets: ["Vecors"]),
    .library(name: "States", targets: ["States"])
],
products: [
    .library(name: "Vectors & States", targets: ["Vecors", "States"])
],

With the first option, client packages can use one or the other or both.

With the second option, client packages have to depend on both whether they actually use both or not. This can simplify the declarations in your Package.swift and the client’s Package.swift, but it also may mean some modules end up being built for no reason.

1 Like

Xcode 11 has SwiftPM integration, but how to use the mirror feature of SwiftPM?