How to Make a Pod of your iOS library
This post is about converting your iOS project into a pod and not how to upload it to CocoaPods (yes you can make private pods too). So here are the steps:
- finish your iOS library coding
- once done then make a new file called [your_project_name.podspec] in the root of your project structure.
- add the following (just default) code in your [your_project_name.podspec]
Pod:: Spec.new do |spec|
spec.name = 'your_project_name'
spec.version = 'your_project_version_number'
spec.summary = 'your_project_summary'
spec.author = {
'developer_name' => 'developer_email'
}
spec.license = 'MIT'
spec.homepage = 'your_project_homepage_url'
spec.source = {
:git => 'your_projects_github_https_git_url',
:branch => 'your_project_branch_name'
}
spec.source_files = 'your_folder_name_which_has_all_the_lib_files/*.{h,m}'
spec.requires_arc = true
end
Now anyone who wants to use your pod then they have to add the following line in their pod file.
pod 'library_name', :git => 'library_github_https_git_url', :branch => 'branch_name'
Now let me share what some of the terms (the ambiguous ones) in the podspec means:
- spec.source_files
- you need to save all your library files in a folder, saved in the root directory of the project. Here you will have to mention this folder’s name
- *.{h, m} means all the files with .h and .m extension