Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
An iOS Developer's Guide to SwiftUI

You're reading from  An iOS Developer's Guide to SwiftUI

Product type Book
Published in May 2024
Publisher Packt
ISBN-13 9781801813624
Pages 446 pages
Edition 1st Edition
Languages
Author (1):
Michele Fadda Michele Fadda
Profile icon Michele Fadda

Table of Contents (25) Chapters

Preface 1. Part 1: Simple Views
2. Chapter 1: Exploring the Environment – Xcode, Playgrounds, and SwiftUI 3. Chapter 2: Adding Basic UI Elements and Designing Layouts 4. Chapter 3: Adding Interactivity to a SwiftUI View 5. Part 2: Scrollable Views
6. Chapter 4: Iterating Views, Scroll Views, FocusState, Lists, and Scroll View Reader 7. Chapter 5: The Art of Displaying Grids 8. Part 3: SwiftUI Navigation
9. Chapter 6: Tab Bars and Modal View Presentation 10. Chapter 7: All About Navigation 11. Part 4: Graphics and Animation
12. Chapter 8: Creating Custom Graphics 13. Chapter 9: An Introduction to Animations in SwiftUI 14. Part 5: App Architecture
15. Chapter 10: App Architecture and SwiftUI Part I: Practical Tools 16. Chapter 11: App Architecture and SwiftUI Part II – the Theory 17. Part 6: Beyond Basics
18. Chapter 12: Persistence with Core Data 19. Chapter 13: Modern Structured Concurrency 20. Chapter 14: An Introduction to SwiftData 21. Chapter 15: Consuming REST Services in SwiftUI 22. Chapter 16: Exploring the Apple Vision Pro 23. Index 24. Other Books You May Enjoy

What this book covers

Chapter 1, Exploring the Environment – Xcode, Playgrounds, and SwiftUI, is an introduction to the software tools used when working with SwiftUI, the new exciting, efficient, and simple-to-use Apple framework for user interfaces.

Chapter 2, Adding Basic UI Elements and Designing Layouts, shows you how to properly refactor view code. Then, it describes how to combine basic views with stacks and control their visual layout.

Chapter 3, Adding Interactivity to a SwiftUI View, discusses the conversion from static to dynamic SwiftUI views, with a focus on responsive design, including taps and gestures. This chapter explores mechanisms to enable views to be made interactive. It covers topics such as view creation, interactivity enhancement, property wrappers, limitations of @State, bidirectional bindings, subviews, and the use of @ObservableObject and @StateObject classes.

Chapter 4, Iterating Views, Scroll Views, FocusState, Lists, and Scroll View Reader, focuses on showing lists in SwiftUI, through scrollable views such as scroll views or lists. It shows how to handle the visibility of the iOS system keyboard. It introduces NavigationView for view titles and covers iterating views, @ViewBuilder, scroll views, @FocusState for keyboard control, lists, and ScrollViewReader for element positioning within lists or scroll views.

Chapter 5, The Art of Displaying Grids, moves on to creating grid structures in SwiftUI. Topics covered include displaying grids in iOS, the grid view, lazy grids, using GridItem for layout control, conditional view formatting, and responding design to device orientation changes.

Chapter 6, Tab Bars and Modal View Presentation, focuses on using tab bars and modal view presentations in SwiftUI. It begins with the TabView, which is the most common way of moving between views in a small-scale iOS app. Topics covered include how to add a tab bar using TabView and tabItem, implementing custom tab bars, and an exhaustive investigation into modal views such as sheets, alerts, and popovers.

Chapter 7, All About Navigation, introduces the concept of navigation in SwiftUI. It starts with an overview of iOS navigation and then deals with programmatic and user-initiated navigation. It illustrates the changes with Swift 4 and iOS 16. Topics discussed are navigation across platforms, basic navigation with NavigationView and NavigationLink, .navigationDestination, user-controlled and split view navigation, programmatic navigation with NavigationPath, and saving/restoring the navigation stack in the JSON format.

Chapter 8, Creating Custom Graphics, shows you how to style apps by creating custom modifiers, diving into the use of core graphics inside the Canvas view, CALayers integration with SwiftUI. Then, the chapter goes further, illustrating how to use CustomLayout.

Chapter 9, An Introduction to Animations in SwiftUI, highlights SwiftUI animations, explaining their state-driven, reactive nature, made possible by SwiftUI’s declarative syntax. It explains the built-in modifiers of animation, transition, and scaleEffect.

Chapter 10, App Architecture and SwiftUI Part I – the Practical Tools, dissects the impact that SwiftUI has had in restructuring the application architecture on Apple’s operating systems. It introduces conceptual tools that allow a developer to segment an app into manageable components. This chapter focuses on ad hoc architecture rather than offering a one-size-fits-all solution. Key topics include diagrams, dependency inversion, clean architecture, decoupling techniques, state management, and iOS 17 changes on state bindings.

Chapter 11, App Architecture and SwiftUI Part II – the Theory, introduces modern application architecture, taking note of the specificity of the iOS context. It explains the concept of software architecture to give a theoretical understanding and criteria for evaluating well-designed architecture. Key topics include the principles of lightweight architecture, conflict resolution, defining good architecture, the importance of software patterns, the role of the architect, consulting experts, the difference between full-scale applications and examples, and the impact of Conway’s law.

Chapter 12, Persistence with Core Data, focuses on defining persistence, explaining Core Data’s structure, its integration with SwiftUI, and its practical use in Xcode. It touches on CloudKit for cloud-based data storage. Key topics include the Core Data’s framework classes, Core Data with SwiftUI, project creation and migrations, the SQLite data file, and CloudKit.

Chapter 13, Modern Structured Concurrency, discusses concurrency in mobile application development nowadays, applied specifically to Swift. The chapter outlines the history of concurrency from traditional mechanisms, such as threads and callbacks, to Apple’s modern structured concurrency approach. Its topics include async/await, tasks, task groups, asynchronous sequences and streams, actors, and integrating old-fashioned concurrency with modern structured concurrency.

Chapter 14, An Introduction to SwiftData, describes Apple’s ORM (Object Relational Mapping) framework, SwiftData, which is set to replace Core Data in SwiftUI development. The topics covered include SwiftData versus Core Data, SwiftData’s features, SwiftUI integration, data modeling, and the changes in binding.

Chapter 15, Consuming REST services in SwiftUI, explains HTTP, and REST as concepts and how to integrate REST services into SwiftUI applications for iOS apps that demand communication over the internet. Topics covered include HTTP requests made using URLSession, converting to and from JSON using Codable, watching UI changes with ObservableObject and @Published, avoiding man-in-the-middle attacks, and handling network errors.

Chapter 16, Exploring the Apple Vision Pro, introduces Apple Vision Pro, an advanced mixed-reality headset, and its importance for spatial computing. It describes the device’s immersive three-dimensional interface. It also goes into the development tools for visionOS, starting development with visionOS, and the initial steps in visionOS development.

lock icon The rest of the chapter is locked
Next Chapter arrow right
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}