Category: Swift
-
Tip: Image Literals
iOS Development tips weekly is a series you can find at the Lynda.com and LinkedIn Learning libraries. The first week of a week’s tip will be available for free. After that, you will need a subscription to get access to it. Click the image at left to view. You’ll find an amended transcript below. You’ve…
-
What Do you do with Any?
There’s been a major change to Swift 3.0 That many people might find a little disturbing in code, and others may have no idea what it is. In one sense that’s the idea. Apple changed AnyObject to Any in Swift 3.0. This three-letter word is an extremely powerful feature,a backbone of many functions and classes, and…
-
Understand and Use Closures in Swift
Have you ever seen some factory method in UIKit and see this strange parameter called completion or completionHandler? Usually you put nil there and leave it alone. These strange things like (Double,Double) -> Bool things are closures. Closures are functions you use as types, often in parameters of other functions. In this lesson we’ll explore…
-
Why Does Apple Need Delegates?
In my post Why do we need delegates, I explained one major developer use of delegates: moving data from a destination view controller back to the controller that presented it or pushed it onto the stack. This is not the only use of delegates. Apple uses it often in APIs. In this theoretical lesson we’ll discuss…
-
Adding Modal Views and Popovers in Swift 3.0
Modal views are one of the fundamental ways to present view controllers. Some early applications on the iPhone were completely modal views — some still do. Modals do not do their own housekeeping like navigation controllers or tab controllers, so they are not as efficient for the backbone of your application. They need the user’s…
-
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 be slightly difficult, but delegates to get the information back have…
-
How to Debug Programs and Life
For several reasons related to WWDC2016, I’m breaking up the sequence I’m doing on XML. We’ll continue that next week, but this week I’m giving you the article I wrote from this week’s Slice Of App Pie podcast on debugging. I’ve had several questions on the issue. this is the first of several responses. Look…