In this tutorial, youâll learn how to create a CocoaPod containing your Swift code, assets, and storyboard files. Youâll also learn all about Podspec files.
Very nice tutorial, Thanks. However why do not use dynamic libraries. Is it because it is technically not possible or is it your choice? Also, can we use one git repo only instead of two?
Hey @idevelopper, Iâm glad you liked it! You can use dynamic libraries with CocoaPods, itâs always been the standard way to use CocoaPods, with the ability to use static libraries only introduced in CocoaPods 1.5.0. Dynamic frameworks come with a launch-time performance impact that some apps need to avoid, but besides that, you can use them if you wish. See the âUsing Swift Static Librariesâ section of this tutorial.
As for using one git repo instead of two: itâs entirely possible, although it might get messy, and eliminates the point of using CocoaPods to help us separate out our dependencies! However, your individual needs may vary and you should use whatâs best for your project.
Thanks for super fast response while the keynote will start! With dynamic libraries the starter time is faster, right? Why some applications needs to avoid this?
EDIT: Sorry but am I confusing Dynamic Library vs Dynamic Framework?
Sorry that this reply is a bit later @idevelopper! I think you are confusing them. The distinction is between static vs. dynamic, and static is faster at startup.
There appear to be some issues with the finished project, under the latest Xcode 10.1, using âthe new build systemâ. Youâll notice a warning about duplicated output files (Assets.car), and during runtime, the âbackgroundâ image doesnât load (Could not load the "background" image referenced from a nib in the bundle with identifier).
Thanks for the tutorial. I tried to follow it until the point from Setting Up Podspec. I am not sure what youâre saying in reference to the private repo. Do you mean it needs to be a private hosted repo on Github or Bitbucket? Or is it just private because itâs located locally on your Mac instead of being hosted?
To add to the confusion with the podspecs, Iâm seeing some conflicting or omitted information compared to the cocoapods guides on creating a podfile, in that thereâs no mention of pod lib. For this reason this left me confused about what the goal is with this tutorial (I just want to create a public pod library that anyone can use), and for that reason I decided to abandon it and use the cocoapods guide insteadâŠwhich is probably what I shouldâve done originally, but I tend to default to RW first for things I havenât done before.
You might want to explain the goal of what youâre trying to do more, and look into the conflicting information in the guide.
Hi @post, there is no mention of a private repo, only a private Podspec :]. This is any Podspec that is not published in the CocoaPods public Specs repo.
As for pod lib, that could refer to one of two commands:
pod lib create, which bootstraps the Pod creation process
pod lib lint, which verifies the setup of your Pod
Both arenât strictly needed in the creation of a Pod, and are described CocoaPods Guides which are linked to in the Where to Go From Here? section of this post.
I hope that clears things up for you? Let me know if thereâs anything else!
@y2kdar discovered an issue with the finished project using Xcode 10.1. During runtime, the âbackgroundâ image doesnât load. The following warning appears in the Console:
Could not load the "background" image referenced from a nib in the bundle with identifier
This is believed to be caused by CocoaPods, and may be a problem until CocoaPods releases an update with a fix. In the meantime, you can fix this by using the Legacy Build System. In the Xcode menu, select File / Workspace Settings. For Build System, select âLegacy Build Systemâ.
@keeganrush I noticed a workaround for you that works. If you remove Images.xcassets from the âCopy Bundle Resourcesâ phase, then the warning about Assets.car goes away, and the background image starts working again.
Hi, Iâm having an issue with the pod repo push command ; when I run it, I get the following error :
[!] /usr/bin/git -C /Users/ericlemaitre/.cocoapods/repos/mzvPodSpecs pull
Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.
And when I run pod repo list, my Podspecs repo has an âunknownâ git instead of âmasterââŠ
@ericlm, it seems that the problem is because your mzvPodSpecs repo is empty. The latest version of CocoaPods appears to require you to have a commit in your podspecs repo before you can run pod repo push. You should see something like this in your repository:
Please click the README link in your repository, as seen in the above image, to add a new commit with a README file. After your repository has a commit in it, you should be able to pod repo push to your heartâs content :]