A popular way to learn Swift is to create a SpriteKit based project. This is the route I took. Sub-classing is at the heart of Object Orientated Programming and Swift being a OO language (amongst other types) supports this.
However, it is surprisingly hard to sub-class SKSpriteNode and retain use of its most convenient 'convenience initializer': (SKSpriteNode(imageNode)). This short talk explores this, and provides some workarounds.
In Swift, switch statements are introduced as "A switch statement considers a value and compares it against several possible matching patterns. It then executes an appropriate block of code, based on the first pattern that matches successfully." Anyone used to using a C based language, such as Objective-C or C++, will know that the only form of 'matching' is with integer values.
This essentially reduces a 'switch' statement to shorthand for a bloated if....else statement. “Matching patterns" does not just mean other types such as doubles, strings and non integer enumerations. It means values within tuples, matching against ranges and even matching against additional conditions.
All of this functionality gives swift developers powerful new ways to control the flow of their code. One obvious use is to neaten complex table and collection views but that is not the only use. This presentation will attempt to introduce this powerful language feature and detail some interesting uses which have arisen in the early days of the language.
ActionScript, AGAL and Flex Developer. Reaction Diffusion Geek. Swift Newbie. Creator of Nodality - node based image processing for iPad.
The talk focuses on functions as first class values - the "functional sauce" Swift adds to Object Orientated code, and how the two compare. As a practical example, Al discusses an imperative implementation of a simple problem, contrasted with a functional version of the same.
The talk ends with brief summary of Haskell concepts which are directly applicable to Swift, including optionals, strong typing, generics, and pattern matching. Some aspects of Haskell which can inspire better code, but won't be used as frequently (or won't be used in the same form), will be mentioned in passing.
Al Skipp is the creator of Chromophore (Designers’ colour collector for iOS) as well as an iOS dev, Swift fan and Haskell hacker.
The main talk of the evening, and a "hold on to your hats!" affair, but well worth your attention. Johannes walks us through the main concepts behind a pure functional language, and draws some comparisons with Swift, including approximate Swift translations of Haskell code.
Understanding the strengths of functional programming, and learning to think in a functional way, will be an increasingly valuable skill for all Swift developers.
Some background reading:
Learn You a Haskell for Great Good: A Beginner's Guide by Miran Lipovača
Real World Haskell by Bryan O'Sullivan, Don Stewart, and John Goerzen
FPComplete.com Haskell in your browser
Functional Programming Fundamentals (video series) by Erik Meijer - wearing a great t-shirt
Johannes does computer programming for fun and profit. His main areas of interest are security, operating systems, (functional) programming languages, and generally everything else that's fun.
He is working at Bromium UK to bring trustworthy computing to the Mac (OS X), previously factis research.