Table of Contents
Introduction
Introduction
Maximiliano Firtman introduces the course by providing some personal background with mobile development and discussing an overview of what material will be covered in this course. Pre-requisites, a frontend map demonstration, and a brief discussion of the UI frameworks available to use with Swift are also provided in this segment.Course Project Files
Maximiliano walks through the provided course project files and demonstrates a finished version of the course project.Swift Overview
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.
Basics
Basic Expressions
Maximiliano demonstrates writing basic Swift expressions in an Xcode playground, including booleans, C-syntax, variables, data types, and valid identifiers. Everything declared in Swift is accessible to every other file in the project.Variables
Maximiliano discusses defining variables in Swift, including constants, types, explicitly defining data types, and core data types. Swift will infer and enforce variable types but can be overridden with the Any keyword.Null Safety
Maximiliano discusses the concept of Null Safety, Null-safe operators, and how to treat properties as optional using a question mark or non optional using an exclamation mark. The functions of other operators, including the safe operator, default values, and explicit optional unwrap, are also covered in this segment.Functions
Maximiliano demonstrates writing functions in Swift, setting function return types and the option to omit the return keyword. How to utilize Xcode to help troubleshoot argument errors and how to handle optional arguments when defining a function are also covered in this segment.Closure
Maximiliano discusses Swift closures as literal functions, anonymous functions, or lambda expressions in other languages. The data type Void being used to express no return value and the syntax for functions receiving closures as arguments are also covered in this segment.Custom Types
Maximiliano walks through defining custom types and classes, briefly discusses structures, enums, and protocols, and demonstrates using the self keyword in place of JavaScript's this keyword. Swift has full support for OOP, and classes can be extended.Structs, Protocols & Errors
Maximiliano answers student questions regarding having structures instead of tuples and if classes are more efficient than structs. A walkthrough of error management using do, try, and catch is also provided in this segment.
SwfitUI Overview
Swift UI Overview
Maximiliano discusses an overview of the multi-platform declarative UI framework Swift UI. Swift UI can use single or double-way data binding to re render dependencies.Creating the Project
Maximiliano walks through creating a new project in Xcode using the iOS App template and selecting SwiftUI as the interface type. A demonstration of some features of the Xcode user interface is also covered in this segment.Build & Run App in Simulator
Maximiliano demonstrates editing the metadata of the course application and how to run the application through an iOS simulator. The iOS simulator will run using the computer's processing power, not an iPhone, and therefore may not accurately show application performance.Creating Reusable Views
Maximiliano discusses the function of the some keyword regarding multiple Scenes and demonstrates having multiple content views using the Xcode previewer. The View of the body must return only one view, which will result in two simulators unless adequately grouped.Modifiers & Inspector
Maximiliano demonstrates how to use modifiers to create a new version of a text object with the modifier applied; the inspector can also be used to edit modifiers. Modifiers are applied in a chain, meaning each subsequent modifier is layered on top of the result of the previous function.Binding Data to Views
Maximiliano walks through how to bind data to views to pull in variables and change dynamically on user input. Binding data to a view allows each view instance to be reusable.
SwiftUI Concepts & View Types
Concepts & View Types
Maximiliano briefly discusses an overview of SwiftUI's main concepts, including app, scene, view, view modifier, dependencies, dimension unit, and graphical assets. View types covered include text, label, button, the various types of stacks, and spacer.Offer
Maximiliano walks through creating the first view of the course project to represent an available discount offer and demonstrates how to create multiple previews by copying the same view. A student's question regarding how the structs defined in offer get imported to ContentView is also covered in this segment.Colors
Maximiliano demonstrates how to create and utilize a referenceable color library in Xcode. The created color library will allow colors to be dragged and dropped into the code as modifiers.Images
Maximiliano walks through how to create a new reusable image asset. It's better to have three different-sized png images to render the correct quality at different screen sizes.Navigation Tabs
Maximiliano demonstrates creating an interactive bottom navigation bar and finding the appropriate icons using SF Symbols. The tabs created in this segment will switch between application pages.Creating Page Views
Maximiliano demonstrates how to group files in Xcode and create the three remaining application pages. A student's question regarding the difference between assets and preview assets is also covered in this segment.Creating Data Model
Maximiliano walks through creating and connecting the category and product data models to allow importing dependencies. MenuManager and CartManager classes are also created to help download and store the application content.Environment Objects
Maximiliano demonstrates using View structure objects called environment objects to avoid passing data manually as properties. Environment objects can be injected at any level.Shopping Cart & Refactoring Views
Maximiliano demonstrates adding content to the shopping cart page and an Xcode error message.Adding Alamofire Package
Maximiliano walks through adding and importing a dependency called Alamofire which is used to download JSON from an API.
API Data
Using the API Data
Maximiliano demonstrates how to pull in the data being stored in the managers to populate the menu items. Editing the product prices to the correct decimal points is also covered in this segment.Cart & Badges
Maximiliano implements add and remove functions to allow items to be added to and removed from the cart. Updating the cart total and badge showing the number of items are also covered in this segment.Cocoa Pods
Maximiliano demonstrates utilizing an environment variable to inject variables from the OS. Student questions regarding why Alamofire was used and not CocoaPods and the benefits of using Alamofire are also covered in this segment.Connect SwiftUI with UIKit
Maximiliano demonstrates integrating a website or web app with SwiftUI and UIKit. A student's question regarding if this process is how cross-platform applications work and a brief demonstration of running JavaScript code is also covered in this segment.Launch Screen
Maximiliano walks through adding an application icon and rendering a launch screen to display a splash screen when the application launches.Final Build
Maximiliano demonstrates how to make the final build through Xcode and distribute the app to the App Store. A student's question regarding how to run the application on a personal device is also covered in this segment.