7 days of WordPress plugins, themes & templates - for free!* Unlimited asset downloads! Start 7-Day Free Trial

Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

4.1 The Swift Standard Library

Like most other languages, Swift provides some basic functionality and types for us to start using right out of the box. While most of the functionality you will be tapping into with Swift will come in the form of the iOS and OS X SDKs, it is still important to have a good knowledge of these foundational concepts.

Related Links

4.1 The Swift Standard Library

Now in this section, we're going to start by learning some of the building blocks, like some of the primitive data types, and some other aspects of what's known as the Swift Standard Library. So, what exactly is the standard library? Well, that's really just a basic feature set, or built in functionality of a language that allows you to get started in building applications. Now, when you typically think of something like the standard library you, if you're like me, start to think back about things like the C++ standard library which, if you recall, was rather large. And, it can be a little bit overwhelming, and a little daunting when you first get started. But, what you're going to notice if you look here on the screen, that I've pulled up the IOS developer library and have pulled up a description. or the information about the Swift Standard Library, and it's actually quite small. So, we have a list of defining types here, we really only have a handful, mainly string array dictionary and a few different numeric types. And then, we have something called protocols, and there's only three built in. And really, what a protocol is, is merely a blueprint of functionality. Whether it be functions, or methods, or properties, or things of that nature, that any sort of classes or structs or enumerations are going to agree to implement should they choose to. And, like I said, there's only three built in. And then, you get a couple of free, we'll say, global functions that you can access that are based around some basic algorithms and printing things out. So, that's pretty much it. And, you might ask, you might ask, why exactly is it so small? Well, quite simply, Apple has spent a lot of time creating a lot of these types and functionality into their SDK. That there's so much there that the language itself needs very little more then some basic things here and there to get started. And then, access to all of those APIs, and all of that different functionality built in that Apple has already taken care of. So, because of that, there's really no reason to duplicate all of that effort within the Swift programming language. So, as you're gonna see here over the next several lessons, we're gonna dig into a lot of these types, protocols and free functions, so that you see what you have to start with. And then, we'll start doing a few more complex things with the language as we build on top of these basic concepts.

Back to the top