diff --git a/Example/GrowingTextView.xcodeproj/project.pbxproj b/Example/GrowingTextView.xcodeproj/project.pbxproj index 587361b..89d454c 100644 --- a/Example/GrowingTextView.xcodeproj/project.pbxproj +++ b/Example/GrowingTextView.xcodeproj/project.pbxproj @@ -219,7 +219,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { 607FACCF1AFB9204008FA782 = { @@ -429,12 +429,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -482,12 +484,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; diff --git a/Example/GrowingTextView.xcodeproj/xcshareddata/xcschemes/GrowingTextView-Example.xcscheme b/Example/GrowingTextView.xcodeproj/xcshareddata/xcschemes/GrowingTextView-Example.xcscheme index 8c419d6..de87694 100644 --- a/Example/GrowingTextView.xcodeproj/xcshareddata/xcschemes/GrowingTextView-Example.xcscheme +++ b/Example/GrowingTextView.xcodeproj/xcshareddata/xcschemes/GrowingTextView-Example.xcscheme @@ -1,6 +1,6 @@ + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/GrowingTextView/Base.lproj/Main.storyboard b/Example/GrowingTextView/Base.lproj/Main.storyboard index 58ed205..1948bbe 100644 --- a/Example/GrowingTextView/Base.lproj/Main.storyboard +++ b/Example/GrowingTextView/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -124,10 +124,10 @@ - + - + diff --git a/Example/GrowingTextView/Example1.swift b/Example/GrowingTextView/Example1.swift index 4a8cd35..2a8f663 100644 --- a/Example/GrowingTextView/Example1.swift +++ b/Example/GrowingTextView/Example1.swift @@ -75,7 +75,7 @@ class Example1: UIViewController { @objc private func keyboardWillChangeFrame(_ notification: Notification) { if let endFrame = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { - var keyboardHeight = view.bounds.height - endFrame.origin.y + var keyboardHeight = UIScreen.main.bounds.height - endFrame.origin.y if #available(iOS 11, *) { if keyboardHeight > 0 { keyboardHeight = keyboardHeight - view.safeAreaInsets.bottom diff --git a/Example/GrowingTextView/Example2.swift b/Example/GrowingTextView/Example2.swift index 7a2c3d9..ec4b4c8 100644 --- a/Example/GrowingTextView/Example2.swift +++ b/Example/GrowingTextView/Example2.swift @@ -35,7 +35,7 @@ class Example2: UIViewController { @objc private func keyboardWillChangeFrame(_ notification: Notification) { if let endFrame = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { - var keyboardHeight = view.bounds.height - endFrame.origin.y + var keyboardHeight = UIScreen.main.bounds.height - endFrame.origin.y if #available(iOS 11, *) { if keyboardHeight > 0 { keyboardHeight = keyboardHeight - view.safeAreaInsets.bottom diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index aa86a07..7e7c772 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -319,7 +319,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; TargetAttributes = { 1337470D3533D5288D3734A53202D210 = { LastSwiftMigration = 0800; @@ -408,12 +408,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -564,12 +566,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; diff --git a/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/GrowingTextView.xcscheme b/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/GrowingTextView.xcscheme index cf11959..4ed25be 100644 --- a/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/GrowingTextView.xcscheme +++ b/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/GrowingTextView.xcscheme @@ -1,6 +1,6 @@ @@ -37,7 +36,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/GrowingTextView.podspec b/GrowingTextView.podspec index 3df7d5f..854ca4b 100644 --- a/GrowingTextView.podspec +++ b/GrowingTextView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "GrowingTextView" - s.version = "0.5.5" + s.version = "0.5.6" s.summary = "UITextView on Swift 3 and Swift 4. Support auto growing, placeholder and length limit." # This description is used to generate tags and improve search results. diff --git a/Pod/Classes/GrowingTextView.swift b/Pod/Classes/GrowingTextView.swift index 35e56dd..004ae04 100644 --- a/Pod/Classes/GrowingTextView.swift +++ b/Pod/Classes/GrowingTextView.swift @@ -168,12 +168,10 @@ open class GrowingTextView: UITextView { // Trim white space and new line characters when end editing. @objc func textDidEndEditing(notification: Notification) { - if let notificationObject = notification.object as? GrowingTextView { - if notificationObject === self { - if trimWhiteSpaceWhenEndEditing { - text = text?.trimmingCharacters(in: .whitespacesAndNewlines) - setNeedsDisplay() - } + if let sender = notification.object as? GrowingTextView, sender == self { + if trimWhiteSpaceWhenEndEditing { + text = text?.trimmingCharacters(in: .whitespacesAndNewlines) + setNeedsDisplay() } scrollToCorrectPosition() } @@ -191,4 +189,3 @@ open class GrowingTextView: UITextView { } } } -