Category Archives for iOS

Strings and Characters in Swift

A Swift string is a series of characters. String is its own type in Swift, not simply an array of characters as it is in C. Further, strings may contain or be composed entirely of Unicode characters, so the length of each character may vary. Swift string literals are enclosed in double quotes: “Hello, Frog!” […]

Read More...

Optionals in Swift

  Imagine we’re standing next to the river, looking out over the lily pads, and there are no frogs on any of them. We might represent this by var frogsPerLilypad = 0 which means, “there is an integer number of frogs on each lily pad, and that number is currently 0.” But what if we wanted […]

Read More...

Swift Integer Types

The concept of variables and constants is common in programming languages: a variable is a named memory location whose value may change over time, a constant is a location whose value will not change. In Swift, we declare variables using the keyword var, and constants using the keyword let.

Are you typing along in […]

Read More...

Dictionaries in Swift

A dictionary is a collection of keyed values. Each value in a dictionary must be of the same type, and all the keys must be of the same type, but the keys and values can be of different types (from one another). For example, we could have a dictionary of pirates listed by their UPC1 […]

Read More...

Functions in Swift 2

Functions are reusable pieces of code that perform a specific task. They take input, do something with it, and either change some value, print something out, or output a result. Swift’s functions are like functions in any other programming language in this way, so if you’re familiar with functions in C or another language, much […]

Read More...

Swift Arrays

The following is an excerpt from a book I’m writing on iOS 9 development.    An array is a collection of elements, all of the same type, each of which has an index. Elements in an array are therefore ordered by their indices. If we’re collecting frogs (oh, no, not more frogs… please…), we might organize […]

Read More...

Curried Functions In SWIFT

Currying can be a difficult concept to grasp. Let’s start with a simple example.  

  That’s easy and straightforward sum function. If we just look at type of function sum, we can see that it has a type of (Int, Int) -> Int. So it takes 2 parameters of the type Int, and […]

Read More...

Indexed Table Views In Swift

Let’s start creating a new project in Xcode. We will start with Single View Application Template. In Xcode go File->New-Project in the menu and choose a Single View Application template.   Fill in Product Name. Then choose where your Xcode project will be stored. Now in ViewController.swift class change base class from UIViewController to UITableViewController. […]

Read More...

Creating Grouped Table Views In Swift

Let’s start creating new project in Xcode. We well start with Single View Application Template. In Xcode go File->New-Project in menu and choose Single View Application template. Fill in Product Name. Then choose where your Xcode project will be stored. Now in ViewController.swift class change base class from UIViewController to UITableViewController. In Main.storyboard remove existing […]

Read More...

UIAlertController in iOS 8

If you’ve developed for iOS in the past using Objective – C, you’ll remember creating alert views and action sheets using the UIAlertView and UIActionSheet classes. In iOS 8, these classes have been deprecated in favor of the new UIAlertController class. In this blog, we’ll take a look at how to present both alerts and action sheets with UIAlertController.

Read More...
1 2 3 32