در این آموزش تصویری با با Closures در Swift 2 به صورت پیشرفته آشنا می شوید. سویفت زبان برنامه نویسی مورد نظر Apple و یک جایگزین بسیار خوب برای Objective-C می باشد. این دوره به معرفی Closures  در زبان برنامه نویسی سویفت می پردازد. در ادامه برنامه نویسی iOS یا OSX را می آموزید.

این دوره آموزشی محصول موسسه Treehouse است.

سرفصل های این دوره:

  • توابع به عنوان داده
  • توابع به عنوان پارامترها
  • توابع به عنوان کلاس اول
  • گسترش نوع int
  • توابع بازگشتی
  • سفارشی کردن توابع
  • گرفتن متغیرها
  • نقد و بررسی: توابع کلاس اول
  • توابع کتابخانه استاندارد ساختمان
  • و ….

عنوان دوره: Treehouse Closures in Swift 2

مدت دوره: 156 دقیقه

نویسنده: Pasan Premaratne

Treehouse Closures in Swift 2

Pasan Premaratne

One of the more powerful features in Swift are closures. Closures allow you to encapsulate functionality and context and pass it around in your code. In this course, we�re going to take a look at the underlying principles behind closures, write some useful functions that take closures and understand how they are used in iOS development.
What you'll learn
Higher Order Functions
Closure syntax
Closure expression syntax
Inline closures
Closures in iOS development

First Class Functions
Before we talk about closures, let�s take a look at functions in Swift. Functions are first class citizens, which means they are treated in much the same way as Strings or Integers. Being able to pass functions around in our code is a crucial concept to learning how closures work and we�ll start from the ground up by building higher order functions.
8 steps
Functions as Data
Functions as Parameters
Functions as First Class Citizens
2 objectives
Extending the Int Type
Returning Functions
Higher Order Functions
3 objectives
Capturing Variables
Review: First Class Functions
5 questions
Closure Expressions
Now that we know how to write higher order functions, let�s see how this relates to closures. We�ll look at how to write a standard closure, as well as some of the closure expression syntax that makes using closures a lot easier.
4 steps
Building Standard Library Functions
The Swift standard library contains many extremely useful functions that accept closures as parameters to carry out complex logic. In this stage, we're going to look at how these functions work, how we can build them ourselves and why functions that accept closures are one of the best things ever.
8 steps
Closures in Cocoa Touch
Now that we know how to write closures, let�s take a high level look at why closures are important and how they are used, particularly in iOS development.
5 steps
Asynchronous Error Handling
Errors can occur anywhere in code and that includes closures. The ways in which you handle an error in a closure depends on the signature of the closure and over the next few videos, let's explore how we can throw and handle errors inside a closure.
4 steps