Swift开发中的一些琐碎
2016-07-05 17:58
381 查看
1、Swift中使用OC
1.创建 pch 文件,直接引用需要的头文件 #import"SQLite3.h"
2.修改 pct 路径 ,如下图,就可以使用了
2、 Swift 没有系统定义好的宏,想使用DEBUG模式要自己自定义,如下图
3、 自定义print
print(__FILE__) // 获取当前print所在的文件路径
print(__FUNCTION__) // 获取当前print所在的方法名称
print(__LINE__) // 获取当前print所在的行号
fun MyLog<T>(message: T, fileName: String = __FILE__, methodName: String = __FUNCTION__, lineNumber: Int = __LINE__) {
#if DEBUG
print("\((fileName as NSString).pathComponents.last!).\(methodName)[\(lineNumber)]:\(message)")
#endif
}
AppDelegate.swift.application(_:didFinishLaunchingWithOptions:)[24]:ddd
4、使用原始图片
5、Swift 中导入 OC库编译错误
有时候在swift开发中导入 SnapKit 库 遇到编译错误问题,可能是库的版本太高了,你的Xcode 或者 swift 版本还不支持。将库版本降低就OK了。
6、使用git的时候 ,当你先 git add .了之后没有 push到远程仓库,之后又修改,git add . 然后在push 的时候 会提示下面错误
error: failed to push some refs to 'git@git.oschina.net:w_wl/han.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
意思是要你先 git pull 本地merge之后再push 到远程仓库
1.创建 pch 文件,直接引用需要的头文件 #import"SQLite3.h"
2.修改 pct 路径 ,如下图,就可以使用了
2、 Swift 没有系统定义好的宏,想使用DEBUG模式要自己自定义,如下图
3、 自定义print
print(__FILE__) // 获取当前print所在的文件路径
print(__FUNCTION__) // 获取当前print所在的方法名称
print(__LINE__) // 获取当前print所在的行号
fun MyLog<T>(message: T, fileName: String = __FILE__, methodName: String = __FUNCTION__, lineNumber: Int = __LINE__) {
#if DEBUG
print("\((fileName as NSString).pathComponents.last!).\(methodName)[\(lineNumber)]:\(message)")
#endif
}
AppDelegate.swift.application(_:didFinishLaunchingWithOptions:)[24]:ddd
4、使用原始图片
5、Swift 中导入 OC库编译错误
有时候在swift开发中导入 SnapKit 库 遇到编译错误问题,可能是库的版本太高了,你的Xcode 或者 swift 版本还不支持。将库版本降低就OK了。
6、使用git的时候 ,当你先 git add .了之后没有 push到远程仓库,之后又修改,git add . 然后在push 的时候 会提示下面错误
error: failed to push some refs to 'git@git.oschina.net:w_wl/han.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
意思是要你先 git pull 本地merge之后再push 到远程仓库
相关文章推荐
- iOS_Swift_元组
- Beginning iOS Animation Series (Swift 2)
- swift 3官方文档(读后感)
- nil和Nil的区别
- Swift基础之UIImageView(都是2.2版本)
- Swift基础之UIImageView(都是2.2版本)
- iOS_Swift_集合数据类型
- swift 将json字符串 转换成 字典
- IOS --- OC与Swift混编
- Swift - 字典
- Swift - 数组
- Swift 复制文本到剪切板
- Swift - 字符串
- Swift_基础知识
- Swift - 条件语句和循环语句
- Swift - 可选类型
- AnyClass,元类型 和 .self
- Swift - 变量与常量
- swift 小知识
- UICollectionView在Swift3.0中的用法