[英]Using Swift Package Manager with Xcode
I am trying to use the following library in my XCode project 我试图在我的XCode项目中使用以下库
https://github.com/czechboy0/Socks https://github.com/czechboy0/Socks
It says to use the Swift Package Manager to use the library however I am not sure where I am supposed to put this line??? 它说使用Swift包管理器来使用库但是我不知道我应该把这行放在哪里???
.Package(url: "https://github.com/czechboy0/Socks.git", majorVersion: 0, minor: 10)
I am running mac OS 10.12 Sierra with XCode 8 beta. 我正在使用XCode 8 beta运行mac OS 10.12 Sierra。
I believe that the Swift Package Manager is supposed to come with Swift 3 and Swift 3 is supposed to be part of XCode 8 beta however I am at a loss as to how to actually use the package manager in swift. 我相信Swift Package Manager应该配备Swift 3,而Swift 3应该是XCode 8 beta的一部分,但我对如何在swift中实际使用包管理器感到茫然。 Any help would be greatly appreciated. 任何帮助将不胜感激。 I am rather new to iOS development and this issue is frustrating ... 我对iOS开发很新,这个问题令人沮丧......
If you need me to provide any additional info please ask :) 如果您需要我提供任何其他信息,请询问:)
The easiest way to use the Swift Package Manager with Xcode, assuming you have Xcode 8.0+ installed is to use the following command in the project root directory: 假设安装了Xcode 8.0+,将Swift Package Manager与Xcode一起使用的最简单方法是在项目根目录中使用以下命令:
swift package generate-xcodeproj
This will create a new Xcode Project with Sources
and Dependencies
imported into the project. 这将创建一个新的Xcode项目,其中包含导入项目的Sources
和Dependencies
。
Swift Package Manager is a tool for managing the distribution of Swift code. Swift Package Manager是一个管理Swift代码分发的工具。 It's integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. 它与Swift构建系统集成,以自动化下载,编译和链接依赖项的过程。 :swift.org says :swift.org说
To use Socks must be added to Package.swift manifest file. 要使用Socks必须添加到Package.swift清单文件中。
This is how your manifest file should look like 这就是清单文件的样子
import PackageDescription
let package = Package(
name: "DeckOfPlayingCards",
targets: [],
dependencies: [
.Package(url: "https://github.com/czechboy0/Socks.git", majorVersion: 0, minor: 10)
]
)
When swift build
command runs it will downloads all dependencies like Carthage or Cocoapodes do. 当swift build
命令运行时,它将下载所有依赖项,如Carthage或Cocoapodes。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.