     // All scalings below are taken from Simulator readings, using the most-up-to-date version of iOS that they support.
     // Note that the banner heights (at minimum) may vary across iOS versions!
     //
-    // None of the widths seem accurate, but I've yet to figure out how to get the exact readings.
+    // None of the widths seem accurate _for the keyboard_, but I've yet to figure out how to get the exact readings.
 
     // Nothing available for iOS 9.3.5 - Xcode does not provide a Simulator version.
 

    scalings[KeyboardScaleMap.hashKey(for: Device.iPhone8Plus)] = Scaling(portrait: KeyboardSize(w: 414, h: 226, b: 45), landscape: KeyboardSize(w: 736, h: 162, b: 38))  // does not use full width in landscape

    // Start:  'safe area insets', which are not counted (here) as part of a keyboard's height.
    scalings[KeyboardScaleMap.hashKey(for: Device.iPhoneX)]  = Scaling(portrait: KeyboardSize(w: 375, h: 216, b: 45), landscape: KeyboardSize(w: 724, h: 150, b: 38))  // insets:  p: 34, l: 21
    scalings[KeyboardScaleMap.hashKey(for: Device.iPhoneXR)]  = Scaling(portrait: KeyboardSize(w: 414, h: 226, b: 45), landscape: KeyboardSize(w: 808, h: 150, b: 38))  // insets:  p: 34, l: 21
    scalings[KeyboardScaleMap.hashKey(for: Device.iPhoneXS)]  = Scaling(portrait: KeyboardSize(w: 414, h: 216, b: 44), landscape: KeyboardSize(w: 724, h: 150, b: 38))  // insets:  p: 34, l: 21.  And yeah, that '44' isn't a typo.

    return device.realDevice.description
  }

  /**
   * Compares the detected dimensions of the current device to those of devices with known keyboard dimensions, returning
   * the largest device smaller than or equal to the detected dimensions.
   */
  private static func getUnknownDeviceMapping() -> Device {
    let _screenSize = UIScreen.main.bounds

    // Shouldn't happen, but just in case.
    if _screenSize == CGRect.zero {
      log.error("Cannot detect device dimensions; defaulting to smallest device for form factor.")
    }

    // Convert to CGSize in portrait orientation.
    var screenSize: CGSize
    if _screenSize.width > _screenSize.height {
      screenSize = CGSize(width: _screenSize.height, height: _screenSize.width)
    } else {
      screenSize = CGSize(width: _screenSize.width, height: _screenSize.height)
    }

    // Array for search is determined by form-factor.
    var searchSet: [Device]
    if(UIDevice.current.userInterfaceIdiom == .phone) {
      searchSet = KeyboardScaleMap.shared.phoneScalingThresholds
    } else {
      searchSet = KeyboardScaleMap.shared.tabletScalingThresholds
    }

    // Okay, now that we've got the important values, it's time to search.
    let potentialMatches = searchSet.compactMap { device in
      let matchSize = KeyboardScaleMap.shared.pointSizes[KeyboardScaleMap.hashKey(for: device)]!
      if matchSize.width > screenSize.width ||  // if searchSet's device is wider
         matchSize.height > screenSize.height { // or taller
        return nil as Device?                   // it's not a permitted match for mapping uses.
      } else {
        return device
      }
    } as [Device]

    if potentialMatches.count == 0 {
      return searchSet[0] // in case no matches can be found (like the screenSize == CGRect.zero case) - use smallest
    } else {
      // Use the largest potential device, which is the last one returned from the mapping (b/c we presorted the base array)
      return searchSet.last!
    }
  }

  static func getDeviceDefaultKeyboardScale(forPortrait: Bool) -> KeyboardSize? {
    let device = Device.current

