Blog

Blog

PHODAL

关于Apple的Swift语言简介

“About Swift

Swift is a new programming language for iOS and OS X apps that builds on the best of C and Objective-C, without the constraints of C compatibility. Swift adopts safe programming patterns and adds modern features to make programming easier, more flexible, and more fun. Swift’s clean slate, backed by the mature and much-loved Cocoa and Cocoa Touch frameworks, is an opportunity to reimagine how software development works.

Swift has been years in the making. Apple laid the foundation for Swift by advancing our existing compiler, debugger, and framework infrastructure. We simplified memory management with Automatic Reference Counting (ARC). Our framework stack, built on the solid base of Foundation and Cocoa, has been modernized and standardized throughout. Objective-C itself has evolved to support blocks, collection literals, and modules, enabling framework adoption of modern language technologies without disruption. Thanks to this groundwork, we can now introduce a new language for the future of Apple software development.”

Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itunes.apple.com/cn/book/swift-programming-language/id881256329?l=en&mt=11'

中文

Power By Google。

Swift是一种新的编程语言,用于iOS和OS X的应用程序,建立在最佳的C和Objective-C中,没有C的兼容性的限制。Swift采用安全的编程模式,并增加了现代的功能,使编程更容易,更灵活,更有趣。Swift的洗涮,由成熟和备受宠爱的可可和可可触摸框架的支持,是一个机会,重新构想如何的软件开发工作。

Swift一直是多年的酝酿。苹果公司通过推进我们现有的编译器,调试器和框架的基础设施奠定了Swift的基础。我们简化了存储管理,自动引用计数( ARC) 。我们的框架协议栈,基于基金会和可可的坚实基础,已实现了现代化和整个标准化。 Objective-C语言本身已经进化到支持块,收集文字和模块,使框架采用现代语言技术不中断。由于这个基础,我们现在可以引入苹果软件开发的未来一种新的语言。

Swift感觉熟悉Objective-C语言的开发人员。它采用Objective-C语言的命名参数和Objective-C中的动态对象模型的功率的可读性。它提供了无缝接入现有的Cocoa框架和混合和匹配与Objective-C代码的互操作性。从这个共同点建设,雨燕引入了许多新的特性和统一语言的程序和面向对象的部分。

Swift是友好的新的程序员。它是第一个获得工业品质的系统编程语言,为表现和愉快的脚本语言。它支持操场,一个创新的功能,它允许程序员尝试斯威夫特代码并立即看到结果,无需建立和运行一个应用程序的开销。

Swift特结合了最好的现代语言与思维从更广泛的苹果工程师文化的智慧。编译器针对性能进行了优化,语言的发展进行了优化,无需任何牺牲。它的设计从“Hello,World”扩展到整个操作系统。这一切都使得Swift的开发者和苹果健全的未来投资。

Swift 示例

  class Square: NamedShape {
      var sideLength: Double

      init(sideLength: Double, name: String) {
          self.sideLength = sideLength
          super.init(name: name)
          numberOfSides = 4
      }

      func area() ->  Double {
          return sideLength * sideLength
      }

      override func simpleDescription() -> String {
          return "A square with sides of length \(sideLength)."
      }
  }
  let test = Square(sideLength: 5.2, name: "my test square")
  test.area()
  test.simpleDescription()

有木有python+Javascript的感觉?

在线查阅The Swift Programming Language


或许您还需要下面的文章:

关于我

Github: @phodal     微博:@phodal     知乎:@phodal    

微信公众号(Phodal)

围观我的Github Idea墙, 也许,你会遇到心仪的项目

QQ技术交流群: 321689806
comment

Feeds

RSS / Atom

最近文章

关于作者

Phodal Huang

Engineer, Consultant, Writer, Designer

ThoughtWorks 技术专家

工程师 / 咨询师 / 作家 / 设计学徒

开源深度爱好者

出版有《前端架构:从入门到微前端》、《自己动手设计物联网》、《全栈应用开发:精益实践》

联系我: h@phodal.com

微信公众号: 最新技术分享

标签