Swift小公举
来源:互联网 发布:hadoop ubuntu 编辑:程序博客网 时间:2024/04/19 20:48
//标准输出func printLog<T>(message: T, file: String = #file, method: String = #function, line: Int = #line){ print("\((file as NSString).lastPathComponent)[\(line)], \(method): \(message)")}
//属性观察器 var intValue: Int{ willSet{ //属性值将要被重新赋值 } didSet{ //属性值重新赋值完成 } }
//下标。可以给结构体等添加类似于数组,字典的下标。下标支持重载。
//下标的定义
struct TimesOfNum {
let num:Int
let otherNum:Int
subscript(index:Int) -> Int{
return num * index
}
subscript(index:Int,index2:Int) -> Int{
return num * index + index2
}
}
//调用
let numValue = TimesOfNum(num: 5, otherNum: 3)
print("5 的三倍是\(numValue[3])")
print("5 的三倍再加上3是\(numValue[3,3])")
0 0
- Swift小公举
- 汽水小公举控件
- 小公举.福布斯榜
- shell 小公举
- Android小公举:Clipboard to file
- swift小总结
- Swift print 小技巧
- swift 小技巧进阶
- swift 小知识
- Swift 实用小技巧
- Swift算法小程序
- Swift小知识
- swift 小 demo
- Swift函数的小测验
- swift之小试playground
- Swift之小项目实战
- swift 手势相关小知识点
- Swift 简单联系小Demo
- modprobe: FATAL: Module xxx.ko not found in directory /lib/modules/$(uname -r)
- LeetCode-42. Trapping Rain Water (JAVA)收集雨水
- vim的替换字符串的操作
- 二十三 Swift3.0之 结构体
- SQLyog管理工具
- Swift小公举
- netty在tomcat启动时加载问题
- [LintCode]Convert Expression to Reverse Polish Notation
- iOS库--.a与.framework
- 《STL源码剖析》STL迭代器分类
- 掌握oracle数据库连接的基本原理和具体操作过程
- GUI.Layout.Button与GUI.Button的区别
- Android中shape属性详解
- 多线程、多进程、线程池、进程池