pod 'Reachability' pod 'AFNetworking/Reachability' pod 'JSONKit', '~> 1.4'
The easiest way (it is the main one), while you can specify a binding to a specific version and connect not the entire library, but only a part of it (via subspec) pod 'ZipKit', :podspec => 'ZipKit.podspec'
You can use it when the existing Cocoapods specification does not suit you in any way (for example, the library specification is iOS 6.1, and your Deployment target is set to 6.0). We keep the specification, edit it to fit our needs, save it to the root of the project - as a result, everything works for you, and there is no need to add potentially harmful changes to the public specification. pod 'SuperLibrary', :path => 'Submodules/SuperLibrary'
This option is more interesting because you can specify the path to the joint code (subversion external, git submodule ...). With this method, the library files are included in the project with links to this path, which allows us to edit the library and save changes in the version control system. More on this later. pod 'SuperLibrary', :git => 'git@bitbucket.org:bestcompany/SuperLibrary.git', :branch => 'development'
The main difference from the previous paragraph is that the library source code can no longer be edited (technically possible, however, when installing dependencies, copies of files that will not refer to the original and will be copied to the original files will be added to the project upon subsequent update of dependencies) pod spec create SuperLibrary
Open the generated file, fill in the generated sections, reading the comments, in case of difficulties, refer to the documentation . s.subspec 'Data' do |ds| ds.source_files = 'Data/*.{h,m}', 'Data/Categories/*.{h,m}', 'Data/Objects/*.{h,m}' ds.resources = 'Data/SuperLibrary.xcdatamodeld' ds.dependency 'MagicalRecord' ds.dependency 'SuperLibrary/Resources' end
Access to the module is through MasterSpec / Subspec, some modules inside can depend on others inside one specification, multi-level nesting is allowed. It remains to specify the module that will be connected by default, for example s.default_subspec = 'Controllers'
And that's all, the library can be connected in parts, for example, only the network core, without affecting the resources and Unit tests. pod repo add Private-Cocoapods git@bitbucket.org:bestcompany/cocoapods-specs.git
It remains the case for small, create in the root of this repository a folder with the name of the library, in it we create a folder with the library version, where we already place the specification itself. Pod::Spec.new do |s| s.name = "SuperLibrary" s.version = "1.0.5-dev" s.source = { :git => "ssh://git@bitbucket.org:bestcompany/my-super-library.git"}
Thus, when connecting this version directly from the repository, we will have the dev mark indicating that the version is not ready. After testing this library, create a tag with the version name (check the version, and, if necessary, raise the minor / major version), copy the podspec file into our own specification repository, remove the dev prefix from the version and specify the specific tag in the repository that we just created: Pod::Spec.new do |s| s.name = "SuperLibrary" s.version = "1.1.0" s.source = { :git => "ssh://git@bitbucket.org:bestcompany/my-super-library.git", :tag => "SuperLibrary_v1.1.0" }
All that is left in the library repository is to set the version to one no longer removing the dev postfix (1.1.1-dev in our case) and send all changes to the repository. #pod 'SuperLibrary', :path => 'Submodules/SuperLibrary' pod 'SuperLibrary'
If necessary, make changes to the library, remove the comment from the line, update the library to the latest version in the repository, do the pod update in the console and everything, you can safely change and test. Before preparing an application for publication, it is worth fixing all versions of libraries (that is, creating new versions for all modified libraries and connecting them from our specification repository). Always check podfile.lock for which versions of libraries are used; our post -fix -dev helps a lot to determine that the version of the library may not be tested.Source: https://habr.com/ru/post/196736/
All Articles