从 swift cocoa 触摸框架导入 jwt
import jwt from swift cocoa touch framework
我正在 swift cocoa touch framework
从移动应用程序创建可重用的框架。
我的框架需要使用来自 https://github.com/vapor/jwt.git
的 jwt
项目
我尝试创建 Package.swift
然后添加 .package(url:"https://github.com/vapor/jwt.git", from: "3.0.0")
然后 运行 swift package resolve
在我的代码中,我像这样导入 jwt 库
import JWT
import Foundation
但我得到了错误 No such module 'JWT'
我是 swift 的新手,有人可以帮忙吗?
我的Package.swift在这里
// swift-tools-version:4.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "edoc-sdk-swift",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "edoc-sdk-swift",
targets: ["edoc-sdk-swift"]),
],
dependencies: [
.package(url:"https://github.com/vapor/jwt.git", from: "3.0.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 which this package depends on.
.target(
name: "edoc-sdk-swift",
dependencies: ["JWT"]),
.testTarget(
name: "edoc-sdk-swiftTests",
dependencies: ["edoc-sdk-swift"]),
]
)
你应该检查两件事:
- 模块名称是
JWT
, not jwt
。
- 检查
Package.swift
中的 .target
是否包含 dependencies
中的 "JWT"
感谢大家的反馈。
现在我可以解决这个问题了,我把解决方案写到这个博客
https://piggyman007.blogspot.com/2018/12/create-swift-framework-and-include-some.html
我正在 swift cocoa touch framework
从移动应用程序创建可重用的框架。
我的框架需要使用来自 https://github.com/vapor/jwt.git
jwt
项目
我尝试创建 Package.swift
然后添加 .package(url:"https://github.com/vapor/jwt.git", from: "3.0.0")
然后 运行 swift package resolve
在我的代码中,我像这样导入 jwt 库
import JWT
import Foundation
但我得到了错误 No such module 'JWT'
我是 swift 的新手,有人可以帮忙吗?
我的Package.swift在这里
// swift-tools-version:4.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "edoc-sdk-swift",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "edoc-sdk-swift",
targets: ["edoc-sdk-swift"]),
],
dependencies: [
.package(url:"https://github.com/vapor/jwt.git", from: "3.0.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 which this package depends on.
.target(
name: "edoc-sdk-swift",
dependencies: ["JWT"]),
.testTarget(
name: "edoc-sdk-swiftTests",
dependencies: ["edoc-sdk-swift"]),
]
)
你应该检查两件事:
- 模块名称是
JWT
, notjwt
。 - 检查
Package.swift
中的.target
是否包含dependencies
中的
"JWT"
感谢大家的反馈。
现在我可以解决这个问题了,我把解决方案写到这个博客
https://piggyman007.blogspot.com/2018/12/create-swift-framework-and-include-some.html