diff --git a/README.md b/README.md index 9645fae..9009371 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ 不过都是些源码,下载速度非常快。我更建议您使用`git clone`,这样以后更新时只要`git pull`就可以了,避免了重复下载的麻烦。 # 快速索引 -[简书]()、[bestswifter]() + 这些demo都是用来配合我的博客,你可以选择在简书或我的个人博客阅读文章,水平有限欢迎指正。 * 你应该知道的Swift小tips:[简书](http://www.jianshu.com/p/a11c6060176c) @@ -16,3 +16,4 @@ * UIKit性能调优实战讲解:[简书](http://www.jianshu.com/p/619cf14640f3)、[bestswifter](http://bestswifter.com/uikitxing-neng-diao-you-shi-zhan-jiang-jie/) * Swift递归枚举与红黑树:[简书](http://www.jianshu.com/p/ad09e1f404b0) * 史上最简单的UIScrollView+Autolayout出坑指南:[简书](http://www.jianshu.com/p/f7f1ba67c3ca)、[bestswifter](http://bestswifter.com/uiscrollviewwithautolayout/) +* 几个加速Swift开发的小tip:[简书]() \ No newline at end of file diff --git a/SwiftTips/README.md b/SwiftTips/README.md new file mode 100644 index 0000000..dfc214c --- /dev/null +++ b/SwiftTips/README.md @@ -0,0 +1,3 @@ +# 几个加速Swift开发的小tip + +这份代码是[《几个加速Swift开发的小tip》]()一文的demo,主要介绍了Swift中很不错,但也很容易忽视的小tip,掌握这些小技巧能够一定程度上加快开发速度,写出更好的代码 \ No newline at end of file diff --git a/SwiftTips/SwiftTips.xcodeproj/project.pbxproj b/SwiftTips/SwiftTips.xcodeproj/project.pbxproj index 14638c4..855bee8 100644 --- a/SwiftTips/SwiftTips.xcodeproj/project.pbxproj +++ b/SwiftTips/SwiftTips.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ 9BE365691C60CFCE00C61A55 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE365681C60CFCE00C61A55 /* main.swift */; }; - 9BE365741C60D07B00C61A55 /* Closure.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE3656F1C60D07B00C61A55 /* Closure.swift */; }; 9BE365751C60D07B00C61A55 /* PrivateSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE365701C60D07B00C61A55 /* PrivateSet.swift */; }; 9BE365761C60D07B00C61A55 /* Semicolon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE365711C60D07B00C61A55 /* Semicolon.swift */; }; 9BE365771C60D07B00C61A55 /* Breakpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE365721C60D07B00C61A55 /* Breakpoint.swift */; }; @@ -30,7 +29,6 @@ /* Begin PBXFileReference section */ 9BE365651C60CFCE00C61A55 /* SwiftTips */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SwiftTips; sourceTree = BUILT_PRODUCTS_DIR; }; 9BE365681C60CFCE00C61A55 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; - 9BE3656F1C60D07B00C61A55 /* Closure.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Closure.swift; sourceTree = ""; }; 9BE365701C60D07B00C61A55 /* PrivateSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivateSet.swift; sourceTree = ""; }; 9BE365711C60D07B00C61A55 /* Semicolon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Semicolon.swift; sourceTree = ""; }; 9BE365721C60D07B00C61A55 /* Breakpoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Breakpoint.swift; sourceTree = ""; }; @@ -68,7 +66,6 @@ isa = PBXGroup; children = ( 9BE365681C60CFCE00C61A55 /* main.swift */, - 9BE3656F1C60D07B00C61A55 /* Closure.swift */, 9BE365701C60D07B00C61A55 /* PrivateSet.swift */, 9BE365711C60D07B00C61A55 /* Semicolon.swift */, 9BE365721C60D07B00C61A55 /* Breakpoint.swift */, @@ -137,7 +134,6 @@ 9BE365691C60CFCE00C61A55 /* main.swift in Sources */, 9BE365781C60D07B00C61A55 /* ReuseIdentifier.swift in Sources */, 9BE365751C60D07B00C61A55 /* PrivateSet.swift in Sources */, - 9BE365741C60D07B00C61A55 /* Closure.swift in Sources */, 9BE365771C60D07B00C61A55 /* Breakpoint.swift in Sources */, 9BE365761C60D07B00C61A55 /* Semicolon.swift in Sources */, ); @@ -259,6 +255,7 @@ 9BE3656E1C60CFCE00C61A55 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/SwiftTips/SwiftTips/Closure.swift b/SwiftTips/SwiftTips/Closure.swift deleted file mode 100644 index 079dbd9..0000000 --- a/SwiftTips/SwiftTips/Closure.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// Closure.swift -// Handy -// -// Created by 张星宇 on 16/2/2. -// Copyright © 2016年 zxy. All rights reserved. -// - -import Foundation -import Cocoa - -enum Theme { - case Day, Night, Dusk, Dawn - - func applyColor() { - let backgroundColor: NSColor = { - switch self { - case Day: return NSColor.whiteColor() - case Night: return NSColor.darkGrayColor() - default: return NSColor.blackColor() - } - }() - } -} \ No newline at end of file diff --git a/SwiftTips/SwiftTips/Semicolon.swift b/SwiftTips/SwiftTips/Semicolon.swift index 14f7a10..5f72745 100644 --- a/SwiftTips/SwiftTips/Semicolon.swift +++ b/SwiftTips/SwiftTips/Semicolon.swift @@ -11,4 +11,13 @@ import Foundation func doSomething() { let error: AnyObject? = nil guard error == nil else { print("Error information"); return } + + /** + * Old version + */ + guard error == nil + else { + print("Error information") + return + } } \ No newline at end of file