An introduction to iOS 9 development, using Xcode 7 and the Swift 2 programming language. This course will cover the basics of the Swift language, creating flexible iOS user interfaces that work on multiple devices, seeing how software patterns like Target-Action, Delegation, and Model-View-Controller are implemented in iOS, and exploring best practices for iOS application architecture.
Simon is a staff author at Pluralsight. With a 30-year background in programming and teaching, he obsesses on making complicated subjects accessible, memorable, and easier to learn. Since 2002, he's recorded dozens of popular and highly-rated training courses. His current focus is on iOS and computer science topics.
Getting Started Hi, I'm Simon Allardice, and today I'll show you how to build iOS 9 applications. We are using the most current tools and best practices here, Swift 2 and Xcode 7, and I'll begin with an introduction to Swift for those of you who haven't worked with the language yet. We'll learn how to get around Xcode, see what's available for us to tap into in iOS, talk about constructing these applications, working with data-driven controls, understanding how to use navigation, and to create adaptive user interfaces that work intelligently across multiple devices. And we'll focus on understanding the ideas and the architecture behind it all, what it means to build iOS apps, so you can make the most of brining your existing skills into the Apple developer world. Let's get to it.
Up and Running with Swift If you haven't dived into the Swift language, the next 40 minutes is a fast introduction to the basics, and my intention here is not to be exhaustive, quite the opposite. I don't want to provide all the Swift you'll ever need, I want the minimum of Swift needed to move forward. But, the minimum of Swift is still, some Swift, and while Swift is a very readable language, important features like optionals or the behavior of constants or how conversion works in this language, those aren't things you'll easily pick up from just glancing at some code. If you have experience in Swift already, if you're comfortable with things like type inference, forced unwrapping, optional binding, you could skip to the next module or just consider this a quick recap. Now a few things I'll cover here were new in Swift 2. For those of you totally new to the language, in 2014 we had the first release of Swift and in 2015 we've already jumped to Swift version 2. If your background is in a C-style or C-based language, you'll find this more natural. I'm going to cover the basics of the syntax, and also the dangers of making too many assumptions from other languages. Now not everything is included. Additional Swift will be covered in later modules. So, where do we begin? Well let's imagine that you know Swift is a new language, but other than that you don't know anything about it. You don't even know what kind of language this is. Let's begin there.
Building Single View Applications There are thousands of successful apps in the app store that are basically one-page or one-screen applications were the entire app is contained within the boundaries of what you'd see on that single screen, so we're going to cover the concerns and construction of those types of apps. We'll move to multiple screens later, but this is a great way to get started, because it lets us focus on core ideas of iOS, getting key concepts down. And we're going to see a lot of the word view in this module, because you see a lot of the word view in iOS, single-view applications, view, subview, ViewController, Stat View, Scroll View, view hierarchy, so we want to be clear with what the word view means in iOS, not just conceptually but practically. Now this next module involves all four areas, Swift, Xcode, iOS architecture, and patterns and practices, so let's take each one a little bit deeper.
Creating and Configuring Table Views Every day in which you use an iPhone for more than a few minutes, you end up using a table view control somewhere. They are a classic iOS user interface control, and the first complex control we're going to cover. This module explores creating and configuring them, and it will also let us see the importance of delegation over inheritance when programming iOS. I want to stress that what we're about to cover is not just useful by itself. Now it is useful, really useful, but it's also kind of like learning to drive. If you learn to drive in a Hyundai you can take those skills into driving a Ford or a Toyota, and if you learn how to drive a manual transmission, then getting into an automatic is easy. In the world of iOS controls, the table view control kind of has a manual transmission. This doesn't just work, there's a lot that we need to do with it before it starts moving, but if you know how to use this one and how to extend it, all the others are like driving an automatic. Okay, that's a heavy analogy, so let me show you.
Creating Multiple View Controllers When our application becomes too big to all fit on a single visible area, we will separate things across multiple screens, and I'm using the word screen very informally, multiple screens of content. Now there's a technical aspect here, what do we actually add to the project to keep the right set of logic and data for each one, but beyond that, what's important here isn't just how do we add more screens to our app, it's also how do we navigate, how do we transition from one section of our app to another section and back again in a way that will make sense to a user. A lot of the choices we're going to make here are less about technical limitations, and more about the nature of our app. Are we moving from screen to screen because we're drilling down into a hierarchy of nested information, or is it just because our app does five very different things and we need to switch from one to other? So we're going to cover creating multiple screens or View Controllers here, and then transitioning or segueing between them, wrapping navigation around them, and also see what's provided for both the built-in controls and even sample project templates to help us with this.