Skip to content
Branch: master
Find file History

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
iPadModalHybrid.xcodeproj
iPadModalHybrid
README.md

README.md

SwiftUI (fullscreen) modal on iPad

UIKit + SwiftUI Hybrid approach

One way to achieve a full screen modal presentation on iPad is to wrap each View instance in a UIHostController and then use ObservableObject for the communication between SwiftUI and UIKit.

By using this approach, one can easily leverage the existing presentation API's from UIKit while still having View instances made with SwiftUI.

Result

SwiftUI + UIKit Hybrid

PROS

  • Fulscreen modal presentation on iPad.
  • Ability to use UIKit presentation APIs. Storyboards, Nibs, Custom transitions etc.

CONS

  • Too much Boilerplate code.
You can’t perform that action at this time.