# Moving From Cocoapods to Swift Package Manager | raywenderlich.com

**URL:** <https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300>\
**Category:** 🎓 Courses & Articles\
**Created:** [June 19, 2019, 5:59pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300 "2019-06-19T17:59:32Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [June 19, 2019, 5:59pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/1 "2019-06-19T17:59:32Z")

</div>

* * *
This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/3949145-moving-from-cocoapods-to-swift-package-manager](https://www.raywenderlich.com/3949145-moving-from-cocoapods-to-swift-package-manager)

---

<div class="post-metadata">

**Author:** ![lordandrei](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lordandrei/32/104772_2.png) [@lordandrei](https://forums.kodeco.com/u/lordandrei)\
**Post date:** [June 19, 2019, 8:49pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/2 "2019-06-19T20:49:11Z")

</div>

Is there a simple manner to tell if a CocoaPod is converted to work with SPM?

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [June 19, 2019, 9:13pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/3 "2019-06-19T21:13:01Z")

</div>

If the repo has a **Package.swift** manifest file then it _should_ be good to go (assuming they check it actually works etc)

---

<div class="post-metadata">

**Author:** ![ssdev](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ssdev/32/110153_2.png) [@ssdev](https://forums.kodeco.com/u/ssdev)\
**Post date:** [June 20, 2019, 7:06pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/4 "2019-06-20T19:06:17Z")

</div>

Great screencast. Clear and concise. I was just starting to creating private Cocoapods for projects yesterday. Then I saw this show up. Now going to explore SMP.

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [June 20, 2019, 7:49pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/5 "2019-06-20T19:49:53Z")

</div>

I’m glad you enjoyed it! Check out @joannis’ SPM tutorial [https://www.raywenderlich.com/1993018-an-introduction-to-swift-package-manager](https://www.raywenderlich.com/1993018-an-introduction-to-swift-package-manager)

And the next screencast will be about creating a package in Xcode!

---

<div class="post-metadata">

**Author:** ![ssdev](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ssdev/32/110153_2.png) [@ssdev](https://forums.kodeco.com/u/ssdev)\
**Post date:** [June 20, 2019, 7:53pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/6 "2019-06-20T19:53:30Z")

</div>

Perfect! I will check it out and eager for how to create my own in Xcode. Thanks again.

---

<div class="post-metadata">

**Author:** ![giguerea](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/giguerea/32/81494_2.png) [@giguerea](https://forums.kodeco.com/u/giguerea)\
**Post date:** [June 20, 2019, 10:14pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/7 "2019-06-20T22:14:43Z")

</div>

great but there is one thing I don’t understand, if you are the one hosting the dependancy on GitHub, usually you have your Cartfile and Pod files at the root level of your projects.

For SPM consumption, I know you need to have a Package.swift manifest file, but If I try to add it manually in my dynamic library it says No such module ‘PackageDescription’

thanks

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [June 21, 2019, 11:13am UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/8 "2019-06-21T11:13:18Z")

</div>

@giguerea so creating libraries that work across SPM, Cocoapods and Carthage is a little more complicated. I’ve got an example of it [here](https://www.raywenderlich.com/2401813-sharing-swift-code-between-ios-and-server-applications). Also take a look at the SPM post by @joannis [here](https://www.raywenderlich.com/1993018-an-introduction-to-swift-package-manager).

If you have any questions though feel free to ask! Where were you getting the error? Was it at build time?

---

<div class="post-metadata">

**Author:** ![wangzhizhou](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/wangzhizhou/32/109235_2.png) [@wangzhizhou](https://forums.kodeco.com/u/wangzhizhou)\
**Post date:** [June 21, 2019, 1:53pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/9 "2019-06-21T13:53:26Z")

</div>

There’s a problem I haven’t solved about SwiftPM.

If there is a package be hosted on github, then I would mirror this repo into my private git service in case sometime the github repo be removed. So, when I mirrored this package repo and all its dependicies to my own git service, the Package.swift manifest file record it’s depenticies all from github repo. Is there any solution can’t solve this problem. For Cocoapods, this can be solved by building private pod specs repo from those mirrored repos without modified their content, but for SwiftPM, maybe I should modify all Package.swift manifest files of Mirrored repos URL to adjust my own git service. If the domain of my own git services change. the process should be executed again. That’s inconvenient. Have you any solution to solve these problem?

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [June 21, 2019, 2:29pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/10 "2019-06-21T14:29:50Z")

</div>

Unfortunately that’s one of the issues that the community are currently trying to solve at the moment, but since SPM is completely decentralised the only way to solve it is fork the repo and point to the new URL. And if any of those packages have dependencies then yes you need to change all those URLs as well.

The benefits of this are of course you aren’t relying on a single directory that becomes a single point of failure or takes ages to update. For most people just sticking with the defaults will be fine. If you have a slightly different risk profile (something like a bank or using mission critical software) then you may want to mirror everything but that’s overkill for 99.99% of developers since GH is big enough for everyone. If GH were to disappear then the community could just push their packages to another provider and everyone would have to update their URLs, which would be painful but not world-ending, which is probably a good enough compromise

---

<div class="post-metadata">

**Author:** ![ssdev](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ssdev/32/110153_2.png) [@ssdev](https://forums.kodeco.com/u/ssdev)\
**Post date:** [June 21, 2019, 3:17pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/11 "2019-06-21T15:17:41Z")

</div>

Is the new SPM part of Xcode 11 compatible with Vapor projects? Currently, we use the Vapor Toolbox from the command line to recreate Xcode projects using details from Package.swift. I just have not had time yet to try that part of Xcode 11 beta.

---

<div class="post-metadata">

**Author:** ![giguerea](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/giguerea/32/81494_2.png) [@giguerea](https://forums.kodeco.com/u/giguerea)\
**Post date:** [June 21, 2019, 4:13pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/12 "2019-06-21T16:13:01Z")

</div>

I finally find a way to make it works, not sure it’s the best way or the official way to do it

let say you already have your iOS project on GitHub (in my case it’s a dynamic framework)

1. You create your package swift file manifest (Package.swift)
2. I added it at the root level of my project where my xcodeproj file is
3. At this point if you try to build in Xcode you will get an error saying No such module ‘PackageDescription’
4. Close Xcode, double click your Package.swift file from finder, that will open Xcode and you will now be able to build your project without error, also it will change your project icon for a package icon
5. I can see under git it created a hidden folder called .swiftpm

thanks

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [July 9, 2019, 9:42pm UTC](https://forums.kodeco.com/t/moving-from-cocoapods-to-swift-package-manager-raywenderlich-com/74300/13 "2019-07-09T21:42:08Z")

</div>

@giguerea Thank you for sharing your solution - much appreciated! :]
