๐Ÿ“ฆ calda / AdaptiveFormSheet

:arrow_up: A Modal Presentation Controller that adapts to content size, keyboard visibility, and touch input.

โ˜… 5 stars โ‘‚ 0 forks ๐Ÿ‘ 5 watching โš–๏ธ MIT License
๐Ÿ“ฅ Clone https://github.com/calda/AdaptiveFormSheet.git
HTTPS git clone https://github.com/calda/AdaptiveFormSheet.git
SSH git clone git@github.com:calda/AdaptiveFormSheet.git
CLI gh repo clone calda/AdaptiveFormSheet
Cal Stephens Cal Stephens Increase the deployment target to iOS 10, and add support for opening the modal with a first responder initially selected 339c5c2 7 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ AdaptiveFormSheet
๐Ÿ“ Demo-App
๐Ÿ“„ .gitignore
๐Ÿ“„ LICENSE
๐Ÿ“„ README.md
๐Ÿ“„ README.md

AdaptiveFormSheet

A Modal Presentation Controller that adapts to content size, keyboard visibility, and touch input.

Features

  • Presents your modal over current context, dimming the presenting view controller
  • Keeps your modal centered in the available space
  • Automatically responds to keyboard events
  • Ensures the current First Responder is always visible

Installation

You can use AdaptiveFormSheet in your own projects through Carthage.

Add github "calda/AdaptiveFormSheet" to your Cartfile and run carthage update.

Usage

If your View Controller subclasses AFSModalViewController, presentations from segues or through UIViewController.present(_:animated:completion:) will automatically adopt this presentation style:

import AdaptiveFormSheet

class MyModelViewController: AFSModalViewController {
   ...
}

AdaptiveFormSheet uses preferredContentSize to decide how large to make your modal. It may be able to infer this automatically, but you can also override the property in your subclass to define it explicitly:

override var preferredContentSize: CGSize {
    get { return CGSize(width: 300, height: 450) }
    set { }
}