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测试版运行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. Any help would be greatly appreciated. I am rather new to iOS development and this issue is frustrating ...
我认为Swift包管理器应该与Swift 3一起发布,而Swift 3应该是XCode 8 beta版的一部分,但是我不知道如何在Swift中实际使用包管理器。如有任何帮助,我们将不胜感激。我对iOS开发相当陌生,这个问题令人沮丧……
If you need me to provide any additional info please ask :)
如果你需要我提供任何额外的信息,请问:)
2 个解决方案
#1
3
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包管理器的最简单方法是在项目根目录中使用以下命令:
swift package generate-xcodeproj
斯威夫特包generate-xcodeproj
This will create a new Xcode Project with Sources
and Dependencies
imported into the project.
这将创建一个新的Xcode项目,并将源代码和依赖项导入到项目中。
#2
2
Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. :swift.org says
Swift包管理器是管理Swift代码分发的工具。它与Swift构建系统集成,以自动化下载、编译和链接依赖项的过程。:swift.org说
To use Socks must be added to Package.swift manifest file.
要使用袜子,必须在包装上加上。斯威夫特清单文件。
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 buildcommand运行时,它将下载Carthage或Cocoapodes等所有依赖项。
#1
3
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包管理器的最简单方法是在项目根目录中使用以下命令:
swift package generate-xcodeproj
斯威夫特包generate-xcodeproj
This will create a new Xcode Project with Sources
and Dependencies
imported into the project.
这将创建一个新的Xcode项目,并将源代码和依赖项导入到项目中。
#2
2
Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. :swift.org says
Swift包管理器是管理Swift代码分发的工具。它与Swift构建系统集成,以自动化下载、编译和链接依赖项的过程。:swift.org说
To use Socks must be added to Package.swift manifest file.
要使用袜子,必须在包装上加上。斯威夫特清单文件。
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 buildcommand运行时,它将下载Carthage或Cocoapodes等所有依赖项。