Files
ScrollingContentViewController/Source/KeyboardObservering.swift
T
Drew Olbrich 8e6c9b5a23 Fix bug: Content view isn't sized correctly when it doesn't fill the screen
This commit addresses an error in the earlier commit 04b4f8e, which did
not the case when shouldResizeContentViewForKeyboard was false.
2019-03-21 20:46:42 -07:00

37 lines
1.2 KiB
Swift

//
// KeyboardObservering.swift
// ScrollingContentViewController
//
// Created by Drew Olbrich on 1/6/19.
// Copyright 2019 Oath Inc.
//
// Licensed under the terms of the MIT License. See the file LICENSE for the full terms.
//
import UIKit
/// Delegate for `KeyboardObserver`.
internal protocol KeyboardObservering: class {
/// View controller over top of which the keyboard is presented.
var hostViewController: UIViewController? { get }
/// Content view that contains text fields.
var contentView: UIView? { get }
/// Scroll view that is the super view of `contentView`.
var scrollView: ScrollingContentScrollView { get }
/// If `true`, the content view should be resized to compensate for the portion of
/// the scroll view obscured by the presented keyboard, if possible.
var shouldResizeContentViewForKeyboard: Bool { get }
/// Adjusts the view controller to compensate for the portion of the keyboard that
/// overlaps the view controller's root view.
///
/// - Parameter bottomInset: The height of the vertical extent of the keyboard that
/// overlaps the view controller's root view.
func adjustViewForKeyboard(withBottomInset bottomInset: CGFloat)
}