Integrating SwiftUI into UIKit Apps

A detailed guide on gradually adopting SwiftUI in UIKit projects.

Updated for iOS 18 and Xcode 16

Integrating SwiftUI into UIKit Apps by Natalia Panferova book coverIntegrating SwiftUI into UIKit Apps by Natalia Panferova book cover
  • Discover many possible ways to add SwiftUI views to an existing UIKit app
  • See how fast you can develop new components in SwiftUI and preview them instantly in Xcode canvas
  • Take your existing apps to the next level by adding new features, such as Swift Charts and widgets
  • Learn how to seamlessly bridge data between UIKit and SwiftUI
  • Use SwiftUI animations to animate UIKit views
  • Migrate larger parts of your apps to SwiftUI while reusing views and controllers built in UIKit

Want to try reading a sample for free? You can download the free sample bundle or read the sample subchapter online.
You can also check out the full table of contents to get an idea of what's inside.

Individual license for 1 readerBuy a copy$45Already have a copy? Request access.
Get a bundleGet Swift Gems and Integrating SwiftUI into UIKit Apps as a bundle.Buy the bundleSave 10 dollars when buying 2 books
Team licenses
Team license for 2 - 5 readersBuy for a small teamSave 5 dollars per copy
Team license for 6 - 10 readersBuy for a medium teamSave 10 dollars per copy

Please, contact us if you wish to purchase for more than 10 readers, and we will organize a special discount for you.

What is included

  • Online book access
  • High quality EPUB and PDF downloads
  • Over 200 pages of content
  • 7 full projects with sample code
  • Free lifetime updates to the book

What it covers

  • Developing user interfaces with SwiftUI: state and data management, styling, layout, accessibility
  • Learning the fundamentals of the SwiftUI framework to use it and integrate it efficiently
  • Using Xcode previews when designing and building UI
  • Integrating SwiftUI inside UIKit views and controllers with UIHostingController
  • Presenting controllers containing SwiftUI hierarchy programmatically and in storyboards
  • Setting up data flow between UIKit and embedded Swift components
  • Sizing and positioning SwiftUI views inside a UIKit controller
  • Taking full advantage of the new iOS 17 and iOS 18 features
  • Building custom collection view cell configurations in SwiftUI
  • Adding charts built with the Swift Charts framework to existing UIKit apps
  • Making widgets with WidgetKit and SwiftUI including Lock Screen widgets
  • Migrating from UIKit to the SwiftUI app lifecycle
  • Bringing existing views and controllers built in UIKit into SwiftUI during migration
  • Wrapping UIKit views and controllers with UIViewRepresentable and UIViewControllerRepresentable to be used in SwiftUI
  • Previewing UIViewControllers and UIViews in Xcode previews
  • Setting up bidirectional data flow between wrapped UIKit components and the SwiftUI app
  • Bridging data between UIKit and SwiftUI using the new Observable framework and custom traits

Who the book is for

This book is for UIKit developers who would like to use SwiftUI in their existing UIKit projects. You should have some experience using Xcode to build iOS applications with the Swift language and the UIKit framework. SwiftUI experience is welcome but not strictly required. The first chapter of the book that covers SwiftUI essentials should get you up to speed. You can also improve your SwiftUI knowledge as you progress through the book by following along with the code and studying additional materials from the further reading sections.

The book comes with sample code for each chapter. We provide starter projects with initial setup and assets, as well as final projects with completed examples.

To follow along you would need the latest version of Xcode 16.

About the author

Natalia's photoNatalia's photo
Natalia PanferovaiOS and macOS engineer

Natalia has many years of experience building mobile apps working in both small startups and large companies. Before joining Nil Coalescing in April 2022 she was part of the core SwiftUI team at Apple designing and building SwiftUI APIs. She is passionate about the framework and enjoys sharing her SwiftUI knowledge with the community.

Have questions about the book? Send us a message.