Swift Tutorials

Tutorials, examples, practical guides, and more about the Swift language.

Creating Enums with Custom Raw Type in Swift

Find out in this post how to create enums with raw values of custom types in Swift, and go through a demonstration of all you need to know.

Implementing A Custom Formatter in Swift

Learn how to create a custom formatter in Swift in order to validate and format displayed and user input values conveniently.

The Defer Statement in Swift

Find out in this post what the Defer statement is in Swift and how to use it in order to perform clean up actions in code blocks effectively.

Using Variadic Parameters in Swift

Learn about variadic parameters and how to implement functions that contain them and accept an arbitrary number of values.

Overloading Functions in Swift

Overloading functions in Swift is a common technique, and this post shows how to apply it and gain flexibility and convenience.

Stored and Computed Properties in Swift

Explore and understand what stored and computed properties are in Swift, and how to gain better programming habits for better code.

Escaping Closures in Swift

Read about escaping closures in Swift and how to avoid memory related problems in a post that explains everything in simple words.

Default Value in Swift Dictionaries

Learn how to provide default values in Swift dictionaries, and how to get back actual values instead of nil even when keys do not exist.

Failable Initializer in Swift

Read about the failable initializer in Swift, and how to use it in custom types in order to return nil if proper initialization fails.