siwft中导入snapkit
2019-01-04 本文已影响0人
summerTa
# platform :ios, '9.0'
target 'swiftPractice' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod'SnapKit'
end
首先我们使用CocoaPods导入SnapKit:
//Podfileplatform :ios,'8.0'use_frameworks! target'你的工程名'dopod'SnapKit'end
CocoaPods相关知识可以去看看唐巧前辈的博客
导进来的Pods目录是这样的:

image.png
注意这个Products文件夹
我们试试能不能import

image.png
喜闻乐见报错了,原因是Xcode找不到这个SnapKit.framework。
解决方案: command+B Build一下

image.png
OK, 问题解决
另外还有个小坑,升级了Xcode9后,默认的Swift版本是4.0

image.png
而网上的库一般默认是支持3.x的, 所以这个时候你将第三方库导入你的工程时就会报语法错误:

image.png
ios中的snapkit中的用法,可能把它写成oc中的用法了。