02 2018 档案
摘要:url.absoluteString 返回的路径名会有url scheme(file://), 所以在创建,删除,查找文件或文件夹时要用url.path。 相对的, 用String初始化一个URL,如果用来初始化的string有url scheme (file://),使用URL(string:)来
阅读全文
摘要://检查是否是小写字母 let word = "Word" let interval = "a"..."z" for a in word.characters { if !interval.contains(String(a)) { print("\(a) 非小写字母") } }
阅读全文
摘要:enum IntOrString { case IntValue(Int) case StringValue(String) } func mixedType() { let mixed = [IntOrString.IntValue(1), IntOrString.StringValue("string"), ...
阅读全文
摘要:class 太长不看版: Delegate关系 1. 子类的 designated init 必须调用父类的 designated init, 并且属于子类但是不属于父类的属性要在super.init()前赋值 2. 子类的 designated init 不能调用父类的 convenience i
阅读全文
摘要:OC版 // classA.h @property (nonatomic, copy) NSString *testString; //classA.m - (NSString*)testString { if (!_testString) { _testString = @"Hello"; NSL
阅读全文
摘要:https://www.weheartswift.com/closures/ Currying 柯里化 e.g.1 //返回值为 参数为Int返回值为Int的闭包 func addTo(adder: Int) -> Int -> Int { return { num in return num +
阅读全文

浙公网安备 33010602011771号