Coding Explorer Blog

Exploring how to code for iOS in Swift and Objective-C

  • Home
  • Apps
  • About
  • Contact

Archives for February 2015

Integers and Numeric Literals in Swift

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

Numbers are the building blocks of any piece of software.  It eventually gets all the way down to our code being translated into a series of numbers that refer to specific CPU instructions and data to use with them.  We will stay well above that level in this post, but I thought it would be useful to share some of the special aspects of how numbers, particularly Integers, are handled in Swift.
[Read more…]

Filed Under: Swift Tagged With: Swift

Swift Set Type

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

In Objective-C there were three basic types of Data Structures, NSArray, NSDictionary, and NSSet.  In Objective-C, the immutable and mutable forms were separate, so you also had NSMutableArray, NSMutableDictionary, and NSMutableSet.  Especially since it is often an interview question, I should point out that a Data Structure is simply “a particular way of organizing data in a computer so that it can be used efficiently.”  You can read that sentence and more at the Wikipedia article about Data Structures.

In Swift we were greeted with Arrays and Dictionaries, but there was no Set to be found!  You had to go back to Objective-C’s NSSet to work with them.  You can read about the other two Data Structures back in the previous posts Arrays and their Methods in Swift and Swift Dictionary Quick Reference.  Well, thanks to Swift 1.2, Set has come to the land of Swift.
[Read more…]

Filed Under: Swift Tagged With: Swift

Multiple Optional Bindings in Swift

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

Shortly after my last post Segue from UITableViewCell Taps in Swift, Apple released Xcode 6.3 Beta 1, which includes Swift 1.2.  There are many updates to the language that I was quite happy about, but let’s talk about my favorite one today, improved Optional Binding.

The new version allows you to bind multiple optionals, as well as check a boolean expression related to them in a single line, avoiding the nesting we currently must do when working with multiple Optional Bindings.
[Read more…]

Filed Under: Swift Tagged With: optionals, Swift

Segue from UITableViewCell Taps in Swift

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

In many apps that use a UITableView, when a UITableViewCell is tapped, the screen will segue over to another view, such as how choosing a song in the Music app goes to the Now Playing screen, and plays that song, shows the album art, and other metadata about the song.  This can be done programmatically in tableView:didSelectRowAtIndexPath:, but with Storyboards, it is even easier.  All we have to do is set up a segue, and treat it pretty much exactly like we did in Segue between Swift View Controllers.

To avoid an even longer setup section, and to not cover things we already covered, we’re going to start with the result of the previous post Getting Started With UITableView in Swift.

Anyway, starting from where we left off, let’s set up the storyboard.
[Read more…]

Filed Under: Tutorial Tagged With: optionals, properties, Swift

Subscribe to the Coding Explorer Newsletter

* indicates required

Follow Us

Facebooktwitterrss

Recent Posts

  • Error Handling in Swift
  • Creating and Modifying a URL in your Swift App
  • Watch Connectivity in Swift — Application Context
  • watchOS Hello World App in Swift
  • API Availability Checking in Swift

Categories

  • Class Reference
  • General
  • Interface Builder
  • My Apps
  • Objective-C
  • Swift
  • Syntax
  • Tutorial
  • Uncategorized

Archives

  • May 2016
  • March 2016
  • February 2016
  • December 2015
  • July 2015
  • June 2015
  • April 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • January 2014
  • November 2013
  • September 2013
  • August 2013
  • July 2013
  • Terms Of Use
  • Privacy Policy
  • Affiliate Disclaimer

Subscribe to the Coding Explorer Newsletter

* indicates required

Copyright © 2025 Wayne Media LLC · Powered by Genesis Framework · WordPress