Skip to content

Commit bc8450e

Browse files
committed
Swift4.2
1 parent 538e7fb commit bc8450e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Demo/ViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class ViewController: UIViewController {
3333
super.viewDidLoad()
3434
// Do any additional setup after loading the view, typically from a nib.
3535

36-
NotificationCenter.default.addObserver(self, selector: #selector(ViewController.keyboardWillShow(_:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
36+
NotificationCenter.default.addObserver(self, selector: #selector(ViewController.keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
3737

38-
NotificationCenter.default.addObserver(self, selector: #selector(ViewController.keyboardWillHide(_:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
38+
NotificationCenter.default.addObserver(self, selector: #selector(ViewController.keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
3939

4040
self.growingTextView.layer.cornerRadius = 4
4141
self.growingTextView.backgroundColor = UIColor(white: 0.9, alpha: 1)
@@ -64,7 +64,7 @@ class ViewController: UIViewController {
6464

6565
@objc func keyboardWillHide(_ sender: Notification) {
6666
if let userInfo = (sender as NSNotification).userInfo {
67-
if let _ = (userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.size.height {
67+
if let _ = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.size.height {
6868
//key point 0,
6969
self.inputContainerViewBottom.constant = 0
7070
//textViewBottomConstraint.constant = keyboardHeight
@@ -74,7 +74,7 @@ class ViewController: UIViewController {
7474
}
7575
@objc func keyboardWillShow(_ sender: Notification) {
7676
if let userInfo = (sender as NSNotification).userInfo {
77-
if let keyboardHeight = (userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.size.height {
77+
if let keyboardHeight = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.size.height {
7878
self.inputContainerViewBottom.constant = keyboardHeight
7979
UIView.animate(withDuration: 0.25, animations: { () -> Void in
8080
self.view.layoutIfNeeded()

NextGrowingTextView.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@
320320
SDKROOT = iphoneos;
321321
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
322322
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
323-
SWIFT_VERSION = 4.0;
323+
SWIFT_VERSION = 4.2;
324324
TARGETED_DEVICE_FAMILY = "1,2";
325325
VERSIONING_SYSTEM = "apple-generic";
326326
VERSION_INFO_PREFIX = "";
@@ -366,7 +366,7 @@
366366
MTL_ENABLE_DEBUG_INFO = NO;
367367
SDKROOT = iphoneos;
368368
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
369-
SWIFT_VERSION = 4.0;
369+
SWIFT_VERSION = 4.2;
370370
TARGETED_DEVICE_FAMILY = "1,2";
371371
VALIDATE_PRODUCT = YES;
372372
VERSIONING_SYSTEM = "apple-generic";

NextGrowingTextView/NextGrowingInternalTextView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ internal class NextGrowingInternalTextView: UITextView {
3535
override init(frame: CGRect, textContainer: NSTextContainer?) {
3636
super.init(frame: frame, textContainer: textContainer)
3737

38-
NotificationCenter.default.addObserver(self, selector: #selector(NextGrowingInternalTextView.textDidChangeNotification(_ :)), name: NSNotification.Name.UITextViewTextDidChange, object: self)
38+
NotificationCenter.default.addObserver(self, selector: #selector(NextGrowingInternalTextView.textDidChangeNotification(_ :)), name: UITextView.textDidChangeNotification, object: self)
3939
}
4040

4141
required init?(coder aDecoder: NSCoder) {

0 commit comments

Comments
 (0)