Documentation / Library authors
Create a library
A podspec describes a library's version, source, files and dependencies. Keep it alongside the library's sources.
Write a podspec
Create Networking.podspec. Use your repository URL and release tag in the source declaration:
Pod::Spec.new do |spec|
spec.name = 'Networking'
spec.version = '1.0.0'
spec.summary = 'Networking for Apple applications.'
spec.homepage = 'https://example.org/Networking'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.author = { 'Your Team' => 'team@example.org' }
spec.source = { :git => 'https://git.example.org/team/Networking.git',
:tag => spec.version.to_s }
spec.ios.deployment_target = '15.0'
spec.osx.deployment_target = '13.0'
spec.source_files = 'Sources/**/*.{swift,h,m}'
spec.swift_version = '5.0'
endUse the library locally
Point your application's Podfile at the directory containing the podspec:
target 'MyApp' do
pod 'Networking', :path => '../Networking'
endValidate the library
swiftpods lib lint Networking.podspecLint checks the specification and builds the library. Use swiftpods spec lint Networking.podspec to validate the source declared by the podspec.
Declare dependencies
spec.dependency 'Models', '~> 2.0'Use subspecs to group optional components. Keep resources, test specs and example applications in the same specification so consumers can select what they need.
Publish a version
Tag the library's source revision and publish the podspec to your registered spec repository:
swiftpods repo push team Networking.podspecConsumers select the repository in their Podfile with source. Publish a new version for changes to an existing release.