Classes – The Basics

Classes in Swift are something you will be using a lot if you want to really get to grips with creating applications. I suggest that if you do not know what Object Oriented Programming methodology is that you at least read up on the basics before starting any serious development, there is a highly regarded book by Erich Gamma on the subject titled Design Patterns: Elements of Reusable Object-Oriented Software.

Classes in Swift are simple to create and use, this is I feel an improvement over Objective-C where at times it felt harder than it needed to be due to the syntax involved.

To follow along I suggest creating a playground so you can instantly see the results.

Read moreClasses – The Basics

Functions – The Basics

( NOTE: Updated for Beta 3 syntax changes )

Functions are next up on the basics list, in a class you’ll see them called Methods. Think of functions as blocks of code (not to be confused with the confusing Blocks in previous iOS releases) that perform a task and either return something back or adjust something elsewhere in your program. Functions can be called with parameters that are used in the functions code. Often the function returns some meaningful data back from the call that can then be used for it’s desired purpose.

To put it another way, think of a function as being a dish washer and the dirty plates going in as the parameters. The dish washer does it’s thing and then returns back a clean set of plates ready to be used for something else. In a sudo code language it might be something like this.

Read moreFunctions – The Basics