O'Reilly logo

Application Development with Swift by Hossam Ghareeb

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Advanced Swift

Now, you have got some experience in the Swift programming language and have seen how funny and easy to learn it is. In this chapter, we will take you to the next level in Swift. We will talk about more advanced topics in Swift. For sure, we can't cover all topics in Swift, but we selected the most important and commonly used ones.

Type casting and type checking

Type casting and checking are ways used in Swift to check the type of instances and cast them to any different type. In Swift, we use as and is to perform type casting and type checking. Before going deep into how to use these operators, let's build an array that we will use in next examples:

var subViews = [UILabel(), UIButton(), UILabel(), UITextField(), UITextView()] ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required