Category: Swift Swift

Tab Bar Controllers in Xcode 8 Storyboards

In this lesson, we’ll take a look at tab bar controllers and how to add them in the storyboard.  For more on implementing them completely in code see Swift Swift: Using Tab Bar Controllers in Swift. For more on data sharing once set up…

Using Attributed Strings in Swift 3.0

For most uses, a basic string works well. Normal strings have no character or paragraph formatting. They rely on the properties of the control to format them. The system only formats the full string, not parts of it. For formatting a part of a…

How to Use UIImagePickerController for a Camera and Photo Library in Swift 3.0.

Almost every iPhone and iPad now has a camera. Many people want to use a camera in their apps for various reasons. While you may not be building the next Instagram or Twitter, there are many places where photo documentation comes in handy. There…

How to Use Dictionaries in Swift 3.0

What is a Dictionary Dictionaries and arrays make up the collection types of Swift. Collections are exactly what they say: a collection of values. The difference between an array and a dictionary is how you get the values in and out of the collection….

How to Use Property Lists (.plist) in Swift

This will be the first in a series of lessons on persistence in iOS applications. Persistence is keep data around even if your app ends. As we’ll see in this series there are many techniques to save and read data. One Common one Apple…

How to Use enum and Enumerations in Swift

Often code needs some way to describe a discrete set of cases. You might need values for breakfast lunch and dinner for example. How we configure a view might be set by one of a few choices. There are many types of UIButtons we…

How to Use Custom Table Cells in a UITableView

While very versatile, there’s some point where every developer finds table views lacking something: the cell format is too limited.  Apps like Facebook, Twitter, and Instagram don’t use simple table views. They use  custom table cell formats.  In this lesson, we’ll start learning how…

Using Trait Collections for Auto Layout and Size Classes

Suppose you have a project with adaptive layout, but you hate storyboards. You’ve coded all your layout and then find something horrible: it only codes well in portrait on an iPhone. You’ve decided that some of the elements need to be in a different…

Auto Layout for XCode 7

I’m pleased to announce that my latest book Practical Auto Layout for Xcode 7 is now available in both Amazon Kindle and iBooks formats. This is an update to my earlier book Practical Auto Layout, with more material to include coverage of the iPad…

How to Add Stack Views Programmatically and (almost) avoid AutoLayout

Some people don’t like Interface Builder and like to code instead. Sometimes your layout is so dynamic you need to lay out in code. In either case, programmatic layout of views becomes the answer instead of auto layout. In Xcode 7 Apple introduced stack…