Migrating an iOS app to SwiftUI - Navigation & Storyboards
['Benoit Pasquier']
Benoit Pasquier - Swift, Data and more
import MessageUI import SwiftUI class MailControllerDelegate : NSObject , MFMailComposeViewControllerDelegate { @ Binding var isPresented : Bool init ( isPresented : Binding < Bool >) { _isPresented = isPresented } func mailComposeController ( _ controller : MFMailComposeViewController , didFinishWith result : MFMailComposeResult , error : Error ?) struct MailView : UIViewControllerRepresentable { typealias Coordinator = MailControllerDelegate @ Binding var isPresented : Bool func makeCoordinator () -> MailControllerDelegate { MailControllerDelegate ( isPresented : $ isPresented ) } func makeUIViewController ( context : UIViewControllerRepresentableContext < MailView >) -> MFMailComposeViewController { let viewController = MFMailComposeViewController () viewController .