AVEbrahimi AVEbrahimi - 15 days ago 5
iOS Question

Swift package manger for project migrated from Swift 2

I have a Swift 2 project, now converted to Swift 3, I was using HTMLKit pod, but the problem is HTMLKit is no more on CocoaPods, but on swift package manager.

How can I add Swift Package Manager support to my existing project?
People say add dependency to package.swift but I have no such file in my project. How can I create this file?

Answer

Repositories under Swift Package Manager have certain layout. At the root of the repo you have Package.swift that provides a manifest for the repository, its name, type, dependencies, etc. You add it manually, just like any other source file.

However, before you do that please go through the documentation on SPM. It could help you to understand some specifics (like where do the dependencies end up in your repo once you check them out, how to arrange your own code so that SPM will handle it correctly, which folders to create, etc).

Comments