iOS 13 Checklist for developers

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.

  1. 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.
  2. Combine is a Reactive Programming Framework.
  3. RealityKit framework – This one is used to simulate and render 3D content easily. Build even better AR apps!
  4. 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.

ios-13-modal-presentation-viewcontroller

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.
  • presentationControllerDidDismiss
  • presentationControllerShouldDismiss

Transparent UINavigationBar

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:

  • standardAppearance
  • compactAppearance
  • scrollEdgeAppearance – For large title navigation bar

Revamped UISegmentedControl

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.

SF Symbols

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.

UIImage(systemName: trash.fill)

ios-13-sf-symbols

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

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.

ios-13-context-menu

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)

Dark Mode

We can customize the user interface to dark mode in iOS 13 using the userInterfaceStyle property which is a part of traitCollection.
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 lightAppearance and darkAppearance.

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 info.plist file.

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 VNRecognizeAnimalRequest

That sums up most of the important points for iOS 13.

Leave a Reply

Your email address will not be published. Required fields are marked *