Skip to content

How to create a new Cocoapod?

husnjak edited this page Sep 23, 2020 · 4 revisions

IMPORTANT

This Wiki is not for the PUBLIC, more for my self to "remember" how to update this projects cocoapods

How to?

I created this cocoapod by following these steps!

  1. Create a new project in Xcode, i used a single view application as it makes it easier to test.
  2. Build your Framework and write TESTS!
  3. Create the Github repo
  4. Now we create the Cocoapods library! I followed this tutorial, run this command:
$ pod lib create MyLibrary

this creates the basic library template which we will use!
5. Edit your Podspec metadata, I skip the README as i'm gonna write one on Github..

  • Add Your project name
  • Add the first verison number '0.1.0'
  • Add a summary
  • Add a description
  • Change the hompage to Github
  • Change the source to Github Clone source
  • Add swift version s.swift_version = 4.0 otherwise the linter will bitch about it.
  • Add source files location MyLibrary/Classes/**/*
  • Add your Optional dependencies, you can stack them! s.dependency 'podName', ~> 1.0'
  1. Copy your Framework classes to MyLibrary/Classes folder
  2. Upload your work to Github & create the initial release version 0.1.0! IMPORTANT otherwise the lint will fail
  3. Done. Start lint..
$ pod spec lint
$ pod lib lint
  1. If everything passes create a new Xcode project and download you new project
# This usually works
pod 'MyLibrary', git: "https://github.com/husnjak/MyLibrary.git"

test it so you can find all of those internal classes that should be public...
10. Done, tell the world!

Clone this wiki locally