The modern approach

With the release of Android R, the team at Google have included a set of new WindowInsets APIs which expands the control that we, as developers, have over the window insets. These include the status bar, navigation bar and on-screen keyboard.

There is now a direct way to check, toggle and listen for changes the visibility of windows insets. We can even control and react to the animation when the visibility changes, but that won’t be covered in this article (but perhaps in a future article!).

We’ll be looking at the input method editor (IME) input type specifically, which includes the on-screen keyboard, but the same approach can be used for other types of window insets. …


The mobile development scene is slowly shifting towards declarative UIs, but large and popular UI libraries are understandably still using the old UI paradigms. An example of this is Google’s Material Components for iOS library.

Therefore, if we want to use Material design in our iOS app that we are building in SwiftUI we can either:

  1. Implement the components ourselves from scratch
  2. Find a way to use the existing Material Components library

We’ll be looking at the second option. We need a way to integrate the UIKit views provided by the library to be used in SwiftUI, and we can use UIViewRepresentable to do exactly that. …

About

Jeremy Lee

Mobile Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store