Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
SwiftUI Cookbook

You're reading from   SwiftUI Cookbook A guide for building beautiful and interactive SwiftUI apps

Arrow left icon
Product type Paperback
Published in Dec 2023
Publisher Packt
ISBN-13 9781805121732
Length 798 pages
Edition 3rd Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Juan C. Catalan Juan C. Catalan
Author Profile Icon Juan C. Catalan
Juan C. Catalan
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Using the Basic SwiftUI Views and Controls 2. Displaying Scrollable Content with Lists and Scroll Views FREE CHAPTER 3. Exploring Advanced Components 4. Viewing while Building with SwiftUI Preview in Xcode 15 5. Creating New Components and Grouping Views with Container Views 6. Presenting Views Modally 7. Navigation Containers 8. Drawing with SwiftUI 9. Animating with SwiftUI 10. Driving SwiftUI with Data 11. Driving SwiftUI with Combine 12. SwiftUI Concurrency with async await 13. Handling Authentication and Firebase with SwiftUI 14. Persistence in SwiftUI with Core Data and SwiftData 15. Data Visualization with Swift Charts 16. Creating Multiplatform Apps with SwiftUI 17. SwiftUI Tips and Tricks 18. Other Books You May Enjoy
19. Index

What’s new in SwiftUI

SwiftUI has been evolving since the day it was announced in 2019. Every year, Apple adds new APIs and SwiftUI becomes more and more powerful. At the time of this writing, it is possible to create an iOS app exclusively using SwiftUI, without having to integrate UIKit. Since the previous edition of this book, Apple added new functionality to SwiftUI.

In WWDC 2022, Apple added new features to SwiftUI, improved some existing features, and even deprecated some of the APIs just introduced a few years ago. These are the most relevant features:

  • Swift Charts, which allows you to create data visualizations across all Apple platforms
  • New data-driven navigation with NavigationStack and NavigationSplitView
  • Enhancements to Form, to support multi-platform apps with a single code base:
    • LabeledContent view to display pairs of data, like key-value pairs or title and description, inside forms
    • Deeper customization of multi-line TextField instances
    • New MultiDatePicker control to select more than one date
    • New mixed-state controls for Toggle and Picker views and a new format for Stepper views.
  • Table, introduced in macOS 12, now available on iPadOS 16 and iOS 16, and new toolbar customization for iPadOS
  • PhotosPicker view, a multi-platform and privacy-preserving API for picking photos and videos
  • ShareLink view, which enables the presentation of the share sheet even in WatchOS
  • Transferable protocol, to share data between apps
  • ShapeStyle extensions like gradient and shadow, which can also be applied to SFSymbols
  • Grid, to arrange content in a two-dimensional way
  • Layout protocol to create full-custom layouts

In WWDC 2023, Apple added more functionality to SwiftUI. These are the most relevant features:

  • Interactivity and animation added to widgets
  • Improvement to Xcode previews with a new Preview(_:traits:body:) macro that supports UIKit and AppKit out of the box
  • Native SwiftUI support for MapKit
  • Interactivity and pie charts added to Swift Charts
  • Navigation, date pickers, and toolbars available in WatchOS 10
  • SwiftData, a successor of CoreData, used to persist data between app launches
  • The Observable macro, and new @State, @Environment, and @Bindable property wrappers, offering a new way of sharing data throughout the app
  • New powerful animations with the new spring animation, the PhaseAnimator struct, and the Keyframe Animator and CustomAnimation protocol
  • Inspector, a new modal presentation with the inspector(isPresented:content:) view modifier
  • Symbol Effects, animated symbols added to SF Symbols 5
  • New powerful scrolling APIs: transition effects, scroll position, paged scrolling, and inset control
  • Enhancements to list and tables: item selection, expanding sections programmatically, column visibility, column header visibility, hierarchical rows, and alternating row background
  • New dialog customizations, new gestures, and new input events
lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime
Banner background image