SpecGen is a command line tool for generating podspec files from frameworks, so they can be used in a CocoaPods setup.
- 🔥 Generates
.podspecfiles from.frameworkfiles - 🔥 Carthage compatibility, so the generated
.podspecfiles contain the version specified in theCarfile.resolved(effectively delegating to Carthage the dependency resolution) - 🔥 Use CocoaPods and Carthage together, allowing pods to depend on frameworks installed by Carthage
- 🔥 Massively reduce build times by substituting source code pods with their
.framework
mint install acecilia/specgengit clone https://github.com/acecilia/specgen.git
cd SpecGen
make-
Tell SpecGen which
.podspecfiles to generate by customizing yourCartfile:github "SwiftKickMobile/SwiftMessages" == 5.0.1 # specgen:start github "hackiftekhar/IQKeyboardManager" == 6.2 # specgen:frameworks IQKeyboardManager IQKeyboardManagerSwift github "madebybowtie/FlagKit" == 2.2 -
Generate the
.podspecfiles:specgen bootstrap
-
Integrate the
.podspecfiles in your Podfile:
load '<path_to_frameworks>/Podfile' # <==============
target 'MyApp' do
autogenerated_pods # <==============
pod 'Alamofire', '~> 3.0'
endIf you are using Carthage (by default specgen looks for the frameworks under Carthage/Build/iOS), simply run:
specgen bootstrapIf not, you have to specify the path containing the frameworks:
specgen bootstrap --frameworksPath <path_to_frameworks>This will generate the necessary .podspec files next to the frameworks.
To see all the possible options, run:
specgen --helpYou have two options:
-
Using the autogenerated
Podfile:load '<path_to_frameworks>/Podfile' # <============== target 'MyApp' do autogenerated_pods # <============== pod 'Alamofire', '~> 3.0' end
-
Not using the autogenerated
Podfile: point each pod to the local path containing the.podspecfile:target 'MyApp' do pod 'FlagKit', :path => '<path_to_frameworks>' pod 'IQKeyboardManager', :path => '<path_to_frameworks>' pod 'IQKeyboardManagerSwift', :path => '<path_to_frameworks>' pod 'NVActivityIndicatorView', :path => '<path_to_frameworks>' pod 'NVActivityIndicatorViewAppExtension', :path => '<path_to_frameworks>' pod 'Result', :path => '<path_to_frameworks>' pod 'SideMenu', :path => '<path_to_frameworks>' pod 'SnapKit', :path => '<path_to_frameworks>' pod 'SwiftMessages', :path => '<path_to_frameworks>' pod 'Alamofire', '~> 3.0' end
it is possible to add comments to a Cartfile in order to specify which of the frameworks requires a .podspec. Take the following Cartfile as an example:
github "SwiftKickMobile/SwiftMessages" == 5.0.1
# specgen:start
github "hackiftekhar/IQKeyboardManager" == 6.2 # specgen:frameworks IQKeyboardManager IQKeyboardManagerSwift
github "madebybowtie/FlagKit" == 2.2
SpecGen will generate .podspec files for three frameworks:
IQKeyboardManager, with version6.2IQKeyboardManagerSwift, with version6.2FlagKit, with version2.2
This allows to add some frameworks in your project by following the official Carthage method, and some others through CocoaPods, using the .podspec files generated by SpecGen.
SpecGen is licensed under the MIT license. See LICENSE for more info.