47 Degrees joins forces with Xebia read more

# Functional Programming in Swift

This session has ended.

The first public edition of this course is being offered for a 50% discount.

In this intensive two-day course, we’ll cover Functional Programming essentials in Swift. By the end of this course, you will have a solid grasp on the Fundamentals of the language.

#### Functional Programming Fundamentals

Part 1 of this training covers fundamentals of Functional Programming.

##### Introduction to Functional Programming

This lesson introduces FP and the Swift features that enable it, and the benefits we obtain from writing functional code. We will show examples of what can be considered a function (being total, deterministic and pure) and provide examples where these requirements are violated. Throughout the course, we will show how we can address those cases.

Outline:

• What is Functional Programming
• Swift features for Functional Programming: high-order functions, value types, protocols, optionals, functional combinators.
• Referential Transparency.

#### Domain modeling with Algebraic Data Types

An important part of writing functional code is having a proper model for the domain. This lesson presents the Swift Type System and how it relates to Algebraic Data Types. We will present code examples of OO domain models, usual problems we can have with that approach, and how they can be modeled with ADTs to reduce those issues.

Outline:

• Swift Type System: reference objects vs. value objects.
• Immutability.
• Product types: structs, tuples and classes.
• Coproduct types: enumerations.
• Making illegal states impossible to represent.

#### Error handling

Error handling is a pervasive topic across applications and libraries. This lesson will present how Swift deals with errors (using the Error protocol and throwing functions), and we will progressively transition towards having typed errors using different data types provided both by the Swift standard library, and by Bow. We will learn how to operate with these types, the differences between each one of them, and the benefits that they provide.

Outline:

• From throwing functions to typed errors.
• Types for error handling: Option, Try, Result, Either, Validated, ValidatedNEA.
• Fail fast and error accumulation strategies for error handling.

#### Working with side-effects

For our code to be functional, one of the most important requirements is purity; that is, the execution of a function should not have side effects. However, side-effects are necessary for our programs to be useful. This lesson covers what are side-effects and how they can be suspended by using the IO type. Once we have made our side-effects explicit, we will learn how to work with them to transform and compose them, both sequentially and in parallel.

Outline:

• Side effects.
• Suspending side effects with IO.
• Wrapping synchronous and asynchronous side-effectful operations.
• Concurrency and parallelism.
• Working with resources.
• Shared concurrent state.

#### Applied Functional Programming

Part 2 of this training covers practical applications of Functional Programming in iOS / macOS.

#### Networking

A common concern in many applications is networking. Although the standard library already provides they machinery to do networking operations, it has some limitations. In this lesson we will review those limitations and progressively work towards a more declarative way of writing our networking code. Then, we will cover how to compose the primitives we have written in order to make the rest of our application.

Outline:

• From imperative to declarative network calls.
• Composing network calls.
• Switching execution contexts.
• Retrial and repetition of network calls.

#### Dependency injection

In order to manage the complexity of a software application, we tend to divide our code into modules that need to communicate to each other. Each module may have multiple dependencies that should be easily replaced to change the implementation or for testing purposes, with no impact on the rest of the code. This technique is usually known as dependency injection. This lesson will cover how we can transition from the usual constructor-based way of injecting dependencies, into a functional style using Kleisli functions and the Reader pattern.

Outline:

• From constructor-based DI to environmental effects.
• Kleisli functions and composition.
• Modeling dependencies as algebras.

• \$1100
• -50% - First Public Edition

Enroll for \$550Starts on September 1 at 9 AM CET

Company and Private Group Training

• 2 Days
• Instructor-Led Course
• Beginner
• Online
• I would like to apply for financial aid.

Tomás Ruiz López

### Skills

• Swift
• iOS
• Core Concepts
• Side Effects
• Applied FP
• Testing

### This Instructor-Led Course includes:

• Maximum Class Size of 15
• Certificate of Completion

### Requirements:

• Knowledge of Swift recommended
• Software Engineering skills

Is this course 100% online?

Yes

How do I register interest for a course with no start date or future training dates?

What if I can’t find a course?

Please email your thoughts and suggestions to [email protected], and we’ll get back to you as soon as possible.

Will I receive accreditation for a course?

For any paid training courses, we intend to launch an accreditation process after the launch of Academy. If you take a paid training course before this time, we’ll make sure to send an accreditation when we’re ready.

What tools do I need to access 47 Degrees Academy content?

The only thing you need is a modern web browser and Internet connection. For training courses with code workshops or downloadable code samples, the course specifics will include the necessary tools and instructions to get going.

Will I earn university credit for completing any training?

No, at this time, the courses are not intended to replace university or other formal education courses. If you are an academic or training institution with an interest in partnering or licensing content from Academy, please get in touch at [email protected].

What languages will the training be given in?

English is the common language across 47 Degrees. If you have an interest in supporting other languages, please let us know at [email protected].

Is financial aid available for underrepresented or low-income groups?

Our industry is not diverse enough across many measures of representation. Nor is it easily accessible to many minorities or those in low-income scenarios. If you feel that you belong to an underrepresented minority or need help financially, please fill this form. We can apply a course voucher to your registered Academy account. The voucher can be redeemed against any paid course on a one-time basis. The voucher is non-transferable, non-refundable, and has no financial value.

What is the refund policy?

If you request a refund for a paid training course before taking it, we will refund your course fee during our next processing cycle. If you request a refund for a paid training course after starting or accessing it, please email us at [email protected]. Please refer to the full Terms and Conditions before requesting a refund. 47 Degrees reserves the right to refuse refunds.

Are these courses qualified for the FUNDAE (Fundación Tripartita)?

Part of the course cost is reimbursable for companies located in Spain, through Fundae ( formerly, Fundación Tripartita ). If this is your case, please contact us through [email protected] before enrolling in a course.