This is part of the "iOS and Swift for Beginners" learning path. View Path

Programming in Swift: Functions and Types

Dec 3 2019 · Video Course (4 hrs, 25 mins) · Beginner

Gain a deeper understanding of functions, practice using closures, and build your skills with named types.

Version

  • Swift 5.1, Xcode 11

Functions

Introduction

2:55 Free

Find out what you'll learn in this course, what you should know already, and how to get the most out of it.

1

Before you move on to some more advanced features of functions, review what you should already know.

2

Practice what you have learned about writing functions so far with this open-ended coding challenge.

3

When you create multiple functions with the same name, it's called "Overloading". Find out the rules to overloading functions.

4

Learn how to add variadic parameters to functions and how to use the inout keyword to mutate parameters in a function.

5

Practice what you have learned about function overloads and parameters with this series of hands-on coding challenges.

6

Functions are really just another type of data in Swift! You can use them as parameters for other functions.

7

Conclusion

0:26

Review what you learned about functions in this part of the course, and see what is coming up in the next part.

8

Closures

In this part of the course you'll learn about Swift closures, and how they can help you deal with collections.

9

Closures

7:52

See what closures and functions have in common, and find out about some key differences between the two.

10

Practice what you have learned about writing closures with this series of hands-on coding challenges.

11

Closures coming with a dizzying arraying of syntactical options! Learn how to read and write them all in this episode.

12

Practice writing closures using different levels of verbosity with this series of hands-on coding challenges.

13

Find out how writing closures can help you handle collections with two common alternatives to for loops: forEach and map!

14

Try out two specialized mapping methods that help you deal with collections of optionals and multidimensional collections!

15

Practice what you have learned about using closures and collection with this series of hands-on coding challenges.

16

Learn to use three more methods to help you filter and sort collections, and use all elements in a collection with reduce.

17

Practice what you have learned about filter, reduce, and sort with this series of hands-on coding challenges.

18

Conclusion

3:57

Review what you learned about closures and how they can help you with collection, and see what is coming up in the next part.

19

Enumerations

In this part of the course you'll learn what enumerations are, and how they can work together with switch statements.

20

Learn how to use enumerations to represent a specific set of related, discrete values like card suits or seasons.

21

Practice what you have learned about using enumerations with this series of hands-on coding challenges.

22

Switch statements are another method of control flow like loops and if statements. Find out how they can help you deal with enumerations.

23

You can use switch statements to switch on types other than enumerations! Try it out in this episode.

24

Practice what you have learned about switch statements with this series of hands-on coding challenges.

25

There’s another way to associate values with your enumeration instances. They are literally called “associated values”.

26

Conclusion

0:33

Review what you learned about enumerations and switch statements, and see what is coming up in the next part.

27

Properties & Methods

In this part of the course, you'll study some features shared by named types: properties and methods!

28

Learn more about stored properties, like how to use property observers, getters and setters, and type properties.

29

In this episode, learn about a different kind of property that is recomputed every time it is accessed!

30

In this episode, learn about the lazy keyword and how it can help you avoid expensive calculations until you need them.

31

Practice what you have learned about using different kinds of properties with this series of hands-on coding challenges.

32

Methods

13:43

Take a deep dive into methods, including writing initializers, mutating methods, and more. Work with structures and enumerations!

33

Practice what you have learned about using methods through this series of hands-on coding challenges.

34

In this episode, Learn when it is best to use computed properties, and when it's best to use methods.

35

Conclusion

0:55

Review what you learned about properties and methods in this part of the course, and find out what's up next.

36

Protocols & Inheritance

In this part of the course, learn how you can use subclassing and protocol adoption to let your types inherit functionality.

37

Inheritance

15:05

Learn about a unique features of Swift classes that lets one class inherit functionality from another class.

38

Practice what you've learned about subclassing with these hands-on challenges about Swift class inheritance.

39

Initializers

13:26

Learn how to create your own class initializers, including two-phase initialization, and required vs. convenience initializers.

40

Practice what you've learned about initializers by creating your own class initializers, with some hands-on challenges.

41

Protocols

6:41

Learn how to make your types conform to protocols in Swift, which you can think of as a to-do list for your types.

42

Swift extensions can help you add functionality to named types, and give your protocols more power with default implementations!

43

Practice what you have learned about protocols and extensions in this series of hands-on challenges.

44

Review the differences between classes and structures in Swift, and when you might want to subclass or use a protocol.

45

Conclusion

1:08

You've learned a ton of new Swift concepts! Find out where to go next with all of your new knowledge.

46

Who is this for?

This course is part of our iOS and Swift for Beginners learning path. You're ready for this course if you're working through that learning path in order, or you're someone who has just a little bit of Swift experience.

To start, you'll review some function fundamentals and learn more advanced features of functions. You'll also practice writing closures, a close relative of functions, and using them to manipulate collections.

Then, you'll move on to build your skills in writing named types: structures, classes, enumerations, and protocols. You'll learn about the features they share, and some of the functionality that makes each unique.

Throughout the course, you'll practice everything you learn with hands-on challenges.

This course isn’t suited for advanced developers. If that’s you, check out our Advanced Swift Courses for more ways to level-up your Swift skills!

Covered concepts

  • Functions
  • Overloading
  • Closures
  • Higher-Order Functions
  • Enumerations
  • Switch Statements
  • Getters and Setters
  • Property Observers
  • Computed Properties
  • Lazy Variables
  • Methods
  • Subclassing
  • Initializers
  • Protocols
  • Extensions

Contributors

Comments