Skip to content

Instantly share code, notes, and snippets.

@lamprosg
Last active August 23, 2021 10:06
Show Gist options
  • Select an option

  • Save lamprosg/93afe87957374165c460dec9c339a9d3 to your computer and use it in GitHub Desktop.

Select an option

Save lamprosg/93afe87957374165c460dec9c339a9d3 to your computer and use it in GitHub Desktop.
(iOS) Cocoapods
//To create a new project with CocoaPods, follow these simple steps:
//Create a new project in Xcode as you would normally.
//Open a terminal window, and $ cd into your project directory.
/Create a Podfile. This can be done by running $ pod init.
pod init
//In podfile
//Add supported iOS
platform :ios, '9.0'
//Add target
target 'MyApp' do
pod 'ObjectiveSugar'
end
//In terminal
pod install
//Update your system with latest ruby gems by installing ruby gems
sudo gem update --system
//Install CocoaPods in your system
sudo gem install cocoapods
//If the above fails
sudo gem install -n /usr/local/bin cocoapods
//Create a project for CocoaPod
pod lib create AKGitViewControllers
//Updating the pod spec file with your project information
//Lint the podspec file to verify it is valid
pod lib lint
//Push your project to GitHub (or wherever)
//Tag your last commit.
//This step indicates that you are marking this commit as a specific release of your pod.
//The name of the tag should match s.version in your .podspec file.
https://stackoverflow.com/questions/18216991/create-a-tag-in-github-repository
//Create a Trunk Account (Cocoapod account) if you haven't any
pod trunk register <Your Email>
//Push Your Pod to Cocoapods
pod trunk push <YourProject>.podspec
//First you can figure out which version of Cocoapods you are on with the command:
pod --version
//You can also see all the version of Cocoapods you have installed with this command:
sudo gem list cocoapods
//Uninstall Cocoapods. If you have multiple version, you will have the choice of uninstalling all or a specific version.1
sudo gem uninstall cocoapods
//Install the specific version with this command:
sudo gem install cocoapods -v 0.39.0.beta.3
//Git commands:
https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet
# Be sure to run `pod lib lint ProductFramework.podspec --quick --allow-warnings --sources=afse-specs' to ensure this is a
# valid spec before submitting. Make sure only the following warning appears:
#- WARN | [iOS] keys: Missing primary key for `source` attribute. The acceptable ones are: `git, hg, http, svn`.
# https://guides.cocoapods.org/syntax/podspec.html
#Details for creating a new pricate repo
#http://guides.cocoapods.org/making/private-cocoapods.html
Pod::Spec.new do |s|
s.name = 'MyFramework'
s.version = '1.0.0'
s.summary = 'The framework summary'
s.description = <<-DESC
The product description
DESC
s.license = { :type => 'Proprietary', :file => 'LICENSE' }
s.source = { :path => 'PathToSourceRepo or folder when local' }
# s.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
s.homepage = 'http://thehomepage.com'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.authors = { 'iOS dev team' => '[email protected]' }
s.ios.deployment_target = '12.0'
#s.static_framework = true
s.swift_version = '4.2'
#s.source_files = 'Library/*.{h,m,swift}', 'Library/**/*.{h,m,swift}'
s.frameworks = 'Foundation'
# This is the default list of dependecies that will pull anyone that imports the ProductFramework
#as a pod dependecy
s.default_subspecs = 'Utils'
# Exclude simulator if you want to
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
# Link with static library (if needed)
s.library = 'z'
#A subspec that groups as dependecies all the default frameworks used for the widget
s.subspec 'Extensions' do |utilsExtensions|
utilsExtensions.dependency 'MyFramework/SomeManager/Extensions'
end
#SomeManager is a wrapper that uses AFSE_UISS to accommodate the iOS product theming
s.subspec 'SomeManager' do |someManager|
someManager.subspec 'Core' do |core|
core.source_files = 'Manager/*{h,m,swift}'
core.frameworks = 'UIKit'
core.dependency 'UISS/Core'
end
someManager.subspec 'Extensions' do |ext|
ext.source_files = 'Manager/*{h,m,swift}'
ext.frameworks = 'UIKit'
ext.dependency 'UISS/Extensions'
ext.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'APP_EXTENSIONS' }
end
end
#A subspec that groups other subspecs
s.subspec 'Utils' do |utils|
utils.dependency 'MyFramework/SomeManager'
end
end
source 'https://github.com/CocoaPods/Specs.git' #infered
source 'http://yourlocalrepoContainingThePodspec.com/specs.git'
target 'MyTarget' do
pod 'MyFramework', :path => './path/to/podSpec'
target 'PrototypeTests' do
end
end
@lamprosg
Copy link
Author

lamprosg commented May 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment