【问题标题】:How to install Vapor 2 for Xcode 8.2.1 with Swift 3.1如何使用 Swift 3.1 为 Xcode 8.2.1 安装 Vapor 2
【发布时间】:2018-08-10 21:02:18
【问题描述】:

我要做什么

我正在按照在 macOS 上安装 Vapor 的指南https://docs.vapor.codes/2.0/getting-started/install-on-macos/

验证 Swift 安装

eval "$(curl -sL check.vapor.sh)"

支持 Vapor v 2

添加 Homebrew Tap

brew tap vapor/homebrew-tap
brew update
brew install vapor

Vapor Toolbox: 3.1.4 已安装

我的信息:

iMac(24 英寸,2009 年初)

OS X El Capitan - 版本 10.11.6

Xcode 版本 8.2.1 (8C1002)

工具链:Swift 3.1 发布 2017-03-27 (a)

https://swift.org/builds/swift-3.1-release/xcode/swift-3.1-RELEASE/swift-3.1-RELEASE-osx.pkg

** 更新 **

我克隆了两个存储库 https://github.com/vapor/api-template (b6c7df2) 和 https://github.com/vapor/web-template (d206163)

现在我可以使用 Swift 3.1 项目创建一个 Vapor v2,如下所示:

API 模板

vapor new ApiTemplate --template=https://github.com/ValeriyKliuk/vapor-2-api-template
cd ApiTemplate/
vapor xcode -y

网页模板

vapor new WebTemplate --template=https://github.com/ValeriyKliuk/vapor-2-web-template
cd WebTemplate/
vapor xcode -y

【问题讨论】:

    标签: swift3 vapor xcode8.2


    【解决方案1】:

    工具箱和框架是有区别的。工具箱是运行各种命令的 CLI 工具,框架是您实际构建的对象。如果你这样做 vapor new MyProject 将创建一个 Vapor 2 项目

    (注意 - 我很确定 Vapor 2 需要 Swift 3.1)

    【讨论】:

    • 是的,我已经安装了Vapor Toolbox: 3.1.4。但是当我从docs.vapor.codes/2.0/getting-started/hello-world 执行vapor new Hello --template=api 时,它会在// swift-tools-version:4.0 语法中创建Package.swift。为什么? :)
    • 啊因为当前模板是用 Swift 4 构建的
    • docs.vapor.codes/2.0/getting-started/hello-world 下提到This section assumes you have installed Swift 3.1 and the Vapor Toolbox and have verified they are working. 如何对CLI 说我想使用Vapor v2Swift 3.1? ;)
    猜你喜欢
    • 2016-12-13
    • 1970-01-01
    • 2017-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-21
    相关资源
    最近更新 更多