Latest 1.0.0
Homepage https://github.com/altece/AdaptiveTyping
License MIT
Platforms ios 11.0
Frameworks UIKit
Authors

SafeAreaViewController is a container view controller that will automatically
adjust its safe area insets in response to the iOS Keyboard appearing, disappearing,
and resizing.

import AdaptiveTyping
import PlaygroundSupport
import UIKit

class ViewController: UIViewController {
    var field: UITextField!

    override func loadView() {
        view = UIView()
        view.backgroundColor = .white

        field = UITextField()
        field.translatesAutoresizingMaksIntoConstraints = false
        view.addSubview(field)

        field.text = "Apples are your friends"
        field.textAlignment = .center

        [ field.centerXAnchor.constraint(equalTo: view.layoutMarginsGuide.centerXAnchor),
          field.centerYAnchor.constraint(equalTo: view.layoutMarginsGuide.centerYAnchor),
          field.widthAnchor.constraint(equalTo: view.layoutMarginsGuide.widthAnchor) ]
            .forEach { $0.isActive = true }

        let tap = UITapGestureRecognizer(target: self, action: #selector(self.didTapAway))
        view.addGestureRecognizer(tap)
    }

    @objc func didTapAway() {
        field.resignFirstResponder()
    }
}

PlaygroundPage.current.liveView = SafeAreaViewController(rootViewController: ViewController())

Latest podspec

{
    "name": "AdaptiveTyping",
    "version": "1.0.0",
    "summary": "Easily adjust layouts to make room for the iOS Keyboard.",
    "description": "AdaptiveTyping provides a view controller, SafeAreaViewController, which will automaticallynadjust its safe area to account for any changes in the presenation of the iOS Keyboard.",
    "homepage": "https://github.com/altece/AdaptiveTyping",
    "license": {
        "type": "MIT",
        "file": "LICENSE.txt"
    },
    "authors": {
        "Steven Brunwasser": "[email protected]"
    },
    "source": {
        "git": "https://github.com/altece/AdaptiveTyping.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "11.0"
    },
    "source_files": "AdaptiveTyping/**/*.{h,m,swift}",
    "frameworks": [
        "UIKit"
    ],
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This