iOS 13 has finally rolled out for the public. In no time, 13.1 was out as well. I’m sure you’ll be shipping your next app updates with it. Before doing that let’s go through a checklist of essential things.
- SwiftUI framework has released with iOS 13. It’s for building cool, innovative user interfaces in a completely different way. You must be aware of this unless you’ve been living under a rock.
- Combine is a Reactive Programming Framework.
- RealityKit framework – This one is used to simulate and render 3D content easily. Build even better AR apps!
- Project Catalyst – You can easily port iOS apps to macOS. Just tick the checkbox to add macOS as a target. This should work from mac os 10.15 and above.
Moving on from the popular frameworks that are making some noise these days, let’s dig into the important updates.
View Controller Default Presentation Style
With iOS 13, Apple has changed the default presentation style of View Controllers to a modal sheet from fullscreen in iOS 12. A modal sheet is a card like a form sheet which can be dismissed by pulling it down. This can potentially break your app’s flow if you don’t intend to shut view controllers in this way.
I WANT FULL-SCREEN VIEW CONTROLLERS
Starting iOS 13, you’ll need to explicitly specify presentation style as shown below:
vc.modalPresentationStyle = .fullScreen //for view controllers inside navigation controller.. let navigationController = UINavigationController(rootViewController: vc) navigationController.modalPresentationStyle = .fullScreen present(vc, animated: true)
To prevent the pull to dismiss gesture, add the following line of code:
vc.isModalInPresentation = true
You can even take more control over the swipe to dismiss on the modal sheets by using the newly added functions in
UIAdaptivePresentationControllerDelegate protocol :
presentationControllerDidAttemptToDismiss– Gets called when isModalInPresentation is true and the user is still trying to dismiss by swiping down.
presentationControllerWillDismiss– Can be triggered when a user tries swiping the view controller up and down.
Starting iOS 13, UINavigationBar for large title style is no longer translucent. It’s transparent now.
We can change the style back to translucent in the following way:
let appearance = UINavigationBarAppearance() appearance.configureWithDefaultBackground() UINavigationBar.appearance().scrollEdgeAppearance = appearance
UINavigationBarAppearance is the new class to customize the appearance.
UINavigationBar consists of three built-in appearance types:
scrollEdgeAppearance– For large title navigation bar
The new UISegmentedControl has a 3d effect. But the more important thing is
tintColor property does not work anymore in iOS 13. Instead, we need to use
selectedSegmentTintColor to change the background color of the selected segments.
Starting iOS 13, UIImage has got a new initializer,
systemName. You can pass the system name as a string by looking up in the SF Symbols mac application. It contains more than 1000 system icons.
You can download that app from here.
SceneDelegate for Multi-Window Support
iPadOS brings multi-window support in the same app. Now when you create a new XCode you’ll see a SceneDelegate file. It is for managing individual scenes (windows). So the AppDelegate’s UI related responsibilities are now taken over by SceneDelegate.
Context Menus are a replacement for the Peek and Pop which worked on devices having 3d touch only.
Unlike that, context menus work on all devices. We can set menus, submenus as well as Preview of the Target View Controller.
The menu is visible right above/below the preview.
To implement a Context Menu on Collection/Table View there’s a newly added function in the Delegate that you need to override.
For collection view it is
func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration?
We can define our own
UIMenu and assign actions to them.
To open the target view controller from the Preview we need to implement the method:
func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating)
We can customize the user interface to dark mode in iOS 13 using the
userInterfaceStyle property which is a part of
Dynamic colors are now available and they can be adopted for dark/light mode.
We can even set our own set of color/dynamic image for
In order to opt-out of dark mode or lock the appearance to just one type you need to set the
UIUserInterfaceStyle to Light/Dark in the
Vision API gets a boost
The Vision API gets a boost by the inclusion of the Document Camera View Controller. Optical Character Recognition is much easier now thanks to the improved machine learning model. Moreover, Vision API now comes up with a Pet Animal Detector API. Built-in cat vs dog classifier. More power to you. Just use
That sums up most of the important points for iOS 13.