gpt4 book ai didi

swift - 将框架/包添加到 Kitura macOS

转载 作者:行者123 更新时间:2023-11-28 10:10:36 26 4
gpt4 key购买 nike

我正在尝试按照此处所述扩充示例 Kitura 服务器端应用程序:http://www.kitura.io/en/starter/gettingstarted.html .按说明工作。然后我尝试添加 Kitura-Stencil 包 (package.swift):

let package = Package(
name: "Kitura-macOS",
dependencies: [
.package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMinor(from: "2.1.0")),
.package(url: "https://github.com/IBM-Swift/Kitura-StencilTemplateEngine.git", .upToNextMajor(from: "1.7.0")),
.
.
],
targets: [
.target(name: "Kitura-macOS", dependencies: [ .target(name: "Application"), "Kitura" , "HeliumLogger", "KituraStencil"]),
.target(name: "Application", dependencies: [ "Kitura", "CloudEnvironment","SwiftMetrics","Health", "KituraStencil"])
.
.
]
)

我添加了一些代码来使用 Stencil

import KituraStencil
.
router.add(templateEngine: StencilTemplateEngine())
.
try response.render("test.stencil", context: context2).end()

这在我从命令行构建/运行时有效:

.build/debug/Kitura-macOS
open Kitura-macOS.xcodeproj/
# (add code as described)
swift run Kitura-macOS

但是当我尝试从 XCode 中构建/运行时,它找不到 Kitura-Stencil。没有这样的模块“KituraStencil”我想我需要将它作为框架添加到构建阶段中,但无法在任何地方找到它来添加。

最佳答案

您必须在更新项目结构后重新生成 Xcode 项目,例如在添加依赖项、添加新源文件等之后。

关于swift - 将框架/包添加到 Kitura macOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48812468/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com