training

 

Programming in Swift 4.0 – 3 Days

Course Description

With Swift, Apple has introduced a fast and innovative new programming language aimed specifically at iPhone, iPad and OS X App Development. Modern and concise, Swift represents a major departure from Objective-C in both structure and syntax as it introduces many new programming concepts. This course will thoroughly cover all the major features of Swift, from variable and constants declarations to working with Collection Objects, Optionals, Variadic and Curried Functions, Tuples, Closures, Control-Flow statements, and the creation of custom Swift Classes.
This 3-day course is aimed at creating a solid foundation in Swift programming so as to easily enable moving towards iPhone, iPad and OS X App Development using Swift.

Note: This class is recommended as the prerequisite/companion class to the 5-day iOS App Development Using Swift class also offered by us.

Objectives

  • Learn to declare Variables and Constants, use Swift’s different Data Types and perform Type-Casting operations
  • Create Custom Classes, use Inheritance and Subclassing
  • Write Functions (basic, curried, variadic) and class Methods
  • Work with Optional variables, Optional Chaining, Forced Unwrapped Optionals
  • Create Collection Objects using Arrays and Dictionaries
  • Declare and implement custom Protocols
  • Write Structs and Enums
  • Create initializers, learn about Designated initializers, Convenience initializers and Initializer Delegation
  • Write full-fledged Swift Apps

Prerequisites

  • Previous programming experience is recommended but not mandatory.
  • Basic familiarity with Mac computers and working in Mac OS X is recommended
  • The target audience is beginner programmers as well as experienced programmers who are not familiar with Swift.

Lab Setup and Recommended Tools

Outline

    1. Creating and Running a Swift Project in Xcode
      1. Xcode IDE overview
      2. Creating and using Playgrounds
      3. Building and testing programs – the workflow
    1. Working with Data Types, Variables & Constants
      1. Variables and Constants
      2. Data Types: Ints, Floats, Doubles, Bools, Chars, AnyObject
      3. Strings – Literals, Mutability, Interpolation, Concatenation
      4. Type Inference & Type-Safety
      5. Type Casting
      6. Unicode characters in Variable declaration
    1. Working with Collection Objects
      1. Arrays
        1. Array Literals
        2. Creating and Initializing Arrays
        3. Accessing & Modifying Arrays
        4. Iterating over Arrays
        5. Assignment and Copy Behavior for Arrays
      2. Dictionaries
        1. Dictionary Literals
        2. Initializing
        3. Modifying Dictionaries
        4. Iterating over Dictionaries
        5. Assignment and Copy Behavior for Dictionaries
      3. Collections Sequence Operations
        1. Map
        2. Filter
        3. Reduce
    1. Control-Flow
      1. Conditionals
        1. IF and Ternary Statements, Compound Relationals
        2. Switch Statement – switch with Strings, Range-Matching, Tuples, Value Bindings, WHERE clauses
        3. Control Transfer Statements – Continue, Break, Fallthrough, Return
      2. Loops
        1. FOR loops, FOR-IN loops, FOR-Condition-Increment
        2. WHILE loops, DO-WHILE loops
    1. Writing Classes in Swift
      1. Declaring a Swift class in a separate file
      2. Declaring Stored and Computed Properties
      3. Lazy Stored Properties
      4. Working with Property Observers
      5. Creating Instance Methods
      6. Creating class Methods & class Properties
      7. Creating init Methods
      8. Designated Initializers, Conveniences Initializers, Initializer Delegation
      9. Deinitialization
      10. Class Extensions
    1. Inheritance
      1. Base Classes, Creating Subclasses
      2. Overriding Methods & Properties
      3. Preventing Overrides
    1. Archiving, Serialization, and Key-Value Coding
      1. The Codable Protocol
      2. The JSONEncoder Class
      3. Creating KeyPaths for property references
      4. Creating KeyPaths for function references
    1. Optionals
      1. Forced Unwrapping
      2. Optional Binding
      3. Implicitly Unwrapped Optionals
      4. Optional Chaining
    1. Functions
      1. Basic, Argumented and Variadic Parameters Functions
      2. inout Parameter Value Functions, Default Parameter Value Functions
      3. Curried Functions and Nested Functions
      4. Functions with Return types, Functions Returning Multiple/Tuple Types
      5. Functions returning other Functions
    1. Structures
      1. Properties & Methods
      2. Memberwise Initializers
      3. Structures vs. Classes
    1. Enumerations
      1. Declarations
      2. Matching with Switch Statements
      3. Associated Values
      4. Raw Values
    1. Generics
      1. Generic Functions
      2. Generic Types
      3. Type Parameters
      4. Extending Generic Types
      5. Associated Types
    1. Protocols
      1. Protocol Declarations and Syntax
      2. Property and Methods Requirements
      3. Requiring Initializers
      4. Protocol Types
      5. Swift Standard Library Protocols
      6. Protocol Inheritance
    1. Closures
      1. Closure Expressions & Syntax
      2. Closure Context Type Inferrence
      3. Shorthand Argument Names
      4. Trailing Closures
    1. Error Handling
      1. Prevent Crashes due to System Generated Errors
      2. Expose and Get Detailed Information on Thrown Errors
      3. Create User-Defined Error-Types using the ErrorType Protocol
      4. Create Custom Functions to Throw Custom Errors
  1. Additional Topics
    1. Incorporating Objective-C classes in a Swift Project
    2. Incorporating Swift classes in an Objective-C Project
    3. Debugging
    4. Unit Testing

 

Note: Clients are welcomed to request customization of this course to meet any specific needs they may have. Additional lessons can be created and substituted for existing ones to create a custom class.

MindIQ.com

Print Friendly, PDF & Email