本文是通過cocoapods安裝的,其他安裝方式請自行參考SnapKti的github官網。
1、先安裝cocoapods
$ gem install cocoapods
2、進入Xcode項目的根目錄,運行pod init,會自動生成一個Podfile文件
3、打開Podfile,修改爲如下內容
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'easyNote' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for easyNote
pod 'SnapKit', '~> 4.0.0'
#if using swift 5.0
#pod 'SnapKit', '~> 5.0.0'
end
4、運行pod install,這樣snapkit就安裝好了。
注意,打開項目的時候打開的是xcworkspace文件,而不是xcodeproj文件。