Adding Swift 3 packages to Xcode 8 using the Swift package manager

試著忘記壹切 提交于 2019-11-29 21:00:46

Xcode and the SPM can work together, but as far as I can tell you do need to take one step on the command line.

Put your package manifest file into the same directory as the Xcode project, and then invoke swift package generate-xcodeproj

The package manager will pull down your dependencies and rewrite the .xcodeproj file to refer to them.

It will preserve any existing source, but the directory structure will be reconfigured to SPM's preferred arrangement:

PROJECT_DIR
├── Sources
│   └── ProjectName
│       ├── YourCode.swift
│       └── YourOtherCode.swift
├── Dependencies
│   └── SomeDependency
│       ├── DependencyCode.swift
│       └── OtherDependencyCode.swift
└── Package.swift

N.B., I haven't tested this extensively on a live project; given the fact that SPM docs still say WIP, please make sure you've made a recent commit.

In addition to running swift package generate-xcodeproj, I had to build my project in Xcode before I could use the installed packages.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!