UIViewControllerRepresentable: Navigation Title and Bar Button Items Ignored in NavigationView

Solved! Problem and Expectation SwiftUI uses a UINavigationController under the hood. So, if I push a UIViewController onto a SwiftUI NavigationView using UIViewControllerRepresentable, then I would expect the navigation item and toolbar items of that view controller to be used by said navigation controller. As I mention above, they are ignored. Root Cause It turns … Read more

How to constrain autorotation to a single orientation for some views, while allowing all orientations on others?

The short answer is that you’re using UINavigationController, and that won’t work like you want it to. From Apple’s docs: Why won’t my UIViewController rotate with the device? All child view controllers in your UITabBarController or UINavigationController do not agree on a common orientation set. To make sure that all your child view controllers rotate … Read more

iPhone crashing when presenting modal view controller

I have modified it slightly so that the loading view is shown after a tiny delay, and this works fine! So it appears to be something within the same event loop! – (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // Show load [self performSelector:@selector(doit) withObject:nil afterDelay:0.1]; } – (void)doit { [self presentModalViewController:loader animated:YES]; }

MFMailComposeViewController in Swift

I compared MFMailComposeResult documentation on both Xcode 5 and Xcode 6. In Swift, MFMailComposeResult is a struct struct MFMailComposeResult { init(_ value: CUnsignedInt) // available in iPhone 3.0 var value: CUnsignedInt } with MFMailComposeResultCancelled as a constant of type MFMailComposeResult: var MFMailComposeResultCancelled: MFMailComposeResult { get } while it’s an enum in Objective-C: enum MFMailComposeResult { … Read more