Presenting iOS View Controller as bottom-half Modal

Presenting iOS View Controller as bottom-half Modal

Presenting view controllers in iOS is a trivial thing. At least if you can do with the capability provided by iOS out of the box.

But sometimes it makes sense to go a little beyond the default capabilities.

You probably see it all the time in the apps you love most - e.g. Apple Music got a lot of attention within the iOS developer community for their player-progress bar that you can drag or tap to present:
Apple Music, player transition

You can use this transition in your own apps, using the MusicPlayerTransition repo on GitHub.

A common pattern I've seen in apps, is presenting screens that in some way is assisting or supplementing to current screen.

A good example of this is apps like Numbers and Google Sheets, which presents a cell configuration screen at the bottom, to cover half of the screen:
Half Modal presentation to configure spreadsheet cells

I've also seen the use of half modals to filter a huge collection or table view. Apple Pay also make use of it:
Apple Pay Half Modal Presentation

I needed to do something like this in my Mileage Book app and at first I used a repo on GitHub, but it didn't give me the flexibility I wanted.

So I set out to create my own, using a presentation controller to manage the back drop and scaling the root view, and then using custom animator objects for presentation and interaction.

It covers the bottom half of the screen by default. You can then tap a button in the navigation bar to maximize to the entire screen (this caused a huge head-ache due to a bug in iOS when updating the status bar appearance).

It also support interaction that allows you to swipe down to dismiss the view. No need to reach your way to the Cancel button in the navbar.

I open sources the repo on: martinnormark/HalfModalPresentationController

It looks like this:
Half Modal Presentation Controller