Welcome to the Swift programming language. If you’re an experienced programmer, Swift is a great language to add to your toolkit. If you’re new to coding, Swift is terrific as your starting point. In his module, you’ll learn about Swift’s history, including why it was invented and why it’s a great language to learn, especially for beginners. You’ll also learn about Swift’s main goals and objectives as a language.
You’ll also learn about Xcode, the integrated development environment for building projects with Swift, as well as Xcode playgrounds. This is where we’ll spend most of our time learning Swift. You’ll also learn about running Swift in the command line using the REPL in the terminal and with the command line. The REPL is quite handy for testing short bits of your Swift code without having to open or start a new Xcode playground; and using the terminal is a solid skill for any developer.
Learning Objectives
- Understand Swift’s history
- Recognize Swift’s main objectives
- Understand Xcode playgrounds
- Familiarize yourself with Swift and the command line
Skills you’ll gain
Function ModuleFunctional ProgrammingSwift (Programming Language)Swift 3DTutorialsWhat You'll Learn
- Understand Swift's history, including why it was invented and why it is a great language to learn
- Recognize Swift's main goals and objectives as a language
- Use Xcode and Xcode playgrounds as the integrated development environment for building Swift projects
- Run Swift from the command line using the REPL in the terminal
- Test short bits of Swift code with the REPL without starting a new Xcode playground
Key Takeaways
- Swift is suitable both as a starting point for new coders and as an addition to an experienced programmer's toolkit.
- Xcode is the integrated development environment for building projects with Swift, and Xcode playgrounds are where most of the learning in this module takes place.
- The REPL is handy for testing short pieces of Swift code without opening or starting a new Xcode playground.
- Using the terminal is a solid skill for any developer.
- The module covers Swift's history, its main goals and objectives, Xcode playgrounds, and running Swift on the command line.
Frequently Asked Questions
Who is this course for?
It is designed both for experienced programmers who want to add Swift to their toolkit and for people who are new to coding, since Swift is described as a terrific starting point.
What does this module cover?
It covers Swift's history and why it was invented, Swift's main goals and objectives as a language, Xcode and Xcode playgrounds, and running Swift on the command line using the REPL in the terminal.
Do I need prior programming experience?
No. The course welcomes new coders and presents Swift as a great starting point, while also being valuable for experienced programmers.
What lessons are included?
The module includes three lessons: Swift Overview, Xcode, and Command Line and REPL.
What is the REPL used for in this course?
The REPL lets you test short bits of your Swift code without having to open or start a new Xcode playground, and it is run in the terminal from the command line.
Transcript
Show transcript (free preview lesson)
Transcript of the free preview lesson. Remaining lessons unlock with the full course.
Hello, my name is Mark Nair, and in these lessons, you'll learn a Swift overview, Xcode, the command line and the REPL. In this lesson, I'll take you in a short tour of Swift's history. Before Swift people, used Objective-C to write apps for iOS. Objective-C closely related to the C programming language, is more than 30 years old. It was the basis for the NeXTSTEP operating system. Apple acquired NeXT and NeXTSTEP in 1996, and started using Objective-C in its developer toolkit. In 2014, Apple introduced Swift as a modern replacement for Objective-C, calling Swift, "Objective-C without the C." in 2015, with Swift 2.2, the language became open source. This is Swift.org. You can download Swift releases for different platforms here. You can run Swift on the Mac, Linux, and Windows. For this course, we'll be using a Mac with Xcode. Swift comes built in with the Xcode installer, so you don't have to download anything separately. Today, most often people use Swift to build apps for iOS devices in the Mac, although there's a growing movement to use Swift for server side applications. This means instead of learning a handful of languages and frameworks for web development, you can use your Swift skills to rely on just one language, Swift. And now, there's SwiftUI, which is a declarative framework for building your user interfaces on top of your Swift code. The team that created Swift had three main objectives, make a language that is safe, fast, and expressive. Safe, means Swift forces us to write code that has fewer risks of crashing. Learn about type safety and how this will help you. Fast means Swift quickly, can evaluate and iterate over collections of data. It also means it'll use structs to help us with memory use which makes our code faster. And finally expressiveness, means Swift syntax is easy to read and understand. Let's take a quick look at some things that makes Swift, oh, well Swifty. Here's a line of Swift code. It's a perfectly valid line of Swift that compiles perfectly fine. We can import other libraries or frameworks where from the start, we don't need that with Swift, we can just start writing code. Unlike some other languages that require a semicolon to end a line, Swift doesn't, although we could put one here if we wanted to, and that works okay. But in Swift, we like to simplify, so you won't see this business of semicolons at the end of lines. The compiler can read the line breaks just fine without them. Swift is a C-style language. That means that we use curly braces with our code, like this, it's curly brace, curly brace. And when I double click the curly braces, we can see the chunk of code within the braces the compiler recognizes There are other a few C-style techniques, hints, echoes, that you'll learn as we go on. But for now, just keep in mind, Swift has this style as a nod to its heritage and to act as a familiar development language to more experienced programmers. It also is a way that it can wrap our logic into good chunks of code that we can recognize and then work with it. In this course, we'll be using Xcode to write our Swift code. There are quite a few online services where you can write Swift in the browser as well, but Xcode gives us extensive assistance when we're writing our code. Stay tuned for the next lesson where I'll show you more detail about the Xcode interface, and how we begin to use it in our first steps into writing Swift. Thanks for watching.
Learn on the Go
Take your learning anywhere — the KnowledgeCity mobile app lets you watch lessons on the go.