
This welcome lecture explains how to use this course as a reference library for SwiftUI and iOS 18. Follow along with working examples, open Xcode, and download code to practice.
Explore how SwiftUI simplifies cross-device app development for iPhone, iPad, Mac, Apple Watch, and Apple TV, and learn the setup requirements including macOS Sequoia, Xcode 16, and Apple developer accounts.
Understand how Xcode serves as an integrated development environment with an editor, SDKs for Apple platforms, and compilers for Swift, C, C++, and Objective-C; download from the Mac App Store.
Learn how development APIs, frameworks, and libraries power Swift and Objective-C apps with Xcode and LLVM compilers, translating code into executable programs for devices and simulators.
Explore how a computer executes a program as a sequence of instructions, use Xcode playgrounds to learn and test code with templates, and manage data in memory using variables.
Explains how variables represent values in memory, how to declare with var, initialize and assign, and how let constants, int/uint/float/double types, type inference, and arithmetic work.
Explore Swift data types beyond primitives, including characters, strings, booleans, optionals, and tuples, with Unicode, string interpolation, escaping, and multi-line capabilities.
Explore conditionals and loops in Swift, using if-else, comparison and logical operators to control flow. Learn optional binding, nil coalescing, and ternary operators to unwrap optionals and write concise code.
Learn to use the switch statement to replace long if-else chains with exhaustive cases, default handling, and advanced pattern matching for tuples, strings, and where clauses.
Master while and repeat while loops to execute blocks until a condition fails. Also learn for-in loops to iterate over strings, build message with characters, and apply a ternary check.
Master Swift control transfer statements - continue, break, and guard - and see how they interrupt loops and switch statements, while guard lets you read variables outside their blocks.
Explore programming paradigms from object oriented to protocol oriented programming, and learn how objects, structures, enums, and protocols shape Swift code.
Learn about overloading and generic functions in Swift by using the same function name for different parameter types, with generic data types converted to the received type at call.
Explore Swift's standard library functions, from print and error handling with fatalError and precondition to creating sequences with repeatElement, stride, and zip, using for in loops.
Explore blocks and scope in Swift, showing how global space and local space isolate variables and constants, and how inner declarations remain inaccessible from outside in a while loop example.
Explore closures in Swift as independent blocks of code with their own scope, assignable to variables, executable on demand, and passable from functions using trailing closures and shorthand arguments.
Learn how structures use the struct keyword to define custom data types with properties and methods, create item instances with dot notation, and handle optionals with optional chaining.
Explore key paths in Swift to reference properties, enabling passing references through structures. Distinguish read-only and writable key paths, and learn syntax for accessing and modifying properties via key paths.
discover how methods add code to structures, enabling dot-syntax calls that calculate totals and simplify usage. use mutating methods to update properties when needed.
Explore how to initialize structure instances using memberwise initializers and custom init methods, including multiple init options with labeled parameters and practical examples like USD and CAD values.
Explore computed properties that derive values from other properties using get and set, including read-only variants, with an example converting USD to CAD via a rate.
Explore property observers in Swift by watching how willSet and didSet run before and after price updates, updating increment and old price accordingly.
Explore type properties like currencies and methods in Swift structures using static, enabling access from the type itself and creating instances via type methods like reserved, without creating an instance.
Explore generic structures in Swift, learn how to declare type parameters, instantiate with different values, and constrain generics with protocols for flexible data handling.
Master primitive type structures in Swift, wrapping data and functionality with initializers and casting. Learn about properties, methods, min and max, rounding, and string-to-number conversions.
Explore range structures in Swift, including open and closed ranges, one-sided ranges, and range operators, and apply them in for-in loops, switch statements, and random number generation.
Explore string structures in Swift, create strings with literals or the string initializer, manipulate indexes, insert, remove, and replace subrange, and convert values to strings with Unicode aware methods.
Explore Swift arrays as ordered collections of values and learn to read, modify, and manage their elements using indexes, count, and common operations like append, remove, and replace subrange. Discover advanced techniques with array slices, multidimensional arrays, and methods such as map, filter, reduce, and sort to transform and query data.
Explore set structures in Swift, focusing on unordered, unique elements and set operations such as contains, insert, remove, union, and subset checks.
Explore dictionary structures in Swift: define custom keys and values, read and update elements, handle optionals, iterate with for-in, group values, and sort dictionaries.
Explore enumerations in Swift by defining enum types with cases, initializing and assigning values using dot notation, and controlling flow with switch statements.
Explore raw values in enums, including default zero and custom assignments. Learn to add properties, methods, and initializers inside an enum, and use self to access the current value.
Explain associated values in enums, attaching values to cases like number (int, string) and letter (character, string). Demonstrate extracting these values with switch or if.
Explore how objects are data types that encapsulate data and functionality through properties and methods, stored by reference, with classes defining the objects and instances created from them.
Explore type properties and methods in structs and classes, accessible from the type itself, not instances. Learn that static members are immutable, while class members can be modified by subclasses.
Learn how reference types differ from value types: structures and enums copy on assignment due to the Copyable protocol, creating instances, while objects are passed by reference and share memory.
Explore how self references objects in Swift, clarifying property versus parameter names. Learn how meta types use self to reference the type itself and create instances.
Explore how automatic reference counting manages memory by counting references and deleting objects when none remain. Learn how strong reference cycles occur and how weak and unowned references break them.
See how a subclass inherits properties and methods from a superclass to enable reuse. The office employee example shows overriding and the super keyword to add department to create badge.
Explore type casting and class hierarchies: use is and as to identify and cast subclass objects stored in a superclass array, with optional binding and generics like any object.
Learn how class initialization works in Swift, including designated and convenience initializers, inheritance, and the order of initializing properties before calling super in subclasses.
Explore deinitialization in Swift under arc, and how memory management removes objects. Use the init method to run last-minute setup before an object is erased.
Explore swift access control and modifiers, including lazy properties, private and public access, and singletons with a shared instance and main actor to prevent data races.
Explore how Swift protocols replace traditional class-based inheritance by defining shared properties and methods that structures implement, enabling code sharing, delegation, and a common blueprint across types.
Define protocols with the protocol keyword and braces, using get and set to indicate access; illustrate with a printer protocol and conforming structs, stored in a printer type array.
Explore generic protocols by defining an associated type and implementing it in a struct that conforms to a protocol, such as a printer protocol and employees struct.
Learn how Swift protocols enable value comparison with Equatable, apply type constraints to generic functions, and implement Hashable and Comparable for custom types.
Explore how extensions add shared functionality to protocols and other types, including conditional where extensions and customization of string interpolation to extend existing types like int.
Explore delegation using protocols to assign printing tasks to different delegates, enabling salary data to be shown by any conforming type, with examples of salary protocol and multiple delegates.
Learn error handling by throwing with throw and throws, using an error enum that conforms to the error protocol, applying it to a stock example signaling out of stock.
Explore error handling in Swift by using do-catch blocks, try, try? and try! with error enums to prevent crashes, report issues, and manage stock.
Learn the Swift result enum with success and failure cases and generic associated values. Use switch or the get method to process outcomes and print remaining stock.
Explore how Swift property wrappers encapsulate behavior, using @propertyWrapper and wrappedValue to clamp values with min and max, demonstrated by a clamped value example and usage in structures.
Explore Swift macros that auto-generate code before compilation, freeing developers from repetitive tasks. Identify that freestanding macros use the pound prefix, while attached macros use the at prefix.
Import and use frameworks to add essential app functionality via APIs for databases, graphics, and web resources. Learn how Foundation supports basic tasks in Xcode with Swift tools.
Explore how the Foundation nsstring class bridges with the Swift string struct, enabling formatted strings with placeholders for numbers and objects. Apply range-based searches, replacements, trimming, and component extraction.
Explore how Nsrange and range structures differ, including initial value, location, and length storage, string indexes versus UTF-16 encoding, and converting string index ranges in SwiftUI iOS 18.
Explore how Nsnumber stores numbers and converts to Swift types, then format numbers with integer and floating point format styles, applying precision, rounding, grouping, sign, percent, and currency options.
Master Swift date handling with foundation dates, calendars, and locales. Create, add, compare, and format dates using components, intervals, and time zones.
Explore the SwiftUI measurement system, create measurements with value and unit, perform arithmetic and comparisons, convert units, and format results with locale-aware styles.
Explore foundation timers, including non-repeating and repeating types, created with scheduled timer, using closures, and learning to invalidate timers to stop infinite loops.
Swift uses regular expressions with Foundation and the String type to match, capture, split, and replace patterns such as names and emails, using subexpressions and matches.
Explore core graphics, Apple’s legacy 2D drawing framework, now integrated with modern UI tools. Learn Swift data types cgsize, cgpoint, and cgrect, with their inits, properties, and zero values.
Master Xcode’s main interface, from the editor area and canvas to project setup and debugging. Study multi-platform SwiftUI apps, including signing, deployment targets, and Core Data or Swift data options.
Discover how SwiftUI files initialize an app via a struct conforming to the app protocol, whose body returns a scene inside a window group and defines the initial content view.
Learn how the SwiftUI canvas preview works, with two structures—the view and its preview—using the pound preview macro to configure orientation, size, and device options.
Explore opaque types in SwiftUI by learning how the body property returns a view, using the some keyword with a protocol, and letting the compiler infer the real data type.
Build SwiftUI user interfaces by composing views defined as structures, using the text view to display strings with interpolation and formatted values like currency and dates with a timer.
Master how SwiftUI modifiers shape views and text, from frame and padding to alignment and color. Apply dynamic fonts, custom fonts, and line, shadow, and truncation settings for flexible interfaces.
Explore color views in SwiftUI, using static and dynamic colors that adapt to light or dark mode, and manage them with asset catalogs and color sets for accents.
Learn how swiftui materials create frosted glass effects by applying ultra thin to ultra thick options with the background and foreground style modifiers, enabling translucent views over other content.
Discover how to load images from the asset catalog in SwiftUI, support 1x/2x/3x scales, and resize, clip, or preserve aspect ratio with image modifiers.
Explore SF symbols in SwiftUI to design scalable icons that adapt to the current font, switch variants and colors, and animate symbol views with the SF symbols app and modifiers.
Explore SwiftUI event modifiers that respond to user and system events, focusing on onappear and on disappear to trigger tasks as views appear or disappear.
Create styling with custom modifiers by encapsulating multiple modifiers in a view modifier struct. Apply this modifier to views to adjust font size and color using cgfloat, reducing repetition.
Explore how to use vstack, hstack, and zstack to organize views, adjust alignment and spacing, and layer content with spacers and z-index.
Explore how SwiftUI stacks allocate space, with images preserved and text truncated. Learn to use view priorities and the fixed size modifier to control which text appears in full.
Explore alignment guides in SwiftUI by customizing horizontal and vertical stacks with the alignment guide modifier, and define custom alignment types to align views like bus images across containers.
Group views organize up to ten views within a stack, enabling you to apply modifiers to all contained views and resolve conditional rendering by placing conditionals inside a group.
Explore SwiftUI grids to arrange content in multiple rows and columns, using grid and grid row structures, grid cell columns, and alignment to build nested layouts.
Break complex UI into smaller custom views with Xcode's extract subview, define each view with a body, and place it in the same file or separate Swift or SwiftUI file.
Learn to build custom layouts in SwiftUI by conforming to the layout protocol, implementing size that fits and place subviews to position views, and switch between custom and VStack layouts.
Master generic views in SwiftUI by using AnyView to wrap different views and understanding identity and performance limitations; leverage the viewbuilder wrapper and empty view for dynamic content.
Explore how the environment acts as a shared data store for the app and views, read color scheme via the environment wrapper to adapt to light and dark modes.
Explore how SwiftUI uses declarative syntax and @State to manage interface state, binding a TextField and a button to a title and updating the view automatically.
Explore bidirectional binding with @Binding in SwiftUI, connecting header and content views via state properties, using dollar signs to synchronize user input and update the user interface.
Explore binding structures and state management in SwiftUI by accessing underlying property wrapper structures, using wrapped and projected values, bidirectional bindings, and initializers for dynamic views.
Explore SwiftUI’s button view, including initializers, label options, actions, and state toggling. Learn to show or hide views, disable buttons, render templates, and apply standard or custom button styles.
Explore the SwiftUI text field view, its focus state and binding, styling with rounded borders, on submit and keyboard interactions, and validation, limits, and text selection.
Explore the secure field view in SwiftUI, which hides input characters with dots to protect passwords, using the same initializer and modifiers as the text field.
Explore the text editor view in SwiftUI, its initializer, and modifiers for alignment, line spacing, padding, and error checking, plus text selection.
Explore the toggle view in SwiftUI mastery: learn to bind a boolean to switch between on and off, customize labels and styles, use hstack, spacer, and onTapGesture to update state.
Explore the slider view letting users select a value from a range with a bar and knob. Initialize min and max, store value in state, and use step for integers.
Learn to use SwiftUI's progress view to show task progress with a 0.0–10.0 range, an initial value of 5, and a slider demo, plus switching to a circular activity indicator.
Explore the stepper view, a two-button control with state and range, configurable by a step argument, capable of five-unit increments and custom labels, and an up or down arrow indicator.
Learn how to use SwiftUI's group box view to group controls with a background and rounded corners. Implement it by providing the closure with the inside views inside a vstack.
Learn how a singleton data model powers multiple views with observable objects and Bindable for bidirectional binding. Initialize view data and manage state, refreshing the UI with id and uuid.
Learn to share a single model across SwiftUI views via the environment, using the environment modifier and Bindable properties for bidirectional binding.
SwiftUI builds dynamic lists of views with forEach, using hash values or a unique id, while models use identifiable ids like uuid and render in a stack with a divider.
Explore how to implement and configure scrollable content in SwiftUI using a scroll view, lazy stacks, and paging, including programmatic scrolling, scroll view reader, and visibility-based transitions.
Master lazy grids in SwiftUI by using a grid item structure with fixed, flexible, or adaptive values to control the number of items per row and how they fill space.
Explore how to build a scrollable vertical list with SwiftUI's list view, driven by a model, and customize rows with styles, modifiers, and mixed static and dynamic content.
Learn to group content into sections in SwiftUI, customize section headers and separators with modifiers, and build alphabetically ordered lists from data using computed properties and dictionary grouping.
Learn how to enable edit mode in SwiftUI list views, use on delete and on move modifiers, and manage single or multiple selections with bindings and index sets.
Explore swipe actions in lists, enabling a delete button on left swipes. Define a custom action with a destructive button and trash can icon to remove items from the model.
Learn to add custom buttons in SwiftUI by placing a remove button on each row, using a plain button style, and invoking the remove book method to delete items.
Explore the refreshable feature in swiftui, adding a list modifier with a closure that triggers a data refresh when the user scrolls down, showing a loading spinner and console output.
Learn to build hierarchical lists in SwiftUI using a list view and outline group view, with a parent-child model to expand items like food, beverages, and cheese within sections.
Master SwiftUI tables with a table view and table column view, defining columns by keypath or closures, applying widths, and enabling sorting, selection, and context menus on iPad and Mac.
Explore SwiftUI pickers that present values as a wheel, a list, or segmented buttons, using a binding for the selection and optional tags or indices.
Explore SwiftUI date picker and multi date picker to bind single or multiple dates, with options for date or time values, styles, ranges, and reflect selections in a text view.
Learn to build adaptable forms in SwiftUI with the form view, using sections and padding, grouped styling, and custom labels via the label content view for controls like steppers.
Explore SwiftUI's disclosure group to expand and collapse form sections, organizing non-hierarchical information into nestable controls. Tap labels or the disclosure indicator to reveal content and interact with the form.
Create custom containers by conforming to the view protocol with a viewbuilder to assemble inner views. Use foreach or group and container values to adapt styling and borders to state.
Embed the content in a navigation stack to enable multiple views and right-to-left transitions, with a top navigation bar and a navigation title modifier.
Learn to add toolbar items to navigation bars and other toolbars using toolbar item views and groups, with placements, primary and secondary actions, and pop-up menus across iPhone and iPad.
Explore implementing search in a SwiftUI list with the searchable modifier, binding the search term, and on change and on submit actions; filter items, add scope buttons, suggestions, and tokens.
Learn to use SwiftUI navigation link to replace the current view, push a settings or detail view, and manage long navigation paths with the navigation stack and navigation path.
Turn the default navigation into a zoom transition in SwiftUI by using a namespace, an identifier, and the navigation transition and match transition source modifiers to open a detail view.
Explore modal views and sheets in SwiftUI, including full-screen and partial detents controlled by bindings. Build an add book flow with text fields, validation, and store actions.
Explore the inspector in SwiftUI, a modal view that behaves as a right-side sheet on iPad and macOS and as a sheet on iPhone, controlled by binding and width modifiers.
Discover how SwiftUI popovers use the popover modifier to present a help view as a sheet on iPhone and a small anchored view on iPad and Mac, with arrow edge.
Learn how SwiftUI alert views present messages and collect input using the alert modifier and a state property, with text fields and buttons for actions like cancel, delete, and save.
Explore SwiftUI confirmation dialogs, also known as action sheets, and learn to present a bottom-aligned dialog with three buttons—standard, destructive, and cancel—via a state-driven modifier.
Tip views help users discover features using the Typekit tip protocol, with a required title and optional message, configured by display frequency and datastore location.
Learn to use tab views to organize screens with bottom tabs on iPhone and a top bar on iPad, including badges and programmatic tab selection.
Explore search in a tab view by adding a predefined search tab with a magnifying glass icon, using the role argument, and implementing a search bar for iPad designs.
Learn to use tab view with bottom tabs on iPhone and top buttons on iPad, switch to page style for swipe navigation and page indicators.
Learn to implement a responsive sidebar with SwiftUI tab view on iPad and iPhone, featuring header, footer, toolbar, and tab sections with editing mode and draggable tabs.
Design a real-life tab view application that shows a books list, a settings-driven configuration, and a search feature, with a model-driven toggle-controlled display of covers and publication year.
Explore how SwiftUI adapts to space using size classes and environment values to switch layouts, and how header and body views reflow between vertical and horizontal stacks.
Explore how SwiftUI's GeometryReader uses the container size via the geometry proxy to adapt views, determine portrait or landscape, and size and position content.
Learn how to pass values up the view hierarchy using preferences with a custom preference key in SwiftUI, leveraging a geometry reader and cgsize to adapt to rotation.
Build universal interfaces with SwiftUI's navigation split view across iPhone, iPad, and Mac. Adapt layout using sidebars, detail views, and size classes for 2 or 3 column designs.
Learn to build a three-column navigation split view in SwiftUI by organizing authors and their books in a data model, updating authors list alphabetically, and syncing selections across columns.
Configure a navigation split view by adjusting column visibility and widths with bindings, including detail-only modes and hiding left columns when a book is selected.
This course is built using the latest Apple release, iOS 18
Welcome to "SwiftUI Mastery - The iOS 18 Reference Library of Code, the definitive guide to to learning everything SwiftUI.
This is a SwiftUI Reference Course / Cookbook / and Set of Documentation, for everything SwiftUI. There are hundreds of downloadable examples / video instruction / and projects here so you can get the code you need and add it directly into your projects / create your own SwiftUI docs, or add this to your own existing SwiftUI docs.
My name is Steve DeStefano, i am a SwiftUI developer, and working together with the brilliant programmer J.D. Gauchat, I have turned his best selling book "SwiftUI for Masterminds, the iOS 18 edition" into this complete developers mastery course.
This course is different than other courses, in that we don’t just scratch the surface, or build a few simple apps… in here, I give you the SwiftUI framework, explained.
All the instruction, all the downloadable examples, and all the tools that you need to build your own insanely cool apps, without any wasted time or chatter. I am strictly on point reading from the book, typing the code, and explaining how it all works. I use labels, graphics, animations, and other callouts to help draw your attention to the flow of the code.
You get the step by step instruction for each technology in the SwiftUI framework, and see how to use the different views, initializers, methods, and modifiers that are available for each of those technologies.
Also included in the course is the code file for every lecture, so you can download it and use in your apps right away, all built with the latest release, and tested to run perfectly. This is a huge library of code, hundreds of examples highlighting the SwiftUI Framework, neatly categorized for easy look up and reference, so you have everything you need to create your own stunning apps to submit to the App Store.
If you’re new to Swift, no problem, there is a language section in the beginning of the course that will walk you through the Swift Language and get you up to speed, fast.
If you’re an experienced programmer, this course will be your go to resource, because it is a huge repository of instruction and downloadable code thats perfect to add to your own set SwiftUI docs.
Here are some of the topics covered:
App Development • Swift Language (complete language) • Protocols • Frameworks • User Interface • View Protocol • Opaque Types • Text • Modifiers • Color View • Image View • Event Modifiers • Custom Modifiers • Layout • Safe Area • Priorities • Alignment Guides • Groups • Custom Views • Previews • Regex Framework • Grids • Preview Modifiers • Environment • Property Wrappers • @State • @Binding • @Environment • @AppStorage • Model • Observable • @EnvironmentObject • View Model • Combine Framework • Publishers • Subscribers • Transforming values • Operators • Subjects • Controls Button View • TextField View • SecureField View • Toggle View • Slider View • Stepper View • Navigation View • NavigationLink View • TabView View • Sheets • Popovers • Alert Views • Action Sheets • Split Views • Custom Navigation • Size Classes • Orientation • GeometryReader View• Preferences • Mac Catalyst • Conditional Code • Menu • Multiple Windows Support • Lists • ForEach View • ScrollView • List View • Sections Edition Mode • Custom Buttons • Search • Picker View • DatePicker View • Forms • Shapes • Charts • Gradients • Images • Paths • Custom Shapes Transformations • Animations • Hit Testing • Transitions • Gesture • Notification Center • System Notifications • User Notifications • Provisional Notifications • User Defaults • File Manager • URLS and Paths • Files and Directories • Bundle • Archiving • Encoding and Decoding • JSON • Core Data • Core Data Model • Core Data Stack • Sort Descriptors • iCloud • Testing Devices • Key Value Storage • @AppStorage • UIKit Integration • Web • Safari View Controller • MapKit • Camera • Photo Library • Custom Camera • AviKit FrameWork • Custom Video Player • Collection View • Apple Developer Program • Publishing to the App Store • Certificates, Provisioning Profiles, Identifiers • App Store Connect • Swift Language .• And much more.
So come code along with JD and myself, working with an incredibly cool and insane set of design tools, and learn everything you need to know about the SwiftUI Framework, and how to implement and leverage all of its great new technologies.