Author: Matt Doyle

Hi, I’m Matt. I’m a web designer, entrepreneur and quantified selfie.

Basic URL access and display

Set up

  1. Allow Xcode to make non-secure http requests
    1. Open Info.plist
    2. Add new key “NSAppTransportSecurity”
    3. Change object type to “Dictionary”
    4. Add a new item to “NSAppTransportSecurity” key’s dictionary (by clicking the down array of “NSAppTransportSecurity” and clicking “+” on that key) called “NSAllowsArbitraryLoads” with type “Boolean” and set value to “YES”
  2. Add a “Web View” object in the View Controller
  3. Create an IBOutlet for the Web View object


To point our Web View object to a particular address, we can simply place the following in the “ViewDidLoad()” function:


Downloading the data of a URL to our app is a little different:


There is beauty within

We cannot appreciate what we don’t understand.

Consider a game of chess, midway through a match.

An observer unfamiliar with the game may see a chunk of checkered wood with a few figures placed haphazardly atop.

A seasoned chess player may instead see the deep array of patterns connecting the remaining pieces, admiring the subtle strategies in place.

Only when the intricacies are understood does the game become beautiful. 

To understand our world is to unlock the beauty within.

Beyond the Book: Geek Sublime

Beyond the Book is a series of essays, each inspired by something I’ve read. This essay was inspired by Geek Sublime – Writing Fiction, Coding Software by Vikram Chandra.

Consider Hemingway’s 6 word story:

For sale:

Baby shoes. Never worn.

Look beyond the explicit, what do the words imply? How do they make us feel?

Words to a writer are the foundation of suggestion. Enough blocks are placed that the shape is implied, though not quite complete. We fill the gaps with snippets of our imagination, we make the story our own.

Imagination is unique, a construct of individual experience. We look within for meaning and then project it back on the words. We experience the narrative as an extension of ourselves, the protagonist is us in a different circumstance.

A story has as many connotations as it does readers. The story becomes our story.

Deleting a row from a Table View

This code allows the user to swipe right on a table and delete an item.

Insert the following into the class file controlling the Table View:


Creating a Table View

The following instructions allow you to add a scrollable Table View to your app.

Set up

  1. Insert a Table View Controller (or drag a Table View into a View Controller)
    1. If a Table View Controller is used, the dataSource and delegate outlets are already defined
    2. If using a Table View inside a View Controller
      1. Link the Table View to the View Controller in Storyboard using control+drag for both the dataSource and delegate outlets.
      2. Declare “UITableViewDelegate” in the View Controller class file (this allows you to control the table from your View Controller).
  2. Add a prototype cell and give it an identifier, e.g. “Cell”. This allows you to specifically refer to that cell type in your code, and give it different attributes to other cells if necessary.
  3. Create an IBOutlet for the UITableView in the class file controlling the Table View (this allows us to refresh the table when it’s values are changed).


Insert the following into the class file controlling the Table View:


Permanent Storage

The following code allows you to permanently save data to the users phone, so that it will still be there the next time the app is run. Note, the data in permanent storage should be updated each time the data is changed to ensure the latest information is saved in the event of a crash or application exit.

Insert the following into func viewDidLoad():


Hide keyboard

These instructions allow you to hide the keyboard when the user presses a return-like key, or taps anywhere outside of the keyboard.

Set up

  1. Declare “UITextFieldDelegate” in the class file containing the text field input box.


Insert into the class file containing the text field input box.


Unwrap protection

This snippet protects your code from unwrapping values of an invalid type, specifically when entered by the user. An else statement can also be added to alert the user of incorrectly entered data, is desired.


Check for nil value

This snippet will stop the code within from executing if a certain variable is empty. This is helpful in cases where we aren’t sure if our variable will always have a value.

Replace valueToCheck with the appropriate variable you wish to use.

A question may have many answers, all correct

Two people are going about their day today, each with similar lives.

The first believes they need more. A bigger house, more money, more friends, another promotion. 

He thinks he is unhappy.

The second believes they have enough. A roof over their head, affordance of food, a few close friends, a job.

He thinks he is happy.

Both are correct.