HelloPerfect

手动创建 Perfect 项目

mkdir HelloPerfect
cd HelloPerfect
swift package init --type executable
swift package generate-xcodeproj

编辑Package.swift添加依赖库

import PackageDescription

let package = Package(
    name: "HelloPerfect",
    dependencies: [
        .package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", from: "3.0.0"),
        .package(url: "https://github.com/PerfectlySoft/Perfect-RequestLogger.git", from: "3.0.0"),
        .package(url: "https://github.com/PerfectlySoft/Perfect-Logger.git", from: "3.0.0"),
        .package(url: "https://github.com/PerfectlySoft/Perfect-MySQL.git", from: "3.0.0")
    ],
    targets: [
        .target(
            name: "HelloPerfect",
            dependencies: ["PerfectHTTPServer", "PerfectMySQL", "PerfectLogger", "PerfectRequestLogger"]),
    ]
)

获取依赖

swift package update

重新生成 Xcode 项目

swift package generate-xcodeproj

就可以用 Xcode 运行了

你可能感兴趣的:(HelloPerfect)