0

I tried different ways with different configurations and cannot make it run. Here is what I tried while creating the xcframework:

  • Add 1 framework dependency as pod

  • Add 1 framework dependency as Swift package (MKRingProgressView) and created also a swift package marking the dependency in the package dependency as follows:

      name: "FirstFramework",
      platforms: [
       .iOS(.v15)
      ],
      products: [
      // Products define the executables and libraries a package produces, and make them visible to other packages.
      .library(
          name: "FirstFramework",
          targets: ["FirstFramework"]),
      ],
      dependencies: [
        .package(url: 
          "https://github.com/maxkonovalov/MKRingProgressView.git", 
           from: "2.3.0")
         ],
         targets: [
      // Targets are the basic building blocks of a package. A target can define a module or a test suite.
      // Targets can depend on other targets in this package, and on products in packages this package depends on.
      .binaryTarget(
          name: "FirstFramework",
          path: "./Sources/FirstFramework.xcframework")
       ]
    
  • Set build libraries for distribution to YES

I am always getting the error "No such module MKRingProgressView" when adding my framework to a Test project, so its not recognising the dependency of my framework.

Any ideas?

  • Did you add the `MKRingProgressView` as a dependency for your framework in the `Package.swift`? Could you share it? See https://stackoverflow.com/questions/69562987/swift-package-manager-cannot-find-a-neighboring-folder-class-in-sources/69567186#69567186 – Larme Aug 25 '22 at 09:39
  • Hi Larme, Yes you can see in the question the code, I added it as a dependency of the Swift package as well as the binary as target of the package – Tomás Moyano Aug 25 '22 at 09:42
  • But currently, I don't see why `FirsrtFramework` should use the dependency. You could have multiple binary, and each one using a different dependency, no need to use all dependency in each binary. Could you share the whole swift package (and hide some infos if needed)? – Larme Aug 25 '22 at 10:20
  • This is my whole package file, the main issue is that I cant find the way to link dependencies to my binaryTarget, will edit in the question because cannot paste it here – Tomás Moyano Aug 25 '22 at 10:47
  • 1
    I'm wondering if you don't need to add a `.target(name: "FirstFrameworkWithDependency", dependencies: ["MKRingProgressView"]),`, to let the `dependency` be done, and then refer to it later. See https://stackoverflow.com/questions/65220359/add-package-dependency-for-a-binary-target-with-swift-package-manager – Larme Aug 25 '22 at 10:54
  • I added it you as you suggested, have now two targets in products library and two targets in targets[] but now its says that it cannot run without a build destination ??? – Tomás Moyano Aug 25 '22 at 11:19
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/247557/discussion-between-tomas-moyano-and-larme). – Tomás Moyano Aug 25 '22 at 13:10

0 Answers0