Swift Programming
A rapid introduction to the basics of Swift programming. This course is designed get you up to speed on Swift language features and Foundation framework APIs used in everyday Cocoa development. Provides deep insight into important aspects of key features such as optionals, generics, closures, and initializers.
Description
This fast-paced, two-day intensive will get you off to a quick start coding in Swift. There's plenty of lab time to allow you to learn by doing. And our exercises are designed to reinforce key concepts in a way that will help you gain proficiency fast. Between lecture sessions and hands-on labs you'll get a first-hand introduction to fundamentals of the Swift programming language, including classes, protocols, structs, enums, optionals, extensions, closures, generics and more.
- Learn the fundamentals of Swift programming and the standard Swift library.
- Get familiar with the Swift type system, including generic types.
- Learn to create, extend and use Swift structs, classes, protocols, and enums.
- Work with properties, methods, and subscripts at the instance and type level.
- Use extensions to enhance the capabilities of existing types.
- Gain proficiency with optionals, nil-coalescing operators, optional chaining, and related features.
- Learn functional programming techniques, including map/reduce.
- Learn how to access Cocoa Foundation classes and APIs.
Course Outline
Xcode – Learn to use Xcode to edit, build, and debug your projects, along with numerous, pro tricks and tips.
REPLs and Playgrounds – Get started using Swift read-eval-print-loops and Xcode Playgrounds to evaluate your Swift code dynamically.
Swift Fundamentals – Master the basics: constants, variables, data types, expressions, operators, statements, looping and branching, and more.
Functions, Tuples, and Closures – Learn to declare and implement Swift functions, work with named parameters, and use tuples as arguments and return values. Understand what closures are, and how they capture state. Learn to work with functions and closures as arguments to — and return values from — other functions.
Characters and Strings – Learn to work with Unicode characters and strings, and become familiar with Swift's powerful string interpolation feature, as well as string functions and operators.
Collections – Get familiar with the arrays dictionary, and set collection types provided by the Swift standard library, and get a solid handle on the differences between working with mutable and immutable types.
Working with Generic Types – Understand the purpose, syntax, and usage of Swift's generic types.
Switch Statements – Learn to use the powerful pattern-matching capabilities of Swift's switch construct to dramatically simplify program logic.
Functional Programming Techniques – Learn how the functional programming model, as exemplified by map/reduce, can simplify numerous coding tasks.
Classes and Structs – Learn the basics of declaring Swift classes and structs; writing method, property, and initializer implementations; and allocating and initializing instances.
Methods, Properties, and Subscripts – Learn how to define methods at the type and instance level, and work with local and external parameter names. Also learn how to define stored, computed, and lazy properties, as well as custom subscripts, and how to use property observers to respond to changes in property values.
Enums and Optionals – Learn the basics of enums including methods, initializers, raw values, and case matching.
Optionals and Casts – Understand how optionals work under the hood, and get your code working smoothly with this essential feature of Swift. Learn how to unwrap optional values safely through the correct use of operators such as ?, !, as, as?, and ??. And learn to use optional chaining to streamline your code.
Protocols – Learn to declare protocols with required and optional methods, and get familiar with commonly used framework protocols.
Extensions – Learn to enhance existing classes, structs, protocols, and enums by adding custom properties and methods, and discover the magical power of protocol extensions.
Access Control – Learn how to control the visibility of properties, methods, initializers, and subscripts, as well as types, such as classes, structures, and enumerations.
Managing Memory – Understand how memory allocation and deallocation are managed by ARC (automatic reference counting), and learn how to optimize your app with autorelease pools.
Unit Testing – Get up to speed on unit testing with the XCTest framework, using Xcode's built-in tooling.
Audience
Professional developers who are interested in using Swift to develop Cocoa touch apps for iOS and Apple Watch
Prerequisites
Experience with a compiled language such as C# or Java, or a dynamic language such as Ruby or Python