Kevin McNeish is author of the new book “Learn to Code in Swift” as well as the “iOS App Development for Non-Programmers” book series (www.iOSAppsForNonProgrammers.com), winner of the Publishing Innovation Award. Kevin is also an award-winning app developer, software architect, and conference speaker in the U.S. and abroad. He has spent much of his career making difficult concepts easy to understand. Follow Kevin on Twitter: @kjmcneish.
As promised, Apple has delivered its first version of WatchKit, which allows you to create apps for the upcoming Apple Watch. In a surprising move, Apple released information regarding its new WatchKit in a web page open to the general public.
Swift's advanced collections can help you model more complex objects in your apps and create an API that is easier to understand and use. In this post, I model a chessboard using Swift's subscripts and also cover tuples and multidimensional arrays!
In part 2 of this post on Swift's protocols, you will learn practical uses for declaring custom protocols in your own apps, and learn further how they improve the architecture of your apps and make them easier to enhance and extend.
In part 1 of this post, I demonstrated how to implement existing Cocoa Touch protocols in your apps. Now you'll learn how and why to create your very own. First, we need to cover the basic construction of a Swift protocol.
Protocols are a powerful, advanced tool that help make your apps easier to design and extend. They define standard behavior in classes that are not necessarily related. Protocols used together with delegates allow you to create classes with a well-balanced load of responsibilities.
In previous posts I have touched on inheritance in Swift. In this post, I'm going to be diving deeper and giving you a fuller picture of how inheritance works in Swift, and how you can use it to create apps that are easy to extend when you need to add new functionality. Along the way, you will also learn about the important concept of polymorphism and learn how to use Xcode's new playgrounds!
If you have read Apple's documentation on Generics and were left wondering how you could use this technology in your own projects, this post is for you! You will learn how to take full advantage of generics in your every-day code as well as how to avoid the constant type-casting that usually results from creating generalized code.
Access Control is one of the late-breaking features added to the Swift language. It allows you to specify the parts of your code you want to make public, and the parts you want to hide. It's an important tool in creating easy-to-use, and easy-to-understand interfaces.
In this second part of my two-part post on Demystifying Swift's Initializers, I explain the concepts of initializer chaining, two-phase initialization, and initializer inheritance using hands-on examples that walk you through some of these deeper concepts. You can read part 1 of this post at this link.
If you would like to follow along and perform the step-by-step instructions with this post (highly recommended) you can download the project we have completed so far at this link.
Now that Apple has officially released Xcode 6 and the NDA has been lifted, it's time to dive deeper into Swift—Apple's new language for building iOS apps. Learning how to properly use initializers in Swift can be daunting at first. Swift's requirement that all stored properties in a class are initialized adds complexity to the initialization process. In the first part of this two-part post I'm going to demystify initializers as I provide a hands-on approach to learning how to best implement initializers in your custom classes.