swift-package-manager

How to resolve Swift Package Manager target overlapping sources error

落花浮王杯 提交于 2020-08-09 06:58:25
问题 I have a GitHub repo that is an Objective-C project that defines multiple targets (one per each targeted OS: macOS, iOS, tvOS, etc.). These targets share most of the source code files of the project. I am trying to add SPM support to the project and in the Package.swift file I define matching targets with source path referring to the same folder containing those source code files shared across the targets. When I add this SPM-"enabled" project/package to a test project that is trying to use

How to resolve Swift Package Manager target overlapping sources error

萝らか妹 提交于 2020-08-09 06:58:19
问题 I have a GitHub repo that is an Objective-C project that defines multiple targets (one per each targeted OS: macOS, iOS, tvOS, etc.). These targets share most of the source code files of the project. I am trying to add SPM support to the project and in the Package.swift file I define matching targets with source path referring to the same folder containing those source code files shared across the targets. When I add this SPM-"enabled" project/package to a test project that is trying to use

Swift Package Manager: Exclude from Release

流过昼夜 提交于 2020-08-06 05:01:29
问题 Let's say that I only wanted to link https://github.com/pmusolino/Wormholy to my iOS app on non-RELEASE configurations using SPM. Is there a way to do this? 回答1: Make Link optional Update the EXCLUDED_SOURCE_FILE_NAMES for Release to exclude the framework, e.g. Wormholy* 来源: https://stackoverflow.com/questions/62837730/swift-package-manager-exclude-from-release

How to use Swift Package Manager in Playground

六月ゝ 毕业季﹏ 提交于 2020-08-01 09:29:12
问题 Is it possible to use Swift Package Manager inside Xcode Playground ? 回答1: It is not possible to use the Swift Package Manager in a playground at this time. The reason for that is that the Swift Package Manager is primarily used outside of apple platforms. Apple mentions this on the Swift Package Manager's GitHub: Note that at this time the Package Manager has no support for iOS, watchOS, or tvOS platforms The Swift Package Manager is especially useful for writing Swift for platforms such as

How to delete Swift Package Dependency in Xcode 11?

微笑、不失礼 提交于 2020-07-17 09:19:04
问题 I have a project in Xcode 11 that I added Swift Package Manager dependencies to. I now realized that I no longer need one of the package dependencies I previously added to my project. As you can see below, there are no options under File > Swift Packages for deleting a packager from Swift Package Manager for this project. I have tried removing the package from the array in the project.xcworkspace/xcshareddata/swiftpm/Package.resolved file. But it still doesn't remove it from Xcode, and the

Can I make a local module with the Swift Package manager?

那年仲夏 提交于 2020-07-04 10:45:30
问题 I know the Swift package manager can compile code from github as a module for my project, but can I tell the package manager to compile code that is stored locally on my computer instead? The idea is I have some code that I want to separate off from the rest of my project, so I keep it in a folder and the Swift compiler will build it so that that code can be imported like any other module. 回答1: You can reference a local directory in your Package.swift file, but it must be a Git repository.

Run SwiftUI preview from SPM Package

这一生的挚爱 提交于 2020-07-02 18:12:40
问题 I am developing a package of Swift Package Manager where SwiftUI views need to be included. Every SwiftUI view should have a preview. However, when I try to run a preview of any view I get the following error: I found a way where if I change the package scheme to the main target scheme it becomes work. But using this way I have to switch between schemes all the time and the main target needs to be built every time I want to run a preview of a package. Is it possible to run SwiftUI preview

Swift Package Manager C-interop: Non-system libraries

久未见 提交于 2020-05-09 19:55:44
问题 How can I use the Swift Package Manager to include C code (in my case, a single .c file and a header file) without requiring the user to install my C library into /usr/local/lib ? I had thought to create a Package in a subdirectory of my main package containing the header + lib, and use relative paths, and finally build with swift build -Xlinker ./relative/path/to/mylib , however I'm not having any success resolving the dependency since it's expected to be a standalone git repository. Error

Add dependency on a local swift package in Xcode 11

≯℡__Kan透↙ 提交于 2020-03-18 09:08:09
问题 I am trying to add a dependency on a local swift package in my Xcode project. (I don't want to add a dependency using a file url file://me/dev/app/package as this cannot be shared to other environments) I tried to drag & drop the package to the target. This creates a references to the package in the project that I was able to add in the "Link Binary With Libraries" build phase, but the library is still not found. No such module 'Analytics' My original configuration After drag & drop and here

Swift Package Manager dynamic library

萝らか妹 提交于 2020-02-21 13:11:05
问题 I've recently converted a bunch of my frameworks to use Swift Package Manager. My Package.swift looks something like this: // swift-tools-version:5.1 import PackageDescription let package = Package( name: "MDFToolbox", platforms: [ .macOS(.v10_13), .iOS(.v12), .tvOS(.v12), .watchOS(.v3) ], products: [ .library(name: "MDFToolbox", targets: ["MDFToolbox"]) ], dependencies: [ .package(url: "git@github.com:Swinject/Swinject.git", from: "2.7.0"), ], targets: [ .target(name: "MDFToolbox",