前言 近期又开始折腾起Haskell,掉进这个深坑恐怕很难再爬上来了。在不断深入了解Haskell的各种概念以及使用它们去解决实际问题的时候,我会试想着将这些概念移植到Swift中。函数式编程范式的很多概念在Swift等主打面向对象范式的语言中就像各种设计模式一样,优雅地帮助我们构建好整个项目,促使 ...
分类:
编程语言 时间:
2018-06-08 00:39:47
阅读次数:
191
在已经搭建好的GlusterFS服务器上(如不知道如何搭建GlusteFS请参考上一篇): Create bricks: # truncate -s 1GB /srv/disk{1..4}# for i in `seq 1 4`;do mkfs.xfs -i size=512 /srv/disk$i ...
分类:
编程语言 时间:
2018-06-07 14:19:25
阅读次数:
798
截取某字符串的前10个字符串 截取某字符串的后10个字符串 也可以换种写法 截取某字符串的第3个字符到第6个字符范围的字符串 ...
分类:
编程语言 时间:
2018-06-07 14:02:03
阅读次数:
482
Swift 关闭视图的过度动画 //关闭视图过渡动画 UIView.performWithoutAnimation { //关闭CALayer的隐式动画 CATransaction.setDisableActions(true) self.collectionView.reloadData() CA ...
分类:
编程语言 时间:
2018-06-01 01:01:01
阅读次数:
234
新建一个OC语言的项目,然后添加一个基于NSObject的Swift文件SwiftFileModel类 .swift import UIKit class SwiftFileModel: NSObject { func firstMethod() { print("SwiftFileModel"); ...
分类:
移动开发 时间:
2018-05-30 18:11:59
阅读次数:
519
NSMutableAttributedString let testAttributes = [NSAttributedStringKey.foregroundColor: UIColor.blue, NSAttributedStringKey.backgroundColor: UIColor.ye ...
分类:
编程语言 时间:
2018-05-30 15:09:41
阅读次数:
2589
var mV:UIView! override func viewDidLoad() { super.viewDidLoad() mV = UIView(frame: CGRect(x: 100, y: 100, width: 100, height: 100 )) mV.backgroundCol ...
分类:
编程语言 时间:
2018-05-29 23:00:03
阅读次数:
1319
//uiview的扩展 extension UIView{ func getFirstViewController()->UIViewController?{ for view in sequence(first: self.superview, next: {$0?.superview}){ if ...
分类:
编程语言 时间:
2018-05-29 22:53:25
阅读次数:
369
type(of:) Applied to an object: the polymorphic (internal) type of the object, regardless of how a reference is typed. Static/class members are access ...
分类:
编程语言 时间:
2018-05-29 19:06:12
阅读次数:
186
1.前面我们做了登录界面的UI,实现了网络请求,如果用户输入了错误的VIP号码,应该提示用户“VIP号码不正确” 2.在Android里面,我们有Toast可以直接使用,在iOS里,貌似没有这样的原生控件,那么我们引入第三个开源框架: 3.我们来修改一下 Podfile: 4.打开终端 重新引入一下 ...
分类:
移动开发 时间:
2018-05-29 17:16:53
阅读次数:
366