通过CocoaPods安装
初始化
进入工程更目录执行命令,生产Podfile文件
pod init
打开Podfile 文件
vim Podfile
编辑
# Uncomment the next line to define a global platform for your project # platform :ios,'9.0' target 'Aider' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! pod 'SnapKit','~> 3.0' #增加此行 # Pods for Aider end
运行CocoaPods install 命令
leishendeMBP:Aider leishen$ pod install Analyzing dependencies Downloading dependencies Installing SnapKit (3.2.0) Generating Pods project Integrating client project [!] Please close any current Xcode sessions and use `Aider.xcworkspace` for this project from now on. Sending stats Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed. [!] Automatically assigning platform ios with version 10.3 on target Aider because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/Syntax/podfile.html#platform`.
到此,不出意外的话,你已经将SnapKit集成到你的项目中了。
重新打开项目
项目名称.xcworkspace