Tag: delegates

Segue Actions

If you’ve been working with View controllers for a while, you’ve probably dealt with prepareForSegue. In Xcode 11, there’s a new way to handle this that makes a little more sense: Segue actions. Let’s take a look at this feature.   If you download the…

Protocols and Time Pickers

While there is the date components picker, sometimes you want a picker the gives a time interval in seconds. In this two-part tutorial, Let me show you how to set up one, and discuss some good uses of protocols beyondself If you download the…

Why do we need Delegates in iOS and WatchOS?

About two years ago someone asked me a very good question: Why do we need delegates for UIViewControllers?  He thought Swift  made things easier, but this delegate stuff seems very complicated. Shouldn’t we be able to send a message or initializer between classes? When…

Using Segues and Delegates for Navigation Controllers in Swift 4.0

[Updated 2/13/2018 to Xcode 9 / Swift 4.0] It should be one of the easiest things we do, and yet for many it is the most confusing. Getting data from one view controller to another as you switch views never seems easy. Segues might…

A Swift Tutorial for Working with Classes Part 3: Abstract classes.

In the first tutorial in this series we introduced classes. In  the second we did some more advanced manipulations of classes. In both, we discussed the idea of inheritance, which has one final possibility: a class whose only purpose is to define other classes….

Swift Swift: Using Tab Bar Controllers in Swift

[Updated to Swift 2.0/iOS9.0 9/20/2015 SJL] While Navigation controllers often have the limelight when it comes to Xcode’s view  controllers, tab bar controllers are better for independent tasks in the same app, or for different ways of working with the same model. In this…

Swift Swift: Using Xibs and Delegates with Modal Views

In the last post, I showed how to create modal views and popovers on an iPad . That lesson was missing two critical things for modal views, which we will cover in this one. We will learn how to add a .xib file to…