如何在Package.swift文件中向RealmSwift添加依赖项?

问题描述

我一直在为此苦苦挣扎,而且已经很接近了。 我想构建一个包含导入RealmSwift的代码的swift包。 Xcode能够解析文件并下载软件包的代码。但是我得到“对于包含它的每个文件,没有这样的模块'RealmSwift'。这是我的Package.swift文件。有人看到它有问题吗?

// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "TCA",platforms: [
        .iOS(.v14)
    ],products: [
        // Products define the executables and libraries a package produces,and make them visible to other packages.
        .library(
            name: "TCA",targets: ["TCA"]),],dependencies: [
        .package(name: "Realm",url: "https://github.com/realm/realm-cocoa",.exact("5.3.3")),targets: [
         .target(
            name: "TCA",dependencies: [
                .product(name: "RealmSwift",package: "Realm")
            ]),.testTarget(
            name: "TCATests",dependencies: ["TCA"]),]
)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)