NOTE: The second installment of this article, “Controlling chaos: Error Handling in Swift 4 with do, try, catch, defer, throw, throws, Error, and NSError,”, has just been released.
In this tutorial, the first in a series of tutorials, we’re going to discuss the arduous topic of looking for unexpected values, events, and conditions that arise during program execution, using a technique I like to call “error checking.” Today, I’ll concentrate on the reasons why you should check for errors. I’ll mention a number of techniques I use but leave detailed discussion of those techniques and sample code to subsequent articles. The purpose of this tutorial is to convince you to make use of error checking in your apps. You ignore errors at your own dire peril. This is sink or swim. If you put out a crappy app, no one’s going to use it because you’ll get a bad reputation at Internet speed, and employers/customers will be more than happy to leave you behind forever for other app developers who aren’t too lazy to write quality code.
Continue reading “Controlling chaos: Why you should care about adding error checking to your iOS apps”
The original article – Protocol Oriented Programming in Swift: Is it better than Object Oriented Programming? – was published on appcoda.com.
We’re going to talk in-depth about protocol-oriented programming (POP) using Swift 4 in this article. This post is the second and final article in a two part series. If you haven’t read the first, introductory article, please do so before continuing onwards. Today, we’ll: discuss why Swift is considered a “protocol-oriented” language, compare POP and object-oriented programming (OOP), compare value semantics and reference semantics, consider local reasoning, implement delegation with protocols, use protocols as types, use protocol polymorphism, review my real-world POP Swift code, and finally, discuss why I’ve not bought 100% into POP. Download the source code from the article so you can follow along: There are 2 playgrounds and one project on GitHub, both in Xcode 9 format and written in Swift 4.
Continue reading “Protocol Oriented Programming in Swift: Advanced Applications”
[Download the full Xcode project from GitHub.]
Today, I’m going to show you how to leverage the Swift “extension” language feature to manage software complexity, improve code readability, and increase extensibility. We’ll also talk about delegates, data sources, and protocols as they are concepts essential to this tutorial. According to Apple’s “The Swift Programming Language (Swift 3.0.1):”
Continue reading “Using Swift extensions to manage complexity, improve readability, and increase extensibility (UICollectionView, protocols, and delegates)”
It can be good to be an iOS app developer, but not easy to be a great one (we’ll talk about that later in this article). There are many opportunities for app programmers looking to work as employees for companies. There are plenty of opportunities for developers who prefer freelancing. It’s frustrating, trying to come up with novel apps that generate any significant revenue, when it seems that every idea under the sun has already been turned into an app by “someone else.” Apple continues to push out buggy versions of iOS, the iOS SDK, and Xcode — especially in early versions of new products. Yet most of us would agree that Apple’s hardware and software, even their development tools, continue to be elegant and cutting edge. It’s hard to argue with the bottom line as “Apple App Store developers raked in $20 billion in 2016, up 40% year over year,” according to an article from CNBC:
Continue reading “2016: A good year to be an iOS app developer (and how to become a better one)”