Creating Your First Pod With Github
Creating Your First Pod With Github
Open Repo
- Create new repo (My advice first add pods on a temporary repo before adding to your original project)
- Fill Repository name with your repo name. I’ll use “myrepo” for this tutorial and will use ”<” and ”>” symbols for the parts you should change to your own.
- Click “Initialize this repository with a README”
- Add a license. I’ll use “MIT” for this tutorial.
Pull Your Repo to Local
- Open Terminal.
- Go where your repo is
cd </your/path/<myrepo>or create it withcd </your/path>.mkdir <myrepo>.cd <myrepo> - Add git to your folder with
git init - Link your repo with
git remote add origin https://github.com/<username>/<myrepo>.git. (You can check if its working withgit remote -v(Not git remove -v)) - Pull your repo from github with
git pull - Type: git pull origin master
- Type git commit
Add Cocoapods
- Install cocoapods:
sudo gem install cocoapods. Writepod --helpto check if it’s working. (Skip if you already have cocoapods) - Create
<myrepo>.podspecwithtouch <myrepo>.podspec - Open
<myrepo>.podspecwith an editor. Use Xcode or Sublime Text. - Paste the following. You can checkout this example. For details check the documentation
Pod::Spec.new do |s|
s.name = "<myrepo>"
s.version = "0.1"
s.summary = "<My summary>"
s.description = "<MUST BE LONGER THAN SUMMARY>"
s.homepage = "https://github.com/<username>/<myrepo>"
s.license = 'MIT'
s.author = { "<username>" => "<useremail>" }
s.source = { :git => "https://github.com/<username>/<myrepo>.git", :tag => s.version.to_s }
s.platform = :ios, '8.0'
s.requires_arc = true
# If more than one source file: https://guides.cocoapods.org/syntax/podspec.html#source_files
s.source_files = '<myrepo>.swift'
end- Write
pod lib lint <myrepo>.podspecto the terminal. If you have any errors writepod lib lint <myrepo>.podspec --verbose. Solve your errors (solving your errors could take some time can’t help here). - Add newly changes to git with
git add .then commit withgit commit -m "Added pods" - Push your changes to your remote repo with
git push - Create new release https://github.com/
/ Click Releases -> Click New Version - Write “0.1” to Tag Version. (Optional you can fill the “Release Title”). Make sure the version is identical with the
s.versioninside<myrepo>.podspec - Write
pod trunk register name@example.org 'Your Name' --description='macbook pro' - After your new release open terminal and write
pod trunk push <myrepo>.podspec. This will change the CocoaPods Specs which will enable you to writepod '<myrepo>'inside yourpodfile