Swift is a new language developed for iOS and Mac OS applications. In this presentation, VM Farms Inc.'s Anarosa Paredes outlines some of its major features, for the company's Friday Tech Demo series.
before runtime Inferred Automatically infers variable types, based on the context they’re used in There’s no need to import libraries for input/output or handling strings Source: cbeust - “Apple Swift Programming Language Unveiled” Reddit.com
any type Source: iOS Developer Library - Swift Language Guide - “The Problem That Generics Solve” On the left is a function that is built to swap two integers. Floats would be invalid inputs. On the right, the same function is implemented as a Generic. Ints and floats are both now valid input types.
be in non- Latin character languages Closures Used for functional programming No exceptions Like C Image source: Global Nerdy Source: cbeust - “Apple Swift Programming Language Unveiled” Reddit.com
with a particular class, structure, or enumeration (great for OOP) Observers willSet and didSet Enums a common type for a group of related values Optional chaining with "a?.b?.c" Forced dereference with "!."". Original source: cbeust - “Apple Swift Programming Language Unveiled” Reddit.com
Programming Language Unveiled” Reddit.com, “Downcasting” Wikipedia Convenient "assign and test" if let person = findPerson() ... Type casting with is (e.g. change a variable type from int to float) Down casting with as? downcasting is the act of casting a reference of a base class to one of its derived classes
iOS Foundation Kit, Application Kit, and Core Data frameworks, C standard library, Objective-C runtime App Swift XCode Image source: iOS Developer Library - “What is Cocoa?”
the time “Sorting a 1 million random integers array took 6 seconds when using Swift, versus 0.06 seconds when using C++, and 0.6 seconds when using Python.” http://www.infoq.com/news/2014/06/apple-swift-performance-hit However, can get speeds comparable to C when an “aggressive” compile optimizer flag (-0fast) is used
languages (like Python) using a Playground. • A playground is an interactive environment • Run your code immediately to test behaviour • No need to compile the entire app/environment. Playgrounds allow Swift to behave like a dynamic language, instead of a static one.