Check out a free preview of the full iOS App Development with Swift course

The "Swift Overview" Lesson is part of the full, iOS App Development with Swift course featured in this preview video. Here's what you'd learn in this lesson:

Maximiliano provides an overview of Swift, including who developed it, its type of language, available platforms, and the included null-safety. A discussion regarding language types, what type of application will be created, and the contents of the resulting project ZIP file are also covered in this segment.

Preview
Close

Transcript from the "Swift Overview" Lesson

[00:00:00]
>> Let's start talking about the language, Swift, okay? That's the icon, that's the logo, the little orange bird. So Swift was created by Apple a few years ago, it was actually a complete surprise. No one was actually waiting for that. At WWDC, the Apple annual event, they came with the idea that, we have a new language.

[00:00:26]
Because at that time Objective C, by the way, Objective C was created in the 80s, okay? Was actually looking we're for most developers, so that's why they created Swift, okay? So just make a new step. But it's not like any other Apple product that they're used to, it's open-source.

[00:00:47]
So it's actually an open source language. So Apple is actually the main promoter of the language but there is a consortium that is actually upgrading the language or evolving the language as other languages such as the ACMA script and many other things. And there are other big companies behind Swift not just Apple, for example IBM.

[00:01:10]
IBM is also supporting Swift a lot and actually you can bright backhand Swift code in the IBM Cloud and also another cloud systems but because it's open source today you have a compiler for Linux. So that means that you can actually run Swift code on any server and that means you can do back in Swift as well.

[00:01:35]
It's on a statically typed language. So if you coming from JavaScript, that sounds scary, the first time. That means that if you have a variable that variable will need to have a type define. If it's an integer, it's an integer, you cannot insert something else there, okay? However, it also has something known as type inference and we will see this in a minute in action.

[00:02:01]
Type inference means now happy face. So if you were with sad face because it sounded statically typed language with type inference we go back to a happy face. Means that most of the time you don't need to actually explicitly say what type do you want to use. It will look like JavaScript but have in mind behind the scenes every variable has a type define.

[00:02:30]
It's mult-platform as we mentioned before. Swift as a compiler for Apple platforms, that's Intel based and also the Apple platform like the new M-1 chips. But also the previous Apple platforms that you have perhaps on an iPad, those are not Intel based well actually the Swift compiler will compile code for those platforms.

[00:02:55]
But also we have a compiler for Linux as I mentioned before. So it's multi-platform. It's easy to learn. So, in the next probably hour, you will get the full idea of Swift. We cannot go into covering 100% of Swift with just an introduction, but you will feel at home most of the time.

[00:03:19]
So it's easy to learn in this, let's say in this decade. So it's less ceremonial, okay? That means that there are a lot of code that we write every day and Swift is trying all the time to make that code shorter, with less code, less bureaucracy, that kind of idea.

[00:03:46]
Got some modern ideas implemented and we're going to see that later. So I'm not sure if this but a lot of languages, a lot of platforms are actually getting out of the official classic OOP, Object Oriented Programming. Like everything must be a class like in Java. So, we're getting out of that.

[00:04:08]
So maybe we're going to use OOP when we feel, okay we need that, but also we have other options. And it includes no safety. And for some of you or most of you, this is kind of new, okay? So we will have some minutes talking about this. But actually, this is good news, because it's reducing the amount of bags that our code will have, okay?

[00:04:36]
The famous new pointer exception, a new reference exception. I'm not saying it's not gonna happen here, but it's going to be reduced a lot, thanks to new safety. And it's multi-paradigm, okay? So if you wanna write an OOP, you can do that. If you wanna do linear programming, it's okay, you can do that.

[00:04:57]
Event-based programming, you can do that. Functional programming. Protocol-based programming, we're going to see what it is later. So it's multi-paradigm, you pick the paradigm that you want to use. And of course you can mix and match. It's not just OOP or prototype-based like JavaScript. You can pick the best for your project.

[00:05:22]
So, before actually seeing some code, today we have some language types. So for example, in some languages developers write source code in interpreted languages and then you ship source code. I mean, the most common example of these kind of languages today is JavaScript. Okay, you ship source code.

[00:05:49]
Even if you are transpiring that code or doing some magic with that code anyway what you are shipping is JavaScript, okay? I'm taking web assembly out of the equation. Another kind of language today is intermediate languages, that when you need to compile your app and you're going to ship something known as Bytecode.

[00:06:11]
That is not actually the final machine code that is going to be executed by the machine, we are writing code for a built on machine. The most common one is the Java built-on machine, also .NET. It's another example of JVM. We can also say that JavaScript if you have just in time compilation can get there but I'm not going to get so deep on that.

[00:06:36]
And then we have compiled languages, where we actually need to ship machine code. And if you're going to compile code for Intel-based chips, Intel-based CPUs, it works only on Intel, okay? Not on another platform. So actually this is where we are right now with Swift. Swift is a compiled language.

[00:07:01]
We are going to compile code, okay? I know that if you are a full stack developer, if you are just doing web, that also sounds scary, it sounds like, I don't know C or something like that. But it's also complicated. There are some differences when we're doing these kinds of apps but it's not a big deal, okay?

[00:07:22]
But Swift is actually a compiled language, okay? And what we're gonna be building are actually iPhone applications. So the result of our project is gonna be an IPA file. It's an iPhone application, actually even if it works on iPad, it's called an iPhone application because they created this file format when the iPhone appeared.

[00:07:48]
So, the IPA file is just a ZIP package, so you can actually unzip it and see what's inside after you build it. So, it includes our compiled Swift code, meta data, we're going to see what meta data is, and assets. Images, icons, PDF, whatever we're shipping with the ABI can also be HTML if you want, you can actually ship a web app.

[00:08:13]
In fact, if you have phone gap or hybrid elements, this is how it works, okay? So you ship in the assets a web app, HTML, CSS and JavaScript. So that's what we're going to build. And that iPhone application, and this is important, is installable only officially through the App Store, okay?

[00:08:34]
So you cannot send the IPA file to another person through email and ask them to install that through USB cable or something like that, or directly from the mail application. It doesn't work like that, okay? On Android, you can, let's say decrease security and then you can install an IAPK that is not coming from the store, but that's not gonna happen so simply on iOS, okay?

[00:09:07]
So you actually need to publish that app to the App Store. Also you have enterprise distribution. So if you're making apps for a corporation, for a company that has employees with iPhones or iPads, well actually you can ship an internal app that is not actually public so it's not in the App Store.

[00:09:26]
And for us we can also install our app in our iPhone or iPad. If you have an iPhone or an iPad, you will be able to install your app from Xcode, okay? But only on your development computers or your developer devices, that's kind of the idea, okay? That means that if you're going to make a Swift application like the one that we're going to do today and you wanna share that application with others, you actually need to technically use the App Store.

[00:10:02]
The App Store has something known as TestFlight inside, TestFlight lets you create some alpha testing and beta testing programs. So you can actually share your app with other users without actually making the app public for everyone, okay? But for that, you will need to pay for an Apple Developer Account and follow some rules.

[00:10:27]
To test on your own iPhone, your own app, you don't need to pay anything

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now