
Learn the basics of Swift programming, including variables, data types, operators, conditionals, loops, functions, arrays, structs, and optionals, using Xcode on a Mac.
Explore the Swift programming language, its Apple origins and native use for iPhone, iPad, Mac, Apple TV, and Apple Watch, its open-source history, server-side applications, and installing Xcode.
Install Xcode on a Mac from the App Store, note its large size and required disk space, update if needed, and install extra components to reach the welcome screen.
Explore Xcode Playgrounds, an interactive environment to write Swift and see real-time results, and learn to create your first playground named MyFirstPlayground in a blank iOS template.
Open a new Xcode playground and write your first Swift line with print to display text in the debug area. Use lowercase with double quotes and parentheses for valid syntax.
Learn how Swift syntax governs program structure, why syntax errors stop execution, and common mistakes like unterminated strings, missing closing parentheses, and case sensitivity in print commands.
learn to use swift playgrounds to perform basic arithmetic, create a calculator playground named Calculator, run code to see results, and print numbers to the debug area.
Declare variables in Swift with the var keyword and assignment operator, then use length to calculate area and perimeter of a square and show that a variable value can change.
Learn to compute a rectangle’s area by multiplying length and width, diagnose the int–double type error in swift, and resolve it by using doubles (e.g., 5.0) to obtain 12.5.
Discover how Swift's type inference lets the compiler infer Int, Double, and String from initial values, view types with type(of:), and explore explicit type annotations.
Master explicit type annotations in Swift 5 for absolute beginners by placing a colon after a variable name to declare Int, String, Double, and Integer, and learn when they're useful.
Declare a variable x with 7 and show Swift infers it as Int, by type(of:). Reassign 5, but 3.5 triggers a compiler error, proving the type is fixed after declaration.
Learn how constants store unchanging data in Swift, using let to declare fixed values like birth year while variables use var for values that change.
Learn how to name variables and constants using descriptive lowerCamelCase with allowed characters like Unicode and underscores, allow numbers but not as first character, avoid whitespace, and limit emoji usage.
Define data type as the set of values and operations, describing the kind of data. Learn about Swift’s built-in data types for numbers, strings, and booleans.
Discover how Swift handles integers with Int, using type inference and annotations, and compare Float and Double for decimals, noting Double as the default and Float for limited precision.
Explore how strings represent text in Swift, using the String type, double quotes, type(of:), and triple-quote multiline strings that preserve line breaks.
Learn to use booleans in Swift by exploring the Bool type, which stores true or false. Apply booleans in conditionals and loops to control program flow.
Learn how comments describe what the code does and help maintain and debug Swift programs. Discover single-line and multiline comment syntax, using // and /* */.
Learn how Swift uses operators to perform operations on values, from arithmetic and assignment to comparison, logical, and bitwise operators, enabling you to check, change, and combine data.
Explore Swift's arithmetic operators, including addition, subtraction, multiplication, division, and modulo, and see how 7 modulo 3 equals 1, with operators applicable to all number types.
Use the assignment operator in Swift, where the equals sign assigns values to variables or constants, updates values, and shows compound forms like addition, subtraction, multiplication, division, and modulo.
Explore how Swift comparison operators evaluate integer values: equals, not equals, producing boolean results; compare scores with less than, greater than, less than equals to, and greater than equals to.
Explore logical operators in Swift, including logical not, logical and, and logical or, and see how they modify boolean values using examples like isenteredcorrectpasscode, isfacialrecognitionmatched, and isallowedentry.
Learn to handle strings with quotes by using backslashes as escape characters. Print strings that include quotation marks, and use \n to create new lines.
Learn how to create multiline strings in Swift using three double quotation marks, including line breaks and embedded quotes without escaping.
Learn how to concatenate strings in Swift with the + operator and the += append operator, and why appending to a string constant triggers an error.
Learn string interpolation in Swift by embedding name and age into strings with a backslash and parentheses, like John is 23 years old and 5 times 7 is 35.
Use the Swift if statement to run code blocks only when a condition is true, understanding the if keyword, condition, and curly brace syntax with score and key-check examples.
Learn how to extend an if statement with an else clause, running different code when conditions are true or false, with examples showing welcome and thanks messages.
Learn to control flow with if, else if, and else in Swift by checking conditions, executing code when true, using else if for additional checks, and else for remaining cases.
Learn to enforce access with two-stage verification by combining passcode and facial recognition using the boolean and operator (&&) in Swift.
Learn to use the while loop in Swift to print numbers 1 to 10 by repeating a code block while a condition is true, incrementing the counter each iteration.
Use the break statement in Swift to exit a loop early when the counter reaches 10, printing 0 through 9 and then continuing after the loop with 'no more loops!'.
Skip a loop iteration with the continue statement in Swift, ending the current iteration and advancing to the next. The example uses counter modulo 2 to print only odd numbers.
Define a function as a reusable block of code that prints text. Declare it with the func keyword, name it sayHi, and call it with parentheses to run 'Hi there!'.
Discover how to define and call a Swift function with an input parameter, using oddOrEven to determine and print whether a number is even or odd.
Learn to write a Swift function with multiple parameters, including player1Score and player2Score as Int, to compare them, print the winner, and call it with two integers.
Learn to write a swift function that returns a value using the return keyword and a double return type, demonstrated by calculating a 10% tip from a bill amount.
Explore how optionals in Swift represent absence of a value by wrapping a value or nil in a box, for any data type, and unwrap before use.
Discover how the optional type stores a value or nil, using question marks to declare optional Int and String. Learn to unwrap optionals before using their values.
Declare an optional int and print it as a boxed value, then unwrap the inner value. Use force unwrapping cautiously and prefer an if check to avoid nil crashes.
Discover how optional binding unwraps optionals safely in Swift, accessing values with if let and an optional else block, demonstrated through unwrapping x and message values.
Learn how arrays store values of the same type in an ordered list, using a numbers array to show zero-based indexing, access by index, and type inference with Swift 5.
Learn how to modify a variable array in Swift by updating values by index, appending and inserting elements. Remove elements using removeFirst, removeLast, and remove(at:).
Access values by index and iterate with a for-in loop over the shoppingList array. Print each item to the debug area.
Explore how Swift dictionaries map player names to scores with string keys and int values, access by key, and handle optional nil when a key is missing.
This course will teach you how to write code in Swift programming language.
You don’t need to have any prior programming experience. We will start from the very beginning and teach you the basic concepts of programming.
This course has lots of code examples.
There are quizzes associated with the lessons. By taking the quizzes, you will have a clear conception about the lessons.
Programming is a never-ending skill that you need to develop. You can learn programming at any age. You just need to focus on learning and then keep practicing what you learn. Your age or existing skill level doesn’t matter. With practice, you can be a good programmer.
This course is for complete beginners to programming. We will start by guiding you through the steps necessary to write your first line of Swift code. To write Swift code, we need Xcode. So we will show you how to install Xcode. Then you will be introduced to concepts like variables, constants, data types, operators, conditionals, loops, functions, arrays, dictionaries, optionals, structs and more. All the code in the course works inside of Xcode’s easy-to-use playgrounds.
Swift was developed by Apple and was first introduced at Apple's 2014 Worldwide Developers Conference. Swift is primarily used for building apps on Apple platforms. It’s the native language to build apps for iPhone, iPad, Mac, Apple TV and Apple Watch. Swift version 2.2 was made open-source in December 2015.
If you want to build native apps for Apple platforms, then Swift is the language you would use. Swift is also being used for building server side applications. Swift is easy to learn and friendly to new programmers. It’s a safe, fast, and interactive programming language.