Swift 入门

2014 年苹果 WWDC 发布 Swift 后的初体验:相比 Objective-C 的现代化语法、Xcode 6 Playground 实时求值交互、以及类似 Go 语言的简洁表达力,记录对新一代编程语言开发模式的直观感受。

Guo Qiang
Guo Qiang
Published in Guo Qiang · Jun 05, 2014

这几天什么事情最吸引程序员眼球?无疑是苹果的苹果全球开发者大会(WWDC)。这次 WWDC 没有一台新硬件出现,但是亮点还是非常多的。

作为一个程序员出生的我也来总结下: 首当其冲的肯定是 Swift 。原因嘛,当然因为他是苹果出的因为这个新语言,看上去真的比 objective-c 正常太多了!我敢这么说,当然不是只是因为我都看过那么几眼。我可是正式上手练过的。如果你也好奇,我会在底部放上 Xcode6 下载链接。

试着编写了 Swift Hello word! 代码,我想说的是:说不定,这次要重新定义开发的模式了! Swift 给我的印象和 Golang 的初印象非常像— 大公司出品、简单易学、语言异常友好、可与其他语言(Objective-C 、c)混合使用。只是希望他不要像 Golang 一样,几年下来,推广才做到现在这样

  • 大公司出品一定程度上就是品质的保证,至少出了严重的 BUG 会有人出面摆平。

  • 简单易学,会让一些喜欢尝试的 程序员 开发者不用花费很多的时间,就可以转投新语言的环境。

  • 语言友好,为何这样说?因为Xcode6的新功能 playground 。这个功能,能让代码实时执行!没看错,真的是实时!所以整个尝试过程中,感觉就像在和代码聊天……这个功能以前只在某些高端工具上见过(见识浅,莫笑)。

  • 语言向下兼容,可以让人逐步转型,不必全部学完 Swift ,就可以用新语言开发!

顺便讲个听到的一个消息,现在已经有公司招聘 swift 工程师了,要求不高,只要 3~5年 Swift 开发经验。 我是认真的 ಥ_ಥ


####Swift 相关内容 官方介绍

Swift is an innovative new programming language for Cocoa and Cocoa Touch. Writing code is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast. Swift is ready for your next iOS and OS X project — or for addition into your current app — because Swift code works side-by-side with Objective-C.

官方介绍 playground

Interactive Playgrounds Playgrounds Playgrounds make writing Swift code incredibly simple and fun. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the timeline assistant. The timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene. When you’ve perfected your code in the playground, simply move that code into your project. ……


相关资源

iBook [click](https://itunes.apple.com/us/book/the-swift-programming-language/id881256329?mt=11) website [Swift](https://developer.apple.com/swift/) Xcode6 beta [click](http://adcdownload.apple.com//wwdc_2014/xcode_6_beta_ie8g3n/xcode_6_beta.dmg) (*可能需要借助下载工具*) 当然会有路人翻译的 [click](http://numbbbbb.github.io/the-swift-programming-language-in-chinese/)

更多精选文章推荐 MORE FROM GUO QIANG