Răsfoiți Sursa

- Added couple of compile time validations for Xcode 11, iOS 13
- DisplayMode Default is renamed to default, I think this will not be a big deal to rename.
- Removed support for Xcode 8
- Swift Code Style improvements using swiftlint

iftekhar_qurashi 6 ani în urmă
părinte
comite
012ef1dd3c
27 a modificat fișierele cu 544 adăugiri și 542 ștergeri
  1. 15 2
      .gitignore
  2. 2 2
      Demo/Objective_C_Demo/Resources/Info.plist
  3. 2 2
      Demo/Swift_Demo/Resources/Info.plist
  4. 2 2
      IQKeyboardManager.podspec.json
  5. BIN
      IQKeyboardManager.xcodeproj/project.xcworkspace/xcuserdata/iemacbook01.xcuserdatad/UserInterfaceState.xcuserstate
  6. 0 3
      IQKeyboardManager/Constants/IQKeyboardManagerConstantsInternal.h
  7. 95 27
      IQKeyboardManager/IQKeyboardManager.m
  8. 2 18
      IQKeyboardManager/IQKeyboardReturnKeyHandler.m
  9. 0 2
      IQKeyboardManager/IQToolbar/IQTitleBarButtonItem.m
  10. 8 16
      IQKeyboardManager/IQToolbar/IQToolbar.m
  11. 0 26
      IQKeyboardManager/IQToolbar/IQUIView+IQKeyboardToolbar.m
  12. 4 3
      IQKeyboardManagerSwift.podspec.json
  13. 7 20
      IQKeyboardManagerSwift/Categories/IQNSArray+Sort.swift
  14. 2 2
      IQKeyboardManagerSwift/Categories/IQUIScrollView+Additions.swift
  15. 5 6
      IQKeyboardManagerSwift/Categories/IQUITextFieldView+Additions.swift
  16. 32 43
      IQKeyboardManagerSwift/Categories/IQUIView+Hierarchy.swift
  17. 2 4
      IQKeyboardManagerSwift/Categories/IQUIViewController+Additions.swift
  18. 7 10
      IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstants.swift
  19. 0 3
      IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstantsInternal.swift
  20. 198 151
      IQKeyboardManagerSwift/IQKeyboardManager.swift
  21. 27 35
      IQKeyboardManagerSwift/IQKeyboardReturnKeyHandler.swift
  22. 9 13
      IQKeyboardManagerSwift/IQTextView/IQTextView.swift
  23. 8 10
      IQKeyboardManagerSwift/IQToolbar/IQBarButtonItem.swift
  24. 1 2
      IQKeyboardManagerSwift/IQToolbar/IQInvocation.swift
  25. 20 21
      IQKeyboardManagerSwift/IQToolbar/IQTitleBarButtonItem.swift
  26. 45 58
      IQKeyboardManagerSwift/IQToolbar/IQToolbar.swift
  27. 51 61
      IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift

+ 15 - 2
.gitignore

@@ -1,5 +1,4 @@
 # Xcode
 # Xcode
-#
 build/
 build/
 *.pbxuser
 *.pbxuser
 !default.pbxuser
 !default.pbxuser
@@ -16,11 +15,25 @@ DerivedData
 *.hmap
 *.hmap
 *.ipa
 *.ipa
 *.xcuserstate
 *.xcuserstate
+
+#CocoaPods
 Pods/
 Pods/
 
 
 # MacOS X
 # MacOS X
-#
 .DS_Store
 .DS_Store
 *.DS_Store
 *.DS_Store
 **/.DS_Store
 **/.DS_Store
 
 
+#Swift Package Manager
+.build
+/.previous-build
+*~
+\#*
+.\#*
+*.xcscmblueprint
+/default.profraw
+Utilities/Docker/*.tar.gz
+.swiftpm
+Packages/
+Package.pins
+Package.resolved

+ 2 - 2
Demo/Objective_C_Demo/Resources/Info.plist

@@ -17,11 +17,11 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>6.3</string>
+	<string>6.4</string>
 	<key>CFBundleSignature</key>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<string>????</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>6.3.0</string>
+	<string>6.4.0</string>
 	<key>LSRequiresIPhoneOS</key>
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
 	<true/>
 	<key>UILaunchStoryboardName</key>
 	<key>UILaunchStoryboardName</key>

+ 2 - 2
Demo/Swift_Demo/Resources/Info.plist

@@ -17,11 +17,11 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>6.3</string>
+	<string>6.4</string>
 	<key>CFBundleSignature</key>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<string>????</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>6.3.0</string>
+	<string>6.4.0</string>
 	<key>LSRequiresIPhoneOS</key>
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
 	<true/>
 	<key>UILaunchStoryboardName</key>
 	<key>UILaunchStoryboardName</key>

+ 2 - 2
IQKeyboardManager.podspec.json

@@ -1,9 +1,9 @@
 {
 {
   "name": "IQKeyboardManager",
   "name": "IQKeyboardManager",
-  "version": "6.3.0",
+  "version": "6.4.0",
   "source": {
   "source": {
     "git": "https://github.com/hackiftekhar/IQKeyboardManager.git",
     "git": "https://github.com/hackiftekhar/IQKeyboardManager.git",
-    "tag": "v6.3.0"
+    "tag": "v6.4.0"
   },
   },
   "summary": "Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView.",
   "summary": "Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView.",
   "homepage": "https://github.com/hackiftekhar/IQKeyboardManager",
   "homepage": "https://github.com/hackiftekhar/IQKeyboardManager",

BIN
IQKeyboardManager.xcodeproj/project.xcworkspace/xcuserdata/iemacbook01.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 3
IQKeyboardManager/Constants/IQKeyboardManagerConstantsInternal.h

@@ -25,7 +25,4 @@
 #define IQKeyboardManagerConstantsInternal_h
 #define IQKeyboardManagerConstantsInternal_h
 
 
 
 
-#define IQ_IS_IOS10_OR_GREATER ([[NSProcessInfo processInfo] operatingSystemVersion].majorVersion >= 10)
-#define IQ_IS_IOS9_OR_GREATER ([[NSProcessInfo processInfo] operatingSystemVersion].majorVersion >= 9)
-
 #endif
 #endif

+ 95 - 27
IQKeyboardManager/IQKeyboardManager.m

@@ -51,6 +51,10 @@
 #import <UIKit/UIWindow.h>
 #import <UIKit/UIWindow.h>
 #import <UIKit/NSLayoutConstraint.h>
 #import <UIKit/NSLayoutConstraint.h>
 #import <UIKit/UIStackView.h>
 #import <UIKit/UIStackView.h>
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
+#import <UIKit/UIWindowScene.h>
+#import <UIKit/UIStatusBarManager.h>
+#endif
 
 
 NSInteger const kIQDoneButtonToolbarTag             =   -1002;
 NSInteger const kIQDoneButtonToolbarTag             =   -1002;
 NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
 NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
@@ -650,8 +654,21 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
             kbSize = intersectRect.size;
             kbSize = intersectRect.size;
         }
         }
     }
     }
-    
-    CGFloat navigationBarAreaHeight = [[UIApplication sharedApplication] statusBarFrame].size.height + rootController.navigationController.navigationBar.frame.size.height;
+
+    CGFloat statusBarHeight = 0;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
+    if (@available(iOS 13.0, *)) {
+        statusBarHeight = [self keyWindow].windowScene.statusBarManager.statusBarFrame.size.height;
+
+    } else
+#endif
+    {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 130000
+        statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
+#endif
+    }
+
+    CGFloat navigationBarAreaHeight = statusBarHeight + rootController.navigationController.navigationBar.frame.size.height;
     CGFloat layoutAreaHeight = rootController.view.layoutMargins.top;
     CGFloat layoutAreaHeight = rootController.view.layoutMargins.top;
     
     
     CGFloat topLayoutGuide = MAX(navigationBarAreaHeight, layoutAreaHeight) + 5;
     CGFloat topLayoutGuide = MAX(navigationBarAreaHeight, layoutAreaHeight) + 5;
@@ -710,11 +727,8 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
                 [self showLog:[NSString stringWithFormat:@"Restoring ScrollView contentOffset to : %@",NSStringFromCGPoint(_startingContentOffset)]];
                 [self showLog:[NSString stringWithFormat:@"Restoring ScrollView contentOffset to : %@",NSStringFromCGPoint(_startingContentOffset)]];
                 
                 
                 BOOL animatedContentOffset = NO;    //  (Bug ID: #1365, #1508, #1541)
                 BOOL animatedContentOffset = NO;    //  (Bug ID: #1365, #1508, #1541)
-#ifdef __IPHONE_11_0
+
                 if (@available(iOS 9.0, *))
                 if (@available(iOS 9.0, *))
-#else
-                if (IQ_IS_IOS9_OR_GREATER)
-#endif
                 {
                 {
                     animatedContentOffset = ([textFieldView superviewOfClassType:[UIStackView class] belowView:strongLastScrollView] != nil);
                     animatedContentOffset = ([textFieldView superviewOfClassType:[UIStackView class] belowView:strongLastScrollView] != nil);
                 }
                 }
@@ -755,11 +769,8 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
                 [self showLog:[NSString stringWithFormat:@"Restoring ScrollView contentOffset to : %@",NSStringFromCGPoint(_startingContentOffset)]];
                 [self showLog:[NSString stringWithFormat:@"Restoring ScrollView contentOffset to : %@",NSStringFromCGPoint(_startingContentOffset)]];
 
 
                 BOOL animatedContentOffset = NO;    //  (Bug ID: #1365, #1508, #1541)
                 BOOL animatedContentOffset = NO;    //  (Bug ID: #1365, #1508, #1541)
-#ifdef __IPHONE_11_0
+
                 if (@available(iOS 9.0, *))
                 if (@available(iOS 9.0, *))
-#else
-                if (IQ_IS_IOS9_OR_GREATER)
-#endif
                 {
                 {
                     animatedContentOffset = ([textFieldView superviewOfClassType:[UIStackView class] belowView:strongLastScrollView] != nil);
                     animatedContentOffset = ([textFieldView superviewOfClassType:[UIStackView class] belowView:strongLastScrollView] != nil);
                 }
                 }
@@ -774,8 +785,17 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
             _lastScrollView = superScrollView;
             _lastScrollView = superScrollView;
             strongLastScrollView = _lastScrollView;
             strongLastScrollView = _lastScrollView;
             _startingContentInsets = superScrollView.contentInset;
             _startingContentInsets = superScrollView.contentInset;
-            _startingScrollIndicatorInsets = superScrollView.scrollIndicatorInsets;
             _startingContentOffset = superScrollView.contentOffset;
             _startingContentOffset = superScrollView.contentOffset;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
+            if (@available(iOS 11.1, *)) {
+                _startingScrollIndicatorInsets = superScrollView.verticalScrollIndicatorInsets;
+            } else
+#endif
+            {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 130000
+                _startingScrollIndicatorInsets = superScrollView.scrollIndicatorInsets;
+#endif
+            }
 
 
             [self showLog:[NSString stringWithFormat:@"Saving New contentInset: %@ and contentOffset : %@",NSStringFromUIEdgeInsets(_startingContentInsets),NSStringFromCGPoint(_startingContentOffset)]];
             [self showLog:[NSString stringWithFormat:@"Saving New contentInset: %@ and contentOffset : %@",NSStringFromUIEdgeInsets(_startingContentInsets),NSStringFromCGPoint(_startingContentOffset)]];
         }
         }
@@ -788,7 +808,16 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
         strongLastScrollView = _lastScrollView;
         strongLastScrollView = _lastScrollView;
         _startingContentInsets = superScrollView.contentInset;
         _startingContentInsets = superScrollView.contentInset;
         _startingContentOffset = superScrollView.contentOffset;
         _startingContentOffset = superScrollView.contentOffset;
-        _startingScrollIndicatorInsets = superScrollView.scrollIndicatorInsets;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
+        if (@available(iOS 11.1, *)) {
+            _startingScrollIndicatorInsets = superScrollView.verticalScrollIndicatorInsets;
+        } else
+#endif
+        {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 130000
+            _startingScrollIndicatorInsets = superScrollView.scrollIndicatorInsets;
+#endif
+        }
 
 
         [self showLog:[NSString stringWithFormat:@"Saving contentInset: %@ and contentOffset : %@",NSStringFromUIEdgeInsets(_startingContentInsets),NSStringFromCGPoint(_startingContentOffset)]];
         [self showLog:[NSString stringWithFormat:@"Saving contentInset: %@ and contentOffset : %@",NSStringFromUIEdgeInsets(_startingContentInsets),NSStringFromCGPoint(_startingContentOffset)]];
     }
     }
@@ -946,11 +975,8 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
                         [strongSelf showLog:[NSString stringWithFormat:@"Remaining Move: %.2f",move]];
                         [strongSelf showLog:[NSString stringWithFormat:@"Remaining Move: %.2f",move]];
                         
                         
                         BOOL animatedContentOffset = NO;    //  (Bug ID: #1365, #1508, #1541)
                         BOOL animatedContentOffset = NO;    //  (Bug ID: #1365, #1508, #1541)
-#ifdef __IPHONE_11_0
+
                         if (@available(iOS 9.0, *))
                         if (@available(iOS 9.0, *))
-#else
-                        if (IQ_IS_IOS9_OR_GREATER)
-#endif
                         {
                         {
                             animatedContentOffset = ([textFieldView superviewOfClassType:[UIStackView class] belowView:superScrollView] != nil);
                             animatedContentOffset = ([textFieldView superviewOfClassType:[UIStackView class] belowView:superScrollView] != nil);
                         }
                         }
@@ -995,8 +1021,18 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
                     [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{
                     [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{
                         
                         
                         strongLastScrollView.contentInset = movedInsets;
                         strongLastScrollView.contentInset = movedInsets;
-                        
-                        UIEdgeInsets newInset = strongLastScrollView.scrollIndicatorInsets;
+                        UIEdgeInsets newInset;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
+                        if (@available(iOS 11.1, *)) {
+                            newInset = strongLastScrollView.verticalScrollIndicatorInsets;
+                        } else
+#endif
+                        {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 130000
+                            newInset = strongLastScrollView.scrollIndicatorInsets;
+#endif
+                        }
+
                         newInset.bottom = movedInsets.bottom;
                         newInset.bottom = movedInsets.bottom;
                         strongLastScrollView.scrollIndicatorInsets = newInset;
                         strongLastScrollView.scrollIndicatorInsets = newInset;
                         
                         
@@ -1029,7 +1065,17 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
                 if (self.isTextViewContentInsetChanged == NO)
                 if (self.isTextViewContentInsetChanged == NO)
                 {
                 {
                     self.startingTextViewContentInsets = textView.contentInset;
                     self.startingTextViewContentInsets = textView.contentInset;
-                    self.startingTextViewScrollIndicatorInsets = textView.scrollIndicatorInsets;
+                    
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
+                    if (@available(iOS 11.1, *)) {
+                        self.startingTextViewScrollIndicatorInsets = textView.verticalScrollIndicatorInsets;
+                    } else
+#endif
+                    {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 130000
+                        self.startingTextViewScrollIndicatorInsets = textView.scrollIndicatorInsets;
+#endif
+                    }
                 }
                 }
 
 
                 UIEdgeInsets newContentInset = textView.contentInset;
                 UIEdgeInsets newContentInset = textView.contentInset;
@@ -1345,11 +1391,8 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
                 [strongSelf showLog:[NSString stringWithFormat:@"Restoring ScrollView contentOffset to : %@",NSStringFromCGPoint(strongSelf.startingContentOffset)]];
                 [strongSelf showLog:[NSString stringWithFormat:@"Restoring ScrollView contentOffset to : %@",NSStringFromCGPoint(strongSelf.startingContentOffset)]];
 
 
                 BOOL animatedContentOffset = NO;    //  (Bug ID: #1365, #1508, #1541)
                 BOOL animatedContentOffset = NO;    //  (Bug ID: #1365, #1508, #1541)
-#ifdef __IPHONE_11_0
+
                 if (@available(iOS 9.0, *))
                 if (@available(iOS 9.0, *))
-#else
-                if (IQ_IS_IOS9_OR_GREATER)
-#endif
                 {
                 {
                     animatedContentOffset = ([strongTextFieldView superviewOfClassType:[UIStackView class] belowView:strongLastScrollView] != nil);
                     animatedContentOffset = ([strongTextFieldView superviewOfClassType:[UIStackView class] belowView:strongLastScrollView] != nil);
                 }
                 }
@@ -1378,11 +1421,8 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
                         [self showLog:[NSString stringWithFormat:@"Restoring contentOffset to : %@",NSStringFromCGPoint(newContentOffset)]];
                         [self showLog:[NSString stringWithFormat:@"Restoring contentOffset to : %@",NSStringFromCGPoint(newContentOffset)]];
 
 
                         BOOL animatedContentOffset = NO;    //  (Bug ID: #1365, #1508, #1541)
                         BOOL animatedContentOffset = NO;    //  (Bug ID: #1365, #1508, #1541)
-#ifdef __IPHONE_11_0
+
                         if (@available(iOS 9.0, *))
                         if (@available(iOS 9.0, *))
-#else
-                        if (IQ_IS_IOS9_OR_GREATER)
-#endif
                         {
                         {
                             animatedContentOffset = ([strongSelf.textFieldView superviewOfClassType:[UIStackView class] belowView:superscrollView] != nil);
                             animatedContentOffset = ([strongSelf.textFieldView superviewOfClassType:[UIStackView class] belowView:superscrollView] != nil);
                         }
                         }
@@ -1590,6 +1630,28 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
 /**  UIApplicationWillChangeStatusBarOrientationNotification. Need to set the textView to it's original position. If any frame changes made. (Bug ID: #92)*/
 /**  UIApplicationWillChangeStatusBarOrientationNotification. Need to set the textView to it's original position. If any frame changes made. (Bug ID: #92)*/
 - (void)willChangeStatusBarOrientation:(NSNotification*)aNotification
 - (void)willChangeStatusBarOrientation:(NSNotification*)aNotification
 {
 {
+    UIInterfaceOrientation currentStatusBarOrientation = UIInterfaceOrientationUnknown;
+
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
+    if (@available(iOS 13.0, *)) {
+        currentStatusBarOrientation = [self keyWindow].windowScene.interfaceOrientation;
+    } else
+#endif
+    {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 130000
+        currentStatusBarOrientation = UIApplication.sharedApplication.statusBarOrientation;
+#endif
+    }
+    
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+    UIInterfaceOrientation statusBarOrientation = [aNotification.userInfo[UIApplicationStatusBarOrientationUserInfoKey] integerValue];
+#pragma clang diagnostic pop
+    
+    if (statusBarOrientation != currentStatusBarOrientation) {
+        return;
+    }
+    
     CFTimeInterval startTime = CACurrentMediaTime();
     CFTimeInterval startTime = CACurrentMediaTime();
     [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1];
     [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1];
 
 
@@ -2260,7 +2322,10 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
        didEndEditingNotificationName:UITextViewTextDidEndEditingNotification];
        didEndEditingNotificationName:UITextViewTextDidEndEditingNotification];
     
     
     //  Registering for orientation changes notification
     //  Registering for orientation changes notification
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willChangeStatusBarOrientation:) name:UIApplicationWillChangeStatusBarOrientationNotification object:[UIApplication sharedApplication]];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willChangeStatusBarOrientation:) name:UIApplicationWillChangeStatusBarOrientationNotification object:[UIApplication sharedApplication]];
+#pragma clang diagnostic pop
 }
 }
 
 
 -(void)unregisterAllNotifications
 -(void)unregisterAllNotifications
@@ -2282,7 +2347,10 @@ NSInteger const kIQPreviousNextButtonToolbarTag     =   -1005;
        didEndEditingNotificationName:UITextViewTextDidEndEditingNotification];
        didEndEditingNotificationName:UITextViewTextDidEndEditingNotification];
     
     
     //  Unregistering for orientation changes notification
     //  Unregistering for orientation changes notification
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarOrientationNotification object:[UIApplication sharedApplication]];
     [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarOrientationNotification object:[UIApplication sharedApplication]];
+#pragma clang diagnostic pop
 }
 }
 
 
 -(void)showLog:(NSString*)logString
 -(void)showLog:(NSString*)logString

+ 2 - 18
IQKeyboardManager/IQKeyboardReturnKeyHandler.m

@@ -345,14 +345,10 @@
         delegate = modal.textFieldDelegate;
         delegate = modal.textFieldDelegate;
     }
     }
     
     
-#ifdef __IPHONE_11_0
     if (@available(iOS 10.0, *)) {
     if (@available(iOS 10.0, *)) {
-#endif
         if ([delegate respondsToSelector:@selector(textFieldDidEndEditing:reason:)])
         if ([delegate respondsToSelector:@selector(textFieldDidEndEditing:reason:)])
             [delegate textFieldDidEndEditing:textField reason:reason];
             [delegate textFieldDidEndEditing:textField reason:reason];
-#ifdef __IPHONE_11_0
     }
     }
-#endif
 }
 }
 
 
 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
@@ -539,14 +535,10 @@
         delegate = modal.textViewDelegate;
         delegate = modal.textViewDelegate;
     }
     }
     
     
-#ifdef __IPHONE_11_0
     if (@available(iOS 10.0, *)) {
     if (@available(iOS 10.0, *)) {
-#endif
         if ([delegate respondsToSelector:@selector(textView:shouldInteractWithURL:inRange:interaction:)])
         if ([delegate respondsToSelector:@selector(textView:shouldInteractWithURL:inRange:interaction:)])
             return [delegate textView:textView shouldInteractWithURL:URL inRange:characterRange interaction:interaction];
             return [delegate textView:textView shouldInteractWithURL:URL inRange:characterRange interaction:interaction];
-#ifdef __IPHONE_11_0
     }
     }
-#endif
 
 
     return YES;
     return YES;
 }
 }
@@ -561,18 +553,15 @@
         delegate = modal.textViewDelegate;
         delegate = modal.textViewDelegate;
     }
     }
     
     
-#ifdef __IPHONE_11_0
     if (@available(iOS 10.0, *)) {
     if (@available(iOS 10.0, *)) {
-#endif
     if ([delegate respondsToSelector:@selector(textView:shouldInteractWithTextAttachment:inRange:interaction:)])
     if ([delegate respondsToSelector:@selector(textView:shouldInteractWithTextAttachment:inRange:interaction:)])
         return [delegate textView:textView shouldInteractWithTextAttachment:textAttachment inRange:characterRange interaction:interaction];
         return [delegate textView:textView shouldInteractWithTextAttachment:textAttachment inRange:characterRange interaction:interaction];
-#ifdef __IPHONE_11_0
     }
     }
-#endif
 
 
     return YES;
     return YES;
 }
 }
 
 
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 100000
 - (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange
 - (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange
 {
 {
     id<UITextViewDelegate> delegate = self.delegate;
     id<UITextViewDelegate> delegate = self.delegate;
@@ -583,11 +572,8 @@
         delegate = modal.textViewDelegate;
         delegate = modal.textViewDelegate;
     }
     }
     
     
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     if ([delegate respondsToSelector:@selector(textView:shouldInteractWithURL:inRange:)])
     if ([delegate respondsToSelector:@selector(textView:shouldInteractWithURL:inRange:)])
         return [delegate textView:textView shouldInteractWithURL:URL inRange:characterRange];
         return [delegate textView:textView shouldInteractWithURL:URL inRange:characterRange];
-#pragma clang diagnostic pop
     else
     else
         return YES;
         return YES;
 }
 }
@@ -602,14 +588,12 @@
         delegate = modal.textViewDelegate;
         delegate = modal.textViewDelegate;
     }
     }
     
     
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     if ([delegate respondsToSelector:@selector(textView:shouldInteractWithTextAttachment:inRange:)])
     if ([delegate respondsToSelector:@selector(textView:shouldInteractWithTextAttachment:inRange:)])
         return [delegate textView:textView shouldInteractWithTextAttachment:textAttachment inRange:characterRange];
         return [delegate textView:textView shouldInteractWithTextAttachment:textAttachment inRange:characterRange];
-#pragma clang diagnostic pop
     else
     else
         return YES;
         return YES;
 }
 }
+#endif
 
 
 -(void)dealloc
 -(void)dealloc
 {
 {

+ 0 - 2
IQKeyboardManager/IQToolbar/IQTitleBarButtonItem.m

@@ -56,7 +56,6 @@
         [self setTitleFont:[UIFont systemFontOfSize:13.0]];
         [self setTitleFont:[UIFont systemFontOfSize:13.0]];
         [_titleView addSubview:_titleButton];
         [_titleView addSubview:_titleButton];
         
         
-#ifdef __IPHONE_11_0
         if (@available(iOS 11.0, *))
         if (@available(iOS 11.0, *))
         {
         {
             CGFloat layoutDefaultLowPriority = UILayoutPriorityDefaultLow-1;
             CGFloat layoutDefaultLowPriority = UILayoutPriorityDefaultLow-1;
@@ -81,7 +80,6 @@
             [_titleView addConstraints:@[top,bottom,leading,trailing]];
             [_titleView addConstraints:@[top,bottom,leading,trailing]];
         }
         }
         else
         else
-#endif
         {
         {
             _titleView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
             _titleView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
             _titleButton.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
             _titleButton.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;

+ 8 - 16
IQKeyboardManager/IQToolbar/IQToolbar.m

@@ -140,18 +140,14 @@
     if (_fixedSpaceBarButton == nil)
     if (_fixedSpaceBarButton == nil)
     {
     {
         _fixedSpaceBarButton = [[IQBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
         _fixedSpaceBarButton = [[IQBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
-#ifdef __IPHONE_11_0
         if (@available(iOS 10.0, *))
         if (@available(iOS 10.0, *))
-#else
-            if (IQ_IS_IOS10_OR_GREATER)
-#endif
-            {
-                [_fixedSpaceBarButton setWidth:6];
-            }
-            else
-            {
-                [_fixedSpaceBarButton setWidth:20];
-            }
+        {
+            [_fixedSpaceBarButton setWidth:6];
+        }
+        else
+        {
+            [_fixedSpaceBarButton setWidth:20];
+        }
     }
     }
     
     
     return _fixedSpaceBarButton;
     return _fixedSpaceBarButton;
@@ -197,12 +193,8 @@
 {
 {
     [super layoutSubviews];
     [super layoutSubviews];
 
 
-    //If running on Xcode9 (iOS11) only then we'll validate for iOS version, otherwise for older versions of Xcode (iOS10 and below) we'll just execute the tweak
-#ifdef __IPHONE_11_0
     if (@available(iOS 11.0, *)) {}
     if (@available(iOS 11.0, *)) {}
-    else
-#endif
-    {
+    else {
         CGRect leftRect = CGRectNull;
         CGRect leftRect = CGRectNull;
         CGRect rightRect = CGRectNull;
         CGRect rightRect = CGRectNull;
         
         

+ 0 - 26
IQKeyboardManager/IQToolbar/IQUIView+IQKeyboardToolbar.m

@@ -87,16 +87,12 @@
         keyboardPreviousiOS9Image = [UIImage imageNamed:@"IQButtonBarArrowLeft" inBundle:resourcesBundle compatibleWithTraitCollection:nil];;
         keyboardPreviousiOS9Image = [UIImage imageNamed:@"IQButtonBarArrowLeft" inBundle:resourcesBundle compatibleWithTraitCollection:nil];;
         
         
         //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)
         //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)
-#ifdef __IPHONE_11_0
         if (@available(iOS 9.0, *)) {
         if (@available(iOS 9.0, *)) {
-#endif
             if ([UIImage instancesRespondToSelector:@selector(imageFlippedForRightToLeftLayoutDirection)])
             if ([UIImage instancesRespondToSelector:@selector(imageFlippedForRightToLeftLayoutDirection)])
             {
             {
                 keyboardPreviousiOS9Image = [keyboardPreviousiOS9Image imageFlippedForRightToLeftLayoutDirection];
                 keyboardPreviousiOS9Image = [keyboardPreviousiOS9Image imageFlippedForRightToLeftLayoutDirection];
             }
             }
-#ifdef __IPHONE_11_0
         }
         }
-#endif
     }
     }
     
     
     return keyboardPreviousiOS9Image;
     return keyboardPreviousiOS9Image;
@@ -121,16 +117,12 @@
         keyboardNextiOS9Image = [UIImage imageNamed:@"IQButtonBarArrowRight" inBundle:resourcesBundle compatibleWithTraitCollection:nil];
         keyboardNextiOS9Image = [UIImage imageNamed:@"IQButtonBarArrowRight" inBundle:resourcesBundle compatibleWithTraitCollection:nil];
         
         
         //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)
         //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)
-#ifdef __IPHONE_11_0
         if (@available(iOS 9.0, *)) {
         if (@available(iOS 9.0, *)) {
-#endif
             if ([UIImage instancesRespondToSelector:@selector(imageFlippedForRightToLeftLayoutDirection)])
             if ([UIImage instancesRespondToSelector:@selector(imageFlippedForRightToLeftLayoutDirection)])
             {
             {
                 keyboardNextiOS9Image = [keyboardNextiOS9Image imageFlippedForRightToLeftLayoutDirection];
                 keyboardNextiOS9Image = [keyboardNextiOS9Image imageFlippedForRightToLeftLayoutDirection];
             }
             }
-#ifdef __IPHONE_11_0
         }
         }
-#endif
     }
     }
     
     
     return keyboardNextiOS9Image;
     return keyboardNextiOS9Image;
@@ -155,16 +147,12 @@
         keyboardPreviousiOS10Image = [UIImage imageNamed:@"IQButtonBarArrowUp" inBundle:resourcesBundle compatibleWithTraitCollection:nil];
         keyboardPreviousiOS10Image = [UIImage imageNamed:@"IQButtonBarArrowUp" inBundle:resourcesBundle compatibleWithTraitCollection:nil];
         
         
         //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)
         //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)
-#ifdef __IPHONE_11_0
         if (@available(iOS 9.0, *)) {
         if (@available(iOS 9.0, *)) {
-#endif
             if ([UIImage instancesRespondToSelector:@selector(imageFlippedForRightToLeftLayoutDirection)])
             if ([UIImage instancesRespondToSelector:@selector(imageFlippedForRightToLeftLayoutDirection)])
             {
             {
                 keyboardPreviousiOS10Image = [keyboardPreviousiOS10Image imageFlippedForRightToLeftLayoutDirection];
                 keyboardPreviousiOS10Image = [keyboardPreviousiOS10Image imageFlippedForRightToLeftLayoutDirection];
             }
             }
-#ifdef __IPHONE_11_0
         }
         }
-#endif
     }
     }
     
     
     return keyboardPreviousiOS10Image;
     return keyboardPreviousiOS10Image;
@@ -189,16 +177,12 @@
         keyboardNextiOS10Image = [UIImage imageNamed:@"IQButtonBarArrowDown" inBundle:resourcesBundle compatibleWithTraitCollection:nil];
         keyboardNextiOS10Image = [UIImage imageNamed:@"IQButtonBarArrowDown" inBundle:resourcesBundle compatibleWithTraitCollection:nil];
         
         
         //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)
         //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)
-#ifdef __IPHONE_11_0
         if (@available(iOS 9.0, *)) {
         if (@available(iOS 9.0, *)) {
-#endif
             if ([UIImage instancesRespondToSelector:@selector(imageFlippedForRightToLeftLayoutDirection)])
             if ([UIImage instancesRespondToSelector:@selector(imageFlippedForRightToLeftLayoutDirection)])
             {
             {
                 keyboardNextiOS10Image = [keyboardNextiOS10Image imageFlippedForRightToLeftLayoutDirection];
                 keyboardNextiOS10Image = [keyboardNextiOS10Image imageFlippedForRightToLeftLayoutDirection];
             }
             }
-#ifdef __IPHONE_11_0
         }
         }
-#endif
     }
     }
     
     
     return keyboardNextiOS10Image;
     return keyboardNextiOS10Image;
@@ -206,11 +190,7 @@
 
 
 +(UIImage*)keyboardPreviousImage
 +(UIImage*)keyboardPreviousImage
 {
 {
-#ifdef __IPHONE_11_0
     if (@available(iOS 10.0, *))
     if (@available(iOS 10.0, *))
-#else
-    if (IQ_IS_IOS10_OR_GREATER)
-#endif
     {
     {
         return [UIImage keyboardPreviousiOS10Image];
         return [UIImage keyboardPreviousiOS10Image];
     }
     }
@@ -222,11 +202,7 @@
 
 
 +(UIImage*)keyboardNextImage
 +(UIImage*)keyboardNextImage
 {
 {
-#ifdef __IPHONE_11_0
     if (@available(iOS 10.0, *))
     if (@available(iOS 10.0, *))
-#else
-    if (IQ_IS_IOS10_OR_GREATER)
-#endif
     {
     {
         return [UIImage keyboardNextiOS10Image];
         return [UIImage keyboardNextiOS10Image];
     }
     }
@@ -432,10 +408,8 @@
         
         
         //Title button
         //Title button
         toolbar.titleBarButton.title = titleText;
         toolbar.titleBarButton.title = titleText;
-#ifdef __IPHONE_11_0
         if (@available(iOS 11.0, *)) {}
         if (@available(iOS 11.0, *)) {}
         else
         else
-#endif
         {
         {
             toolbar.titleBarButton.customView.frame = CGRectZero;
             toolbar.titleBarButton.customView.frame = CGRectZero;
         }
         }

+ 4 - 3
IQKeyboardManagerSwift.podspec.json

@@ -1,9 +1,9 @@
 {
 {
   "name": "IQKeyboardManagerSwift",
   "name": "IQKeyboardManagerSwift",
-  "version": "6.3.0",
+  "version": "6.4.0",
   "source": {
   "source": {
     "git": "https://github.com/hackiftekhar/IQKeyboardManager.git",
     "git": "https://github.com/hackiftekhar/IQKeyboardManager.git",
-    "tag": "v6.3.0"
+    "tag": "v6.4.0"
   },
   },
   "summary": "Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView.",
   "summary": "Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView.",
   "homepage": "https://github.com/hackiftekhar/IQKeyboardManager",
   "homepage": "https://github.com/hackiftekhar/IQKeyboardManager",
@@ -20,7 +20,8 @@
     "3.2",
     "3.2",
     "4.0",
     "4.0",
     "4.2",
     "4.2",
-    "5.0"
+    "5.0",
+    "5.1"
   ],
   ],
   "source_files": "IQKeyboardManagerSwift/**/*.{swift}",
   "source_files": "IQKeyboardManagerSwift/**/*.{swift}",
   "resources": "IQKeyboardManagerSwift/Resources/IQKeyboardManager.bundle",
   "resources": "IQKeyboardManagerSwift/Resources/IQKeyboardManager.bundle",

+ 7 - 20
IQKeyboardManagerSwift/Categories/IQNSArray+Sort.swift

@@ -27,7 +27,7 @@ import UIKit
 /**
 /**
 UIView.subviews sorting category.
 UIView.subviews sorting category.
 */
 */
-internal extension Array {
+internal extension Array where Element: UIView {
     
     
     ///--------------
     ///--------------
     /// MARK: Sorting
     /// MARK: Sorting
@@ -38,12 +38,9 @@ internal extension Array {
     */
     */
     func sortedArrayByTag() -> [Element] {
     func sortedArrayByTag() -> [Element] {
         
         
-        return sorted(by: { (obj1 : Element, obj2 : Element) -> Bool in
+        return sorted(by: { (obj1: Element, obj2: Element) -> Bool in
             
             
-            let view1 = obj1 as! UIView
-            let view2 = obj2 as! UIView
-            
-            return (view1.tag < view2.tag)
+            return (obj1.tag < obj2.tag)
         })
         })
     }
     }
     
     
@@ -52,22 +49,12 @@ internal extension Array {
     */
     */
     func sortedArrayByPosition() -> [Element] {
     func sortedArrayByPosition() -> [Element] {
         
         
-        return sorted(by: { (obj1 : Element, obj2 : Element) -> Bool in
-            
-            let view1 = obj1 as! UIView
-            let view2 = obj2 as! UIView
-            
-            let x1 = view1.frame.minX
-            let y1 = view1.frame.minY
-            let x2 = view2.frame.minX
-            let y2 = view2.frame.minY
-            
-            if y1 != y2 {
-                return y1 < y2
+        return sorted(by: { (obj1: Element, obj2: Element) -> Bool in
+            if obj1.frame.minY != obj2.frame.minY {
+                return obj1.frame.minY < obj2.frame.minY
             } else {
             } else {
-                return x1 < x2
+                return obj1.frame.minX < obj2.frame.minX
             }
             }
         })
         })
     }
     }
 }
 }
-

+ 2 - 2
IQKeyboardManagerSwift/Categories/IQUIScrollView+Additions.swift

@@ -66,7 +66,7 @@ private var kIQShouldRestoreScrollViewContentOffset = "kIQShouldRestoreScrollVie
 
 
 internal extension UITableView {
 internal extension UITableView {
     
     
-    func previousIndexPath(of indexPath:IndexPath) -> IndexPath? {
+    func previousIndexPath(of indexPath: IndexPath) -> IndexPath? {
         var previousRow = indexPath.row - 1
         var previousRow = indexPath.row - 1
         var previousSection = indexPath.section
         var previousSection = indexPath.section
         
         
@@ -89,7 +89,7 @@ internal extension UITableView {
 
 
 internal extension UICollectionView {
 internal extension UICollectionView {
     
     
-    func previousIndexPath(of indexPath:IndexPath) -> IndexPath? {
+    func previousIndexPath(of indexPath: IndexPath) -> IndexPath? {
         var previousRow = indexPath.row - 1
         var previousRow = indexPath.row - 1
         var previousSection = indexPath.section
         var previousSection = indexPath.section
         
         

+ 5 - 6
IQKeyboardManagerSwift/Categories/IQUITextFieldView+Additions.swift

@@ -31,7 +31,7 @@ public let kIQUseDefaultKeyboardDistance = CGFloat.greatestFiniteMagnitude
 
 
 private var kIQKeyboardDistanceFromTextField = "kIQKeyboardDistanceFromTextField"
 private var kIQKeyboardDistanceFromTextField = "kIQKeyboardDistanceFromTextField"
 //private var kIQKeyboardEnableMode = "kIQKeyboardEnableMode"
 //private var kIQKeyboardEnableMode = "kIQKeyboardEnableMode"
-private var kIQKeyboardShouldResignOnTouchOutsideMode = "kIQKeyboardShouldResignOnTouchOutsideMode"
+private var kIQShouldResignOnTouchOutsideMode = "kIQShouldResignOnTouchOutsideMode"
 private var kIQIgnoreSwitchingByNextPrevious = "kIQIgnoreSwitchingByNextPrevious"
 private var kIQIgnoreSwitchingByNextPrevious = "kIQIgnoreSwitchingByNextPrevious"
 
 
 /**
 /**
@@ -82,7 +82,7 @@ UIView category for managing UITextField/UITextView
 //            if let savedMode = objc_getAssociatedObject(self, &kIQKeyboardEnableMode) as? IQEnableMode {
 //            if let savedMode = objc_getAssociatedObject(self, &kIQKeyboardEnableMode) as? IQEnableMode {
 //                return savedMode
 //                return savedMode
 //            } else {
 //            } else {
-//                return .Default
+//                return .default
 //            }
 //            }
 //        }
 //        }
 //        set(newValue) {
 //        set(newValue) {
@@ -96,15 +96,14 @@ UIView category for managing UITextField/UITextView
     @objc var shouldResignOnTouchOutsideMode: IQEnableMode {
     @objc var shouldResignOnTouchOutsideMode: IQEnableMode {
         get {
         get {
             
             
-            if let savedMode = objc_getAssociatedObject(self, &kIQKeyboardShouldResignOnTouchOutsideMode) as? IQEnableMode {
+            if let savedMode = objc_getAssociatedObject(self, &kIQShouldResignOnTouchOutsideMode) as? IQEnableMode {
                 return savedMode
                 return savedMode
             } else {
             } else {
-                return .Default
+                return .default
             }
             }
         }
         }
         set(newValue) {
         set(newValue) {
-            objc_setAssociatedObject(self, &kIQKeyboardShouldResignOnTouchOutsideMode, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
+            objc_setAssociatedObject(self, &kIQShouldResignOnTouchOutsideMode, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
         }
         }
     }
     }
 }
 }
-

+ 32 - 43
IQKeyboardManagerSwift/Categories/IQUIView+Hierarchy.swift

@@ -21,7 +21,6 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 
 
-
 import UIKit
 import UIKit
 
 
 /**
 /**
@@ -36,7 +35,7 @@ UIView hierarchy category.
     /**
     /**
     Returns the UIViewController object that manages the receiver.
     Returns the UIViewController object that manages the receiver.
     */
     */
-    @objc func viewContainingController()->UIViewController? {
+    @objc func viewContainingController() -> UIViewController? {
         
         
         var nextResponder: UIResponder? = self
         var nextResponder: UIResponder? = self
         
         
@@ -55,7 +54,7 @@ UIView hierarchy category.
     /**
     /**
     Returns the topMost UIViewController object in hierarchy.
     Returns the topMost UIViewController object in hierarchy.
     */
     */
-    @objc func topMostController()->UIViewController? {
+    @objc func topMostController() -> UIViewController? {
         
         
         var controllersHierarchy = [UIViewController]()
         var controllersHierarchy = [UIViewController]()
 
 
@@ -69,9 +68,9 @@ UIView hierarchy category.
                 controllersHierarchy.append(presented)
                 controllersHierarchy.append(presented)
             }
             }
             
             
-            var matchController :UIResponder? = viewContainingController()
+            var matchController: UIResponder? = viewContainingController()
 
 
-            while matchController != nil && controllersHierarchy.contains(matchController as! UIViewController) == false {
+            while let mController = matchController as? UIViewController, controllersHierarchy.contains(mController) == false {
                 
                 
                 repeat {
                 repeat {
                     matchController = matchController?.next
                     matchController = matchController?.next
@@ -89,10 +88,10 @@ UIView hierarchy category.
     /**
     /**
      Returns the UIViewController object that is actually the parent of this object. Most of the time it's the viewController object which actually contains it, but result may be different if it's viewController is added as childViewController of another viewController.
      Returns the UIViewController object that is actually the parent of this object. Most of the time it's the viewController object which actually contains it, but result may be different if it's viewController is added as childViewController of another viewController.
      */
      */
-    @objc func parentContainerViewController()->UIViewController? {
+    @objc func parentContainerViewController() -> UIViewController? {
         
         
         var matchController = viewContainingController()
         var matchController = viewContainingController()
-        var parentContainerViewController : UIViewController?
+        var parentContainerViewController: UIViewController?
 
 
         if var navController = matchController?.navigationController {
         if var navController = matchController?.navigationController {
             
             
@@ -100,7 +99,7 @@ UIView hierarchy category.
                 navController = parentNav
                 navController = parentNav
             }
             }
             
             
-            var parentController : UIViewController = navController
+            var parentController: UIViewController = navController
 
 
             while let parent = parentController.parent,
             while let parent = parentController.parent,
                 (parent.isKind(of: UINavigationController.self) == false &&
                 (parent.isKind(of: UINavigationController.self) == false &&
@@ -115,8 +114,7 @@ UIView hierarchy category.
             } else {
             } else {
                 parentContainerViewController = parentController
                 parentContainerViewController = parentController
             }
             }
-        }
-        else if let tabController = matchController?.tabBarController {
+        } else if let tabController = matchController?.tabBarController {
             
             
             if let navController = tabController.selectedViewController as? UINavigationController {
             if let navController = tabController.selectedViewController as? UINavigationController {
                 parentContainerViewController = navController.topViewController
                 parentContainerViewController = navController.topViewController
@@ -153,7 +151,7 @@ UIView hierarchy category.
      
      
      @param belowView view object in upper hierarchy where method should stop searching and return nil
      @param belowView view object in upper hierarchy where method should stop searching and return nil
 */
 */
-    @objc func superviewOfClassType(_ classType:UIView.Type, belowView:UIView? = nil) -> UIView? {
+    @objc func superviewOfClassType(_ classType: UIView.Type, belowView: UIView? = nil) -> UIView? {
 
 
         var superView = superview
         var superView = superview
         
         
@@ -164,7 +162,7 @@ UIView hierarchy category.
                 //If it's UIScrollView, then validating for special cases
                 //If it's UIScrollView, then validating for special cases
                 if unwrappedSuperView.isKind(of: UIScrollView.self) {
                 if unwrappedSuperView.isKind(of: UIScrollView.self) {
                     
                     
-                    let classNameString = NSStringFromClass(type(of:unwrappedSuperView.self))
+                    let classNameString = NSStringFromClass(type(of: unwrappedSuperView.self))
 
 
                     //  If it's not UITableViewWrapperView class, this is internal class which is actually manage in UITableview. The speciality of this class is that it's superview is UITableView.
                     //  If it's not UITableViewWrapperView class, this is internal class which is actually manage in UITableview. The speciality of this class is that it's superview is UITableView.
                     //  If it's not UITableViewCellScrollView class, this is internal class which is actually manage in UITableviewCell. The speciality of this class is that it's superview is UITableViewCell.
                     //  If it's not UITableViewCellScrollView class, this is internal class which is actually manage in UITableviewCell. The speciality of this class is that it's superview is UITableViewCell.
@@ -174,8 +172,7 @@ UIView hierarchy category.
                         classNameString.hasPrefix("_") == false {
                         classNameString.hasPrefix("_") == false {
                         return superView
                         return superView
                     }
                     }
-                }
-                else {
+                } else {
                     return superView
                     return superView
                 }
                 }
             } else if unwrappedSuperView == belowView {
             } else if unwrappedSuperView == belowView {
@@ -191,7 +188,7 @@ UIView hierarchy category.
     /**
     /**
     Returns all siblings of the receiver which canBecomeFirstResponder.
     Returns all siblings of the receiver which canBecomeFirstResponder.
     */
     */
-    internal func responderSiblings()->[UIView] {
+    internal func responderSiblings() -> [UIView] {
 
 
         //Array of (UITextField/UITextView's).
         //Array of (UITextField/UITextView's).
         var tempTextFields = [UIView]()
         var tempTextFields = [UIView]()
@@ -201,7 +198,7 @@ UIView hierarchy category.
             
             
             for textField in siblings {
             for textField in siblings {
                 
                 
-                if (textField == self || textField.ignoreSwitchingByNextPrevious == false) && textField._IQcanBecomeFirstResponder() == true {
+                if (textField == self || textField.ignoreSwitchingByNextPrevious == false) && textField.IQcanBecomeFirstResponder() == true {
                     tempTextFields.append(textField)
                     tempTextFields.append(textField)
                 }
                 }
             }
             }
@@ -213,14 +210,14 @@ UIView hierarchy category.
     /**
     /**
     Returns all deep subViews of the receiver which canBecomeFirstResponder.
     Returns all deep subViews of the receiver which canBecomeFirstResponder.
     */
     */
-    internal func deepResponderViews()->[UIView] {
+    internal func deepResponderViews() -> [UIView] {
         
         
         //Array of (UITextField/UITextView's).
         //Array of (UITextField/UITextView's).
         var textfields = [UIView]()
         var textfields = [UIView]()
         
         
         for textField in subviews {
         for textField in subviews {
             
             
-            if (textField == self || textField.ignoreSwitchingByNextPrevious == false) && textField._IQcanBecomeFirstResponder() == true {
+            if (textField == self || textField.ignoreSwitchingByNextPrevious == false) && textField.IQcanBecomeFirstResponder() == true {
                 textfields.append(textField)
                 textfields.append(textField)
             }
             }
 
 
@@ -234,40 +231,35 @@ UIView hierarchy category.
         }
         }
         
         
         //subviews are returning in opposite order. Sorting according the frames 'y'.
         //subviews are returning in opposite order. Sorting according the frames 'y'.
-        return textfields.sorted(by: { (view1 : UIView, view2 : UIView) -> Bool in
+        return textfields.sorted(by: { (view1: UIView, view2: UIView) -> Bool in
             
             
             let frame1 = view1.convert(view1.bounds, to: self)
             let frame1 = view1.convert(view1.bounds, to: self)
             let frame2 = view2.convert(view2.bounds, to: self)
             let frame2 = view2.convert(view2.bounds, to: self)
 
 
-            let x1 = frame1.minX
-            let y1 = frame1.minY
-            let x2 = frame2.minX
-            let y2 = frame2.minY
-            
-            if y1 != y2 {
-                return y1 < y2
+            if frame1.minY != frame2.minY {
+                return frame1.minY < frame2.minY
             } else {
             } else {
-                return x1 < x2
+                return frame1.minX < frame2.minX
             }
             }
         })
         })
     }
     }
     
     
-    private func _IQcanBecomeFirstResponder() -> Bool {
+    private func IQcanBecomeFirstResponder() -> Bool {
         
         
-        var _IQcanBecomeFirstResponder = false
+        var IQcanBecomeFirstResponder = false
         
         
         //  Setting toolbar to keyboard.
         //  Setting toolbar to keyboard.
         if let textField = self as? UITextField {
         if let textField = self as? UITextField {
-            _IQcanBecomeFirstResponder = textField.isEnabled
+            IQcanBecomeFirstResponder = textField.isEnabled
         } else if let textView = self as? UITextView {
         } else if let textView = self as? UITextView {
-            _IQcanBecomeFirstResponder = textView.isEditable
+            IQcanBecomeFirstResponder = textView.isEditable
         }
         }
         
         
-        if _IQcanBecomeFirstResponder == true {
-            _IQcanBecomeFirstResponder = isUserInteractionEnabled == true && isHidden == false && alpha != 0.0 && isAlertViewTextField() == false && textFieldSearchBar() == nil
+        if IQcanBecomeFirstResponder == true {
+            IQcanBecomeFirstResponder = isUserInteractionEnabled == true && isHidden == false && alpha != 0.0 && isAlertViewTextField() == false && textFieldSearchBar() == nil
         }
         }
 
 
-        return _IQcanBecomeFirstResponder
+        return IQcanBecomeFirstResponder
     }
     }
 
 
     ///-------------------------
     ///-------------------------
@@ -277,9 +269,9 @@ UIView hierarchy category.
     /**
     /**
      Returns searchBar if receiver object is UISearchBarTextField, otherwise return nil.
      Returns searchBar if receiver object is UISearchBarTextField, otherwise return nil.
     */
     */
-    internal func textFieldSearchBar()-> UISearchBar? {
+    internal func textFieldSearchBar() -> UISearchBar? {
         
         
-        var responder : UIResponder? = self.next
+        var responder: UIResponder? = self.next
         
         
         while let bar = responder {
         while let bar = responder {
             
             
@@ -298,9 +290,9 @@ UIView hierarchy category.
     /**
     /**
     Returns YES if the receiver object is UIAlertSheetTextField, otherwise return NO.
     Returns YES if the receiver object is UIAlertSheetTextField, otherwise return NO.
     */
     */
-    internal func isAlertViewTextField()->Bool {
+    internal func isAlertViewTextField() -> Bool {
         
         
-        var alertViewController : UIResponder? = viewContainingController()
+        var alertViewController: UIResponder? = viewContainingController()
         
         
         var isAlertViewTextField = false
         var isAlertViewTextField = false
         
         
@@ -317,8 +309,8 @@ UIView hierarchy category.
         return isAlertViewTextField
         return isAlertViewTextField
     }
     }
     
     
-    private func depth()->Int {
-        var depth : Int = 0
+    private func depth() -> Int {
+        var depth: Int = 0
         
         
         if let superView = superview {
         if let superView = superview {
             depth = superView.depth()+1
             depth = superView.depth()+1
@@ -342,6 +334,3 @@ extension NSObject {
         return "<\(self) \(Unmanaged.passUnretained(self).toOpaque())>"
         return "<\(self) \(Unmanaged.passUnretained(self).toOpaque())>"
     }
     }
 }
 }
-
-
-

+ 2 - 4
IQKeyboardManagerSwift/Categories/IQUIViewController+Additions.swift

@@ -23,10 +23,8 @@
 
 
 import UIKit
 import UIKit
 
 
-
 private var kIQLayoutGuideConstraint = "kIQLayoutGuideConstraint"
 private var kIQLayoutGuideConstraint = "kIQLayoutGuideConstraint"
 
 
-
 @objc public extension UIViewController {
 @objc public extension UIViewController {
 
 
     /**
     /**
@@ -34,7 +32,7 @@ private var kIQLayoutGuideConstraint = "kIQLayoutGuideConstraint"
      
      
      @deprecated    Due to change in core-logic of handling distance between textField and keyboard distance, this layout contraint tweak is no longer needed and things will just work out of the box regardless of constraint pinned with safeArea/layoutGuide/superview
      @deprecated    Due to change in core-logic of handling distance between textField and keyboard distance, this layout contraint tweak is no longer needed and things will just work out of the box regardless of constraint pinned with safeArea/layoutGuide/superview
     */
     */
-    @available(*,deprecated, message: "Due to change in core-logic of handling distance between textField and keyboard distance, this layout contraint tweak is no longer needed and things will just work out of the box regardless of constraint pinned with safeArea/layoutGuide/superview.")
+    @available(*, deprecated, message: "Due to change in core-logic of handling distance between textField and keyboard distance, this layout contraint tweak is no longer needed and things will just work out of the box regardless of constraint pinned with safeArea/layoutGuide/superview.")
     @IBOutlet @objc var IQLayoutGuideConstraint: NSLayoutConstraint? {
     @IBOutlet @objc var IQLayoutGuideConstraint: NSLayoutConstraint? {
         get {
         get {
             
             
@@ -42,7 +40,7 @@ private var kIQLayoutGuideConstraint = "kIQLayoutGuideConstraint"
         }
         }
 
 
         set(newValue) {
         set(newValue) {
-            objc_setAssociatedObject(self, &kIQLayoutGuideConstraint, newValue,objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
+            objc_setAssociatedObject(self, &kIQLayoutGuideConstraint, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
         }
         }
     }
     }
 }
 }

+ 7 - 10
IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstants.swift

@@ -21,7 +21,6 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 
 
-
 import Foundation
 import Foundation
 
 
 ///-----------------------------------
 ///-----------------------------------
@@ -38,7 +37,7 @@ Creates Toolbar according to tag property of TextField's.
 `IQAutoToolbarByPosition`
 `IQAutoToolbarByPosition`
 Creates Toolbar according to the y,x position of textField in it's superview coordinate.
 Creates Toolbar according to the y,x position of textField in it's superview coordinate.
 */
 */
-@objc public enum IQAutoToolbarManageBehaviour : Int {
+@objc public enum IQAutoToolbarManageBehaviour: Int {
     case bySubviews
     case bySubviews
     case byTag
     case byTag
     case byPosition
     case byPosition
@@ -54,8 +53,8 @@ Creates Toolbar according to the y,x position of textField in it's superview coo
  `IQPreviousNextDisplayModeAlwaysShow`
  `IQPreviousNextDisplayModeAlwaysShow`
  Always show nextPrevious buttons, if there are more than 1 textField then both buttons will be visible but will be shown as disabled.
  Always show nextPrevious buttons, if there are more than 1 textField then both buttons will be visible but will be shown as disabled.
  */
  */
-@objc public enum IQPreviousNextDisplayMode : Int {
-    case Default
+@objc public enum IQPreviousNextDisplayMode: Int {
+    case `default`
     case alwaysHide
     case alwaysHide
     case alwaysShow
     case alwaysShow
 }
 }
@@ -70,21 +69,19 @@ Creates Toolbar according to the y,x position of textField in it's superview coo
  `IQEnableModeDisabled`
  `IQEnableModeDisabled`
  setting is disabled.
  setting is disabled.
  */
  */
-@objc public enum IQEnableMode : Int {
-    case Default
+@objc public enum IQEnableMode: Int {
+    case `default`
     case enabled
     case enabled
     case disabled
     case disabled
 }
 }
 
 
 /*
 /*
- 
  /---------------------------------------------------------------------------------------------------\
  /---------------------------------------------------------------------------------------------------\
  \---------------------------------------------------------------------------------------------------/
  \---------------------------------------------------------------------------------------------------/
  |                                   iOS Notification Mechanism                                    |
  |                                   iOS Notification Mechanism                                    |
  /---------------------------------------------------------------------------------------------------\
  /---------------------------------------------------------------------------------------------------\
  \---------------------------------------------------------------------------------------------------/
  \---------------------------------------------------------------------------------------------------/
  
  
- 
  ------------------------------------------------------------
  ------------------------------------------------------------
  When UITextField become first responder
  When UITextField become first responder
  ------------------------------------------------------------
  ------------------------------------------------------------
@@ -110,9 +107,9 @@ Creates Toolbar according to the y,x position of textField in it's superview coo
  ------------------------------------------------------------
  ------------------------------------------------------------
  When switching focus from UITextView to another UITextView
  When switching focus from UITextView to another UITextView
  ------------------------------------------------------------
  ------------------------------------------------------------
- - UITextViewTextDidEndEditingNotification : (UITextView1)
+ - UITextViewTextDidEndEditingNotification: (UITextView1)
  - UIKeyboardWillShowNotification
  - UIKeyboardWillShowNotification
- - UITextViewTextDidBeginEditingNotification : (UITextView2)
+ - UITextViewTextDidBeginEditingNotification: (UITextView2)
  - UIKeyboardDidShowNotification
  - UIKeyboardDidShowNotification
  
  
  ------------------------------------------------------------
  ------------------------------------------------------------

+ 0 - 3
IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstantsInternal.swift

@@ -21,7 +21,4 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 
 
-
 import Foundation
 import Foundation
-
-

Fișier diff suprimat deoarece este prea mare
+ 198 - 151
IQKeyboardManagerSwift/IQKeyboardManager.swift


+ 27 - 35
IQKeyboardManagerSwift/IQKeyboardReturnKeyHandler.swift

@@ -21,18 +21,17 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 
 
-
 import Foundation
 import Foundation
 import UIKit
 import UIKit
 
 
-fileprivate class IQTextFieldViewInfoModal : NSObject {
+private class IQTextFieldViewInfoModal: NSObject {
 
 
     fileprivate weak var textFieldDelegate: UITextFieldDelegate?
     fileprivate weak var textFieldDelegate: UITextFieldDelegate?
     fileprivate weak var textViewDelegate: UITextViewDelegate?
     fileprivate weak var textViewDelegate: UITextViewDelegate?
     fileprivate weak var textFieldView: UIView?
     fileprivate weak var textFieldView: UIView?
     fileprivate var originalReturnKeyType = UIReturnKeyType.default
     fileprivate var originalReturnKeyType = UIReturnKeyType.default
     
     
-    init(textFieldView : UIView?, textFieldDelegate : UITextFieldDelegate?, textViewDelegate : UITextViewDelegate?, originalReturnKeyType : UIReturnKeyType = .default) {
+    init(textFieldView: UIView?, textFieldDelegate: UITextFieldDelegate?, textViewDelegate: UITextViewDelegate?, originalReturnKeyType: UIReturnKeyType = .default) {
         self.textFieldView = textFieldView
         self.textFieldView = textFieldView
         self.textFieldDelegate = textFieldDelegate
         self.textFieldDelegate = textFieldDelegate
         self.textViewDelegate = textViewDelegate
         self.textViewDelegate = textViewDelegate
@@ -43,9 +42,8 @@ fileprivate class IQTextFieldViewInfoModal : NSObject {
 /**
 /**
 Manages the return key to work like next/done in a view hierarchy.
 Manages the return key to work like next/done in a view hierarchy.
 */
 */
-public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextViewDelegate {
-    
-    
+public class IQKeyboardReturnKeyHandler: NSObject, UITextFieldDelegate, UITextViewDelegate {
+
     ///---------------
     ///---------------
     /// MARK: Settings
     /// MARK: Settings
     ///---------------
     ///---------------
@@ -58,7 +56,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     /**
     /**
     Set the last textfield return key type. Default is UIReturnKeyDefault.
     Set the last textfield return key type. Default is UIReturnKeyDefault.
     */
     */
-    @objc public var lastTextFieldReturnKeyType : UIReturnKeyType = UIReturnKeyType.default {
+    @objc public var lastTextFieldReturnKeyType: UIReturnKeyType = UIReturnKeyType.default {
         
         
         didSet {
         didSet {
             
             
@@ -82,7 +80,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     /**
     /**
     Add all the textFields available in UIViewController's view.
     Add all the textFields available in UIViewController's view.
     */
     */
-    @objc public init(controller : UIViewController) {
+    @objc public init(controller: UIViewController) {
         super.init()
         super.init()
         
         
         addResponderFromView(controller.view)
         addResponderFromView(controller.view)
@@ -107,7 +105,6 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
         
         
         textFieldInfoCache.removeAll()
         textFieldInfoCache.removeAll()
     }
     }
-    
 
 
     ///------------------------
     ///------------------------
     /// MARK: Private variables
     /// MARK: Private variables
@@ -117,7 +114,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     ///------------------------
     ///------------------------
     /// MARK: Private Functions
     /// MARK: Private Functions
     ///------------------------
     ///------------------------
-    private func textFieldViewCachedInfo(_ textField : UIView) -> IQTextFieldViewInfoModal? {
+    private func textFieldViewCachedInfo(_ textField: UIView) -> IQTextFieldViewInfoModal? {
         
         
         for modal in textFieldInfoCache {
         for modal in textFieldInfoCache {
             
             
@@ -132,9 +129,8 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
         return nil
         return nil
     }
     }
 
 
-    private func updateReturnKeyTypeOnTextField(_ view : UIView)
-    {
-        var superConsideredView : UIView?
+    private func updateReturnKeyTypeOnTextField(_ view: UIView) {
+        var superConsideredView: UIView?
         
         
         //If find any consider responderView in it's upper hierarchy then will get deepResponderView. (Bug ID: #347)
         //If find any consider responderView in it's upper hierarchy then will get deepResponderView. (Bug ID: #347)
         for disabledClass in IQKeyboardManager.shared.toolbarPreviousNextAllowedClasses {
         for disabledClass in IQKeyboardManager.shared.toolbarPreviousNextAllowedClasses {
@@ -170,15 +166,14 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
             if let textField = view as? UITextField {
             if let textField = view as? UITextField {
                 
                 
                 //If it's the last textField in responder view, else next
                 //If it's the last textField in responder view, else next
-                textField.returnKeyType = (view == lastView)    ?   lastTextFieldReturnKeyType : UIReturnKeyType.next
+                textField.returnKeyType = (view == lastView)    ?   lastTextFieldReturnKeyType: UIReturnKeyType.next
             } else if let textView = view as? UITextView {
             } else if let textView = view as? UITextView {
                 
                 
                 //If it's the last textField in responder view, else next
                 //If it's the last textField in responder view, else next
-                textView.returnKeyType = (view == lastView)    ?   lastTextFieldReturnKeyType : UIReturnKeyType.next
+                textView.returnKeyType = (view == lastView)    ?   lastTextFieldReturnKeyType: UIReturnKeyType.next
             }
             }
         }
         }
     }
     }
-    
 
 
     ///----------------------------------------------
     ///----------------------------------------------
     /// MARK: Registering/Unregistering textFieldView
     /// MARK: Registering/Unregistering textFieldView
@@ -189,7 +184,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     
     
     @param view UITextField/UITextView object to register.
     @param view UITextField/UITextView object to register.
     */
     */
-    @objc public func addTextFieldView(_ view : UIView) {
+    @objc public func addTextFieldView(_ view: UIView) {
         
         
         let modal = IQTextFieldViewInfoModal(textFieldView: view, textFieldDelegate: nil, textViewDelegate: nil)
         let modal = IQTextFieldViewInfoModal(textFieldView: view, textFieldDelegate: nil, textViewDelegate: nil)
         
         
@@ -214,7 +209,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     
     
     @param view UITextField/UITextView object to unregister.
     @param view UITextField/UITextView object to unregister.
     */
     */
-    @objc public func removeTextFieldView(_ view : UIView) {
+    @objc public func removeTextFieldView(_ view: UIView) {
         
         
         if let modal = textFieldViewCachedInfo(view) {
         if let modal = textFieldViewCachedInfo(view) {
             
             
@@ -240,7 +235,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     
     
     @param view UIView object to register all it's responder subviews.
     @param view UIView object to register all it's responder subviews.
     */
     */
-    @objc public func addResponderFromView(_ view : UIView) {
+    @objc public func addResponderFromView(_ view: UIView) {
         
         
         let textFields = view.deepResponderViews()
         let textFields = view.deepResponderViews()
         
         
@@ -255,7 +250,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     
     
     @param view UIView object to unregister all it's responder subviews.
     @param view UIView object to unregister all it's responder subviews.
     */
     */
-    @objc public func removeResponderFromView(_ view : UIView) {
+    @objc public func removeResponderFromView(_ view: UIView) {
         
         
         let textFields = view.deepResponderViews()
         let textFields = view.deepResponderViews()
         
         
@@ -265,9 +260,9 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
         }
         }
     }
     }
     
     
-    @discardableResult private func goToNextResponderOrResign(_ view : UIView) -> Bool {
+    @discardableResult private func goToNextResponderOrResign(_ view: UIView) -> Bool {
         
         
-        var superConsideredView : UIView?
+        var superConsideredView: UIView?
         
         
         //If find any consider responderView in it's upper hierarchy then will get deepResponderView. (Bug ID: #347)
         //If find any consider responderView in it's upper hierarchy then will get deepResponderView. (Bug ID: #347)
         for disabledClass in IQKeyboardManager.shared.toolbarPreviousNextAllowedClasses {
         for disabledClass in IQKeyboardManager.shared.toolbarPreviousNextAllowedClasses {
@@ -316,7 +311,6 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
             return true
             return true
         }
         }
     }
     }
-    
 
 
     ///---------------------------------------
     ///---------------------------------------
     /// MARK: UITextField/UITextView delegates
     /// MARK: UITextField/UITextView delegates
@@ -353,7 +347,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     @objc public func textFieldDidBeginEditing(_ textField: UITextField) {
     @objc public func textFieldDidBeginEditing(_ textField: UITextField) {
         updateReturnKeyTypeOnTextField(textField)
         updateReturnKeyTypeOnTextField(textField)
         
         
-        var aDelegate : UITextFieldDelegate? = delegate
+        var aDelegate: UITextFieldDelegate? = delegate
         
         
         if aDelegate == nil {
         if aDelegate == nil {
             
             
@@ -367,7 +361,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     
     
     @objc public func textFieldDidEndEditing(_ textField: UITextField) {
     @objc public func textFieldDidEndEditing(_ textField: UITextField) {
         
         
-        var aDelegate : UITextFieldDelegate? = delegate
+        var aDelegate: UITextFieldDelegate? = delegate
         
         
         if aDelegate == nil {
         if aDelegate == nil {
             
             
@@ -383,7 +377,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     @available(iOS 10.0, *)
     @available(iOS 10.0, *)
     @objc public func textFieldDidEndEditing(_ textField: UITextField, reason: UITextField.DidEndEditingReason) {
     @objc public func textFieldDidEndEditing(_ textField: UITextField, reason: UITextField.DidEndEditingReason) {
         
         
-        var aDelegate : UITextFieldDelegate? = delegate
+        var aDelegate: UITextFieldDelegate? = delegate
         
         
         if aDelegate == nil {
         if aDelegate == nil {
             
             
@@ -398,7 +392,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     @available(iOS 10.0, *)
     @available(iOS 10.0, *)
     @objc public func textFieldDidEndEditing(_ textField: UITextField, reason: UITextFieldDidEndEditingReason) {
     @objc public func textFieldDidEndEditing(_ textField: UITextField, reason: UITextFieldDidEndEditingReason) {
 
 
-        var aDelegate : UITextFieldDelegate? = delegate
+        var aDelegate: UITextFieldDelegate? = delegate
     
     
         if aDelegate == nil {
         if aDelegate == nil {
     
     
@@ -437,8 +431,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
 
 
         return true
         return true
     }
     }
-    
-    
+
     @objc public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
     @objc public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
         
         
         var shouldReturn = true
         var shouldReturn = true
@@ -459,8 +452,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
             return goToNextResponderOrResign(textField)
             return goToNextResponderOrResign(textField)
         }
         }
     }
     }
-    
-    
+
     @objc public func textViewShouldBeginEditing(_ textView: UITextView) -> Bool {
     @objc public func textViewShouldBeginEditing(_ textView: UITextView) -> Bool {
         
         
         if delegate == nil {
         if delegate == nil {
@@ -492,7 +484,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     @objc public func textViewDidBeginEditing(_ textView: UITextView) {
     @objc public func textViewDidBeginEditing(_ textView: UITextView) {
         updateReturnKeyTypeOnTextField(textView)
         updateReturnKeyTypeOnTextField(textView)
         
         
-        var aDelegate : UITextViewDelegate? = delegate
+        var aDelegate: UITextViewDelegate? = delegate
         
         
         if aDelegate == nil {
         if aDelegate == nil {
             
             
@@ -506,7 +498,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     
     
     @objc public func textViewDidEndEditing(_ textView: UITextView) {
     @objc public func textViewDidEndEditing(_ textView: UITextView) {
         
         
-        var aDelegate : UITextViewDelegate? = delegate
+        var aDelegate: UITextViewDelegate? = delegate
         
         
         if aDelegate == nil {
         if aDelegate == nil {
             
             
@@ -540,7 +532,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     
     
     @objc public func textViewDidChange(_ textView: UITextView) {
     @objc public func textViewDidChange(_ textView: UITextView) {
         
         
-        var aDelegate : UITextViewDelegate? = delegate
+        var aDelegate: UITextViewDelegate? = delegate
         
         
         if aDelegate == nil {
         if aDelegate == nil {
             
             
@@ -554,7 +546,7 @@ public class IQKeyboardReturnKeyHandler: NSObject , UITextFieldDelegate, UITextV
     
     
     @objc public func textViewDidChangeSelection(_ textView: UITextView) {
     @objc public func textViewDidChangeSelection(_ textView: UITextView) {
         
         
-        var aDelegate : UITextViewDelegate? = delegate
+        var aDelegate: UITextViewDelegate? = delegate
         
         
         if aDelegate == nil {
         if aDelegate == nil {
             
             

+ 9 - 13
IQKeyboardManagerSwift/IQTextView/IQTextView.swift

@@ -21,11 +21,10 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 
 
-
 import UIKit
 import UIKit
 
 
 /** @abstract UITextView with placeholder support   */
 /** @abstract UITextView with placeholder support   */
-open class IQTextView : UITextView {
+open class IQTextView: UITextView {
     
     
     @objc required public init?(coder aDecoder: NSCoder) {
     @objc required public init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)
         super.init(coder: aDecoder)
@@ -36,7 +35,7 @@ open class IQTextView : UITextView {
         let UITextViewTextDidChange = Notification.Name.UITextViewTextDidChange
         let UITextViewTextDidChange = Notification.Name.UITextViewTextDidChange
         #endif
         #endif
 
 
-        NotificationCenter.default.addObserver(self, selector: #selector(self.refreshPlaceholder), name:UITextViewTextDidChange, object: self)
+        NotificationCenter.default.addObserver(self, selector: #selector(self.refreshPlaceholder), name: UITextViewTextDidChange, object: self)
     }
     }
     
     
     @objc override public init(frame: CGRect, textContainer: NSTextContainer?) {
     @objc override public init(frame: CGRect, textContainer: NSTextContainer?) {
@@ -68,11 +67,11 @@ open class IQTextView : UITextView {
         NotificationCenter.default.removeObserver(self)
         NotificationCenter.default.removeObserver(self)
     }
     }
 
 
-    private var placeholderInsets : UIEdgeInsets {
+    private var placeholderInsets: UIEdgeInsets {
         return UIEdgeInsets(top: self.textContainerInset.top, left: self.textContainerInset.left + self.textContainer.lineFragmentPadding, bottom: self.textContainerInset.bottom, right: self.textContainerInset.right + self.textContainer.lineFragmentPadding)
         return UIEdgeInsets(top: self.textContainerInset.top, left: self.textContainerInset.left + self.textContainer.lineFragmentPadding, bottom: self.textContainerInset.bottom, right: self.textContainerInset.right + self.textContainer.lineFragmentPadding)
     }
     }
     
     
-    private var placeholderExpectedFrame : CGRect {
+    private var placeholderExpectedFrame: CGRect {
         let placeholderInsets = self.placeholderInsets
         let placeholderInsets = self.placeholderInsets
         let maxWidth = self.frame.width-placeholderInsets.left-placeholderInsets.right
         let maxWidth = self.frame.width-placeholderInsets.left-placeholderInsets.right
         let expectedSize = placeholderLabel.sizeThatFits(CGSize(width: maxWidth, height: self.frame.height-placeholderInsets.top-placeholderInsets.bottom))
         let expectedSize = placeholderLabel.sizeThatFits(CGSize(width: maxWidth, height: self.frame.height-placeholderInsets.top-placeholderInsets.bottom))
@@ -97,7 +96,7 @@ open class IQTextView : UITextView {
     }()
     }()
     
     
     /** @abstract To set textView's placeholder text color. */
     /** @abstract To set textView's placeholder text color. */
-    @IBInspectable open var placeholderTextColor : UIColor? {
+    @IBInspectable open var placeholderTextColor: UIColor? {
         
         
         get {
         get {
             return placeholderLabel.textColor
             return placeholderLabel.textColor
@@ -109,7 +108,7 @@ open class IQTextView : UITextView {
     }
     }
     
     
     /** @abstract To set textView's placeholder text. Default is nil.    */
     /** @abstract To set textView's placeholder text. Default is nil.    */
-    @IBInspectable open var placeholder : String? {
+    @IBInspectable open var placeholder: String? {
         
         
         get {
         get {
             return placeholderLabel.text
             return placeholderLabel.text
@@ -162,7 +161,7 @@ open class IQTextView : UITextView {
         }
         }
     }
     }
     
     
-    @objc override open var font : UIFont? {
+    @objc override open var font: UIFont? {
         
         
         didSet {
         didSet {
             
             
@@ -174,14 +173,13 @@ open class IQTextView : UITextView {
         }
         }
     }
     }
     
     
-    @objc override open var textAlignment: NSTextAlignment
-        {
+    @objc override open var textAlignment: NSTextAlignment {
         didSet {
         didSet {
             placeholderLabel.textAlignment = textAlignment
             placeholderLabel.textAlignment = textAlignment
         }
         }
     }
     }
     
     
-    @objc override open var delegate : UITextViewDelegate? {
+    @objc override open var delegate: UITextViewDelegate? {
         
         
         get {
         get {
             refreshPlaceholder()
             refreshPlaceholder()
@@ -205,5 +203,3 @@ open class IQTextView : UITextView {
         return newSize
         return newSize
     }
     }
 }
 }
-
-

+ 8 - 10
IQKeyboardManagerSwift/IQToolbar/IQBarButtonItem.swift

@@ -21,14 +21,13 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 
 
-
 import UIKit
 import UIKit
 import Foundation
 import Foundation
 
 
 open class IQBarButtonItem: UIBarButtonItem {
 open class IQBarButtonItem: UIBarButtonItem {
 
 
     private static var _classInitialize: Void = classInitialize()
     private static var _classInitialize: Void = classInitialize()
-    
+
     @objc public override init() {
     @objc public override init() {
         _ = IQBarButtonItem._classInitialize
         _ = IQBarButtonItem._classInitialize
           super.init()
           super.init()
@@ -39,18 +38,17 @@ open class IQBarButtonItem: UIBarButtonItem {
            super.init(coder: aDecoder)
            super.init(coder: aDecoder)
        }
        }
 
 
-   
     private class func classInitialize() {
     private class func classInitialize() {
 
 
         let  appearanceProxy = self.appearance()
         let  appearanceProxy = self.appearance()
 
 
         #if swift(>=4.2)
         #if swift(>=4.2)
-        let states : [UIControl.State]
+        let states: [UIControl.State]
         #else
         #else
-        let states : [UIControlState]
+        let states: [UIControlState]
         #endif
         #endif
 
 
-        states = [.normal,.highlighted,.disabled,.selected,.application,.reserved]
+        states = [.normal, .highlighted, .disabled, .selected, .application, .reserved]
 
 
         for state in states {
         for state in states {
 
 
@@ -69,13 +67,13 @@ open class IQBarButtonItem: UIBarButtonItem {
         didSet {
         didSet {
 
 
             #if swift(>=4.2)
             #if swift(>=4.2)
-            var textAttributes = [NSAttributedString.Key : Any]()
+            var textAttributes = [NSAttributedString.Key: Any]()
             let foregroundColorKey = NSAttributedString.Key.foregroundColor
             let foregroundColorKey = NSAttributedString.Key.foregroundColor
             #elseif swift(>=4)
             #elseif swift(>=4)
-            var textAttributes = [NSAttributedStringKey : Any]()
+            var textAttributes = [NSAttributedStringKey: Any]()
             let foregroundColorKey = NSAttributedStringKey.foregroundColor
             let foregroundColorKey = NSAttributedStringKey.foregroundColor
             #else
             #else
-            var textAttributes = [String:Any]()
+            var textAttributes = [String: Any]()
             let foregroundColorKey = NSForegroundColorAttributeName
             let foregroundColorKey = NSForegroundColorAttributeName
             #endif
             #endif
 
 
@@ -127,7 +125,7 @@ open class IQBarButtonItem: UIBarButtonItem {
     /**
     /**
      Customized Invocation to be called when button is pressed. invocation is internally created using setTarget:action: method.
      Customized Invocation to be called when button is pressed. invocation is internally created using setTarget:action: method.
      */
      */
-    @objc open var invocation : IQInvocation?
+    @objc open var invocation: IQInvocation?
     
     
     deinit {
     deinit {
         target = nil
         target = nil

+ 1 - 2
IQKeyboardManagerSwift/IQToolbar/IQInvocation.swift

@@ -21,10 +21,9 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 
 
-
 import UIKit
 import UIKit
 
 
-@objc public class IQInvocation : NSObject {
+@objc public class IQInvocation: NSObject {
     @objc public weak var target: AnyObject?
     @objc public weak var target: AnyObject?
     @objc public var action: Selector
     @objc public var action: Selector
     
     

+ 20 - 21
IQKeyboardManagerSwift/IQToolbar/IQTitleBarButtonItem.swift

@@ -21,13 +21,12 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 
 
-
 import Foundation
 import Foundation
 import UIKit
 import UIKit
 
 
 open class IQTitleBarButtonItem: IQBarButtonItem {
 open class IQTitleBarButtonItem: IQBarButtonItem {
    
    
-    @objc open var titleFont : UIFont? {
+    @objc open var titleFont: UIFont? {
     
     
         didSet {
         didSet {
             if let unwrappedFont = titleFont {
             if let unwrappedFont = titleFont {
@@ -47,14 +46,14 @@ open class IQTitleBarButtonItem: IQBarButtonItem {
     /**
     /**
      titleColor to be used for displaying button text when displaying title (disabled state).
      titleColor to be used for displaying button text when displaying title (disabled state).
      */
      */
-    @objc open var titleColor : UIColor? {
+    @objc open var titleColor: UIColor? {
 
 
         didSet {
         didSet {
             
             
             if let color = titleColor {
             if let color = titleColor {
-                titleButton?.setTitleColor(color, for:.disabled)
+                titleButton?.setTitleColor(color, for: .disabled)
             } else {
             } else {
-                titleButton?.setTitleColor(UIColor.lightGray, for:.disabled)
+                titleButton?.setTitleColor(UIColor.lightGray, for: .disabled)
             }
             }
         }
         }
     }
     }
@@ -62,14 +61,14 @@ open class IQTitleBarButtonItem: IQBarButtonItem {
     /**
     /**
      selectableTitleColor to be used for displaying button text when button is enabled.
      selectableTitleColor to be used for displaying button text when button is enabled.
      */
      */
-    @objc open var selectableTitleColor : UIColor? {
+    @objc open var selectableTitleColor: UIColor? {
         
         
         didSet {
         didSet {
             
             
             if let color = selectableTitleColor {
             if let color = selectableTitleColor {
-                titleButton?.setTitleColor(color, for:.normal)
+                titleButton?.setTitleColor(color, for: .normal)
             } else {
             } else {
-                titleButton?.setTitleColor(UIColor.init(red: 0.0, green: 0.5, blue: 1.0, alpha: 1), for:.normal)
+                titleButton?.setTitleColor(UIColor.init(red: 0.0, green: 0.5, blue: 1.0, alpha: 1), for: .normal)
             }
             }
         }
         }
     }
     }
@@ -77,7 +76,7 @@ open class IQTitleBarButtonItem: IQBarButtonItem {
     /**
     /**
      Customized Invocation to be called on title button action. titleInvocation is internally created using setTitleTarget:action: method.
      Customized Invocation to be called on title button action. titleInvocation is internally created using setTitleTarget:action: method.
      */
      */
-    @objc override open var invocation : IQInvocation? {
+    @objc override open var invocation: IQInvocation? {
 
 
         didSet {
         didSet {
             
             
@@ -93,14 +92,14 @@ open class IQTitleBarButtonItem: IQBarButtonItem {
         }
         }
     }
     }
 
 
-    internal var titleButton : UIButton?
-    private var _titleView : UIView?
+    internal var titleButton: UIButton?
+    private var _titleView: UIView?
 
 
     override init() {
     override init() {
         super.init()
         super.init()
     }
     }
     
     
-    @objc public convenience init(title : String?) {
+    @objc public convenience init(title: String?) {
 
 
         self.init(title: nil, style: .plain, target: nil, action: nil)
         self.init(title: nil, style: .plain, target: nil, action: nil)
         
         
@@ -110,8 +109,8 @@ open class IQTitleBarButtonItem: IQBarButtonItem {
         titleButton = UIButton(type: .system)
         titleButton = UIButton(type: .system)
         titleButton?.isEnabled = false
         titleButton?.isEnabled = false
         titleButton?.titleLabel?.numberOfLines = 3
         titleButton?.titleLabel?.numberOfLines = 3
-        titleButton?.setTitleColor(UIColor.lightGray, for:.disabled)
-        titleButton?.setTitleColor(UIColor.init(red: 0.0, green: 0.5, blue: 1.0, alpha: 1), for:.normal)
+        titleButton?.setTitleColor(UIColor.lightGray, for: .disabled)
+        titleButton?.setTitleColor(UIColor.init(red: 0.0, green: 0.5, blue: 1.0, alpha: 1), for: .normal)
         titleButton?.backgroundColor = UIColor.clear
         titleButton?.backgroundColor = UIColor.clear
         titleButton?.titleLabel?.textAlignment = .center
         titleButton?.titleLabel?.textAlignment = .center
         titleButton?.setTitle(title, for: .normal)
         titleButton?.setTitle(title, for: .normal)
@@ -122,8 +121,8 @@ open class IQTitleBarButtonItem: IQBarButtonItem {
 #if swift(>=3.2)
 #if swift(>=3.2)
         if #available(iOS 11, *) {
         if #available(iOS 11, *) {
             
             
-            var layoutDefaultLowPriority : UILayoutPriority
-            var layoutDefaultHighPriority : UILayoutPriority
+            var layoutDefaultLowPriority: UILayoutPriority
+            var layoutDefaultHighPriority: UILayoutPriority
 
 
             #if swift(>=4.0)
             #if swift(>=4.0)
                 let layoutPriorityLowValue = UILayoutPriority.defaultLow.rawValue-1
                 let layoutPriorityLowValue = UILayoutPriority.defaultLow.rawValue-1
@@ -152,14 +151,14 @@ open class IQTitleBarButtonItem: IQBarButtonItem {
             let leading = NSLayoutConstraint.init(item: titleButton!, attribute: .leading, relatedBy: .equal, toItem: _titleView, attribute: .leading, multiplier: 1, constant: 0)
             let leading = NSLayoutConstraint.init(item: titleButton!, attribute: .leading, relatedBy: .equal, toItem: _titleView, attribute: .leading, multiplier: 1, constant: 0)
             let trailing = NSLayoutConstraint.init(item: titleButton!, attribute: .trailing, relatedBy: .equal, toItem: _titleView, attribute: .trailing, multiplier: 1, constant: 0)
             let trailing = NSLayoutConstraint.init(item: titleButton!, attribute: .trailing, relatedBy: .equal, toItem: _titleView, attribute: .trailing, multiplier: 1, constant: 0)
             
             
-            _titleView?.addConstraints([top,bottom,leading,trailing])
+            _titleView?.addConstraints([top, bottom, leading, trailing])
         } else {
         } else {
-            _titleView?.autoresizingMask = [.flexibleWidth,.flexibleHeight]
-            titleButton?.autoresizingMask = [.flexibleWidth,.flexibleHeight]
+            _titleView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+            titleButton?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
         }
         }
 #else
 #else
-    _titleView?.autoresizingMask = [.flexibleWidth,.flexibleHeight]
-    titleButton?.autoresizingMask = [.flexibleWidth,.flexibleHeight]
+    _titleView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+    titleButton?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
 #endif
 #endif
 
 
         customView = _titleView
         customView = _titleView

+ 45 - 58
IQKeyboardManagerSwift/IQToolbar/IQToolbar.swift

@@ -21,11 +21,10 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 
 
-
 import UIKit
 import UIKit
 
 
 /** @abstract   IQToolbar for IQKeyboardManager.    */
 /** @abstract   IQToolbar for IQKeyboardManager.    */
-open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
+open class IQToolbar: UIToolbar, UIInputViewAudioFeedback {
 
 
     private static var _classInitialize: Void = classInitialize()
     private static var _classInitialize: Void = classInitialize()
     
     
@@ -35,7 +34,7 @@ open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
 
 
         appearanceProxy.barTintColor = nil
         appearanceProxy.barTintColor = nil
         
         
-        let positions : [UIBarPosition] = [.any,.bottom,.top,.topAttached]
+        let positions: [UIBarPosition] = [.any, .bottom, .top, .topAttached]
 
 
         for position in positions {
         for position in positions {
 
 
@@ -51,7 +50,7 @@ open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
      Previous bar button of toolbar.
      Previous bar button of toolbar.
      */
      */
     private var privatePreviousBarButton: IQBarButtonItem?
     private var privatePreviousBarButton: IQBarButtonItem?
-    @objc open var previousBarButton : IQBarButtonItem {
+    @objc open var previousBarButton: IQBarButtonItem {
         get {
         get {
             if privatePreviousBarButton == nil {
             if privatePreviousBarButton == nil {
                 privatePreviousBarButton = IQBarButtonItem(image: nil, style: .plain, target: nil, action: nil)
                 privatePreviousBarButton = IQBarButtonItem(image: nil, style: .plain, target: nil, action: nil)
@@ -69,7 +68,7 @@ open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
      Next bar button of toolbar.
      Next bar button of toolbar.
      */
      */
     private var privateNextBarButton: IQBarButtonItem?
     private var privateNextBarButton: IQBarButtonItem?
-    @objc open var nextBarButton : IQBarButtonItem {
+    @objc open var nextBarButton: IQBarButtonItem {
         get {
         get {
             if privateNextBarButton == nil {
             if privateNextBarButton == nil {
                 privateNextBarButton = IQBarButtonItem(image: nil, style: .plain, target: nil, action: nil)
                 privateNextBarButton = IQBarButtonItem(image: nil, style: .plain, target: nil, action: nil)
@@ -87,7 +86,7 @@ open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
      Title bar button of toolbar.
      Title bar button of toolbar.
      */
      */
     private var privateTitleBarButton: IQTitleBarButtonItem?
     private var privateTitleBarButton: IQTitleBarButtonItem?
-    @objc open var titleBarButton : IQTitleBarButtonItem {
+    @objc open var titleBarButton: IQTitleBarButtonItem {
         get {
         get {
             if privateTitleBarButton == nil {
             if privateTitleBarButton == nil {
                 privateTitleBarButton = IQTitleBarButtonItem(title: nil)
                 privateTitleBarButton = IQTitleBarButtonItem(title: nil)
@@ -105,7 +104,7 @@ open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
      Done bar button of toolbar.
      Done bar button of toolbar.
      */
      */
     private var privateDoneBarButton: IQBarButtonItem?
     private var privateDoneBarButton: IQBarButtonItem?
-    @objc open var doneBarButton : IQBarButtonItem {
+    @objc open var doneBarButton: IQBarButtonItem {
         get {
         get {
             if privateDoneBarButton == nil {
             if privateDoneBarButton == nil {
                 privateDoneBarButton = IQBarButtonItem(title: nil, style: .done, target: nil, action: nil)
                 privateDoneBarButton = IQBarButtonItem(title: nil, style: .done, target: nil, action: nil)
@@ -123,7 +122,7 @@ open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
      Fixed space bar button of toolbar.
      Fixed space bar button of toolbar.
      */
      */
     private var privateFixedSpaceBarButton: IQBarButtonItem?
     private var privateFixedSpaceBarButton: IQBarButtonItem?
-    @objc open var fixedSpaceBarButton : IQBarButtonItem {
+    @objc open var fixedSpaceBarButton: IQBarButtonItem {
         get {
         get {
             if privateFixedSpaceBarButton == nil {
             if privateFixedSpaceBarButton == nil {
                 privateFixedSpaceBarButton = IQBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
                 privateFixedSpaceBarButton = IQBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
@@ -208,17 +207,11 @@ open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
             var rightRect = CGRect.null
             var rightRect = CGRect.null
             var isTitleBarButtonFound = false
             var isTitleBarButtonFound = false
             
             
-            let sortedSubviews = self.subviews.sorted(by: { (view1 : UIView, view2 : UIView) -> Bool in
-                
-                let x1 = view1.frame.minX
-                let y1 = view1.frame.minY
-                let x2 = view2.frame.minX
-                let y2 = view2.frame.minY
-                
-                if x1 != x2 {
-                    return x1 < x2
+            let sortedSubviews = self.subviews.sorted(by: { (view1: UIView, view2: UIView) -> Bool in
+                if view1.frame.minX != view2.frame.minX {
+                    return view1.frame.minX < view2.frame.minX
                 } else {
                 } else {
-                    return y1 < y2
+                    return view1.frame.minY < view2.frame.minY
                 }
                 }
             })
             })
             
             
@@ -235,43 +228,43 @@ open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
                 }
                 }
             }
             }
             
             
-            let titleMargin : CGFloat = 16
+            let titleMargin: CGFloat = 16
 
 
-            let maxWidth : CGFloat = self.frame.width - titleMargin*2 - (leftRect.isNull ? 0 : leftRect.maxX) - (rightRect.isNull ? 0 : self.frame.width - rightRect.minX)
+            let maxWidth: CGFloat = self.frame.width - titleMargin*2 - (leftRect.isNull ? 0 : leftRect.maxX) - (rightRect.isNull ? 0 : self.frame.width - rightRect.minX)
             let maxHeight = self.frame.height
             let maxHeight = self.frame.height
             
             
             let sizeThatFits = customTitleView.sizeThatFits(CGSize(width: maxWidth, height: maxHeight))
             let sizeThatFits = customTitleView.sizeThatFits(CGSize(width: maxWidth, height: maxHeight))
             
             
-            var titleRect : CGRect
+            var titleRect: CGRect
             
             
             if sizeThatFits.width > 0 && sizeThatFits.height > 0 {
             if sizeThatFits.width > 0 && sizeThatFits.height > 0 {
                 let width = min(sizeThatFits.width, maxWidth)
                 let width = min(sizeThatFits.width, maxWidth)
                 let height = min(sizeThatFits.height, maxHeight)
                 let height = min(sizeThatFits.height, maxHeight)
                 
                 
-                var x : CGFloat
+                var xPosition: CGFloat
 
 
-                if (leftRect.isNull == false) {
-                    x = titleMargin + leftRect.maxX + ((maxWidth - width)/2)
+                if leftRect.isNull == false {
+                    xPosition = titleMargin + leftRect.maxX + ((maxWidth - width)/2)
                 } else {
                 } else {
-                    x = titleMargin
+                    xPosition = titleMargin
                 }
                 }
                 
                 
-                let y = (maxHeight - height)/2
+                let yPosition = (maxHeight - height)/2
                 
                 
-                titleRect = CGRect(x: x, y: y, width: width, height: height)
+                titleRect = CGRect(x: xPosition, y: yPosition, width: width, height: height)
             } else {
             } else {
                 
                 
-                var x : CGFloat
+                var xPosition: CGFloat
                 
                 
-                if (leftRect.isNull == false) {
-                    x = titleMargin + leftRect.maxX
+                if leftRect.isNull == false {
+                    xPosition = titleMargin + leftRect.maxX
                 } else {
                 } else {
-                    x = titleMargin
+                    xPosition = titleMargin
                 }
                 }
 
 
-                let width : CGFloat = self.frame.width - titleMargin*2 - (leftRect.isNull ? 0 : leftRect.maxX) - (rightRect.isNull ? 0 : self.frame.width - rightRect.minX)
+                let width: CGFloat = self.frame.width - titleMargin*2 - (leftRect.isNull ? 0 : leftRect.maxX) - (rightRect.isNull ? 0 : self.frame.width - rightRect.minX)
                 
                 
-                titleRect = CGRect(x: x, y: 0, width: width, height: maxHeight)
+                titleRect = CGRect(x: xPosition, y: 0, width: width, height: maxHeight)
             }
             }
             
             
             customTitleView.frame = titleRect
             customTitleView.frame = titleRect
@@ -283,17 +276,11 @@ open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
             var rightRect = CGRect.null
             var rightRect = CGRect.null
             var isTitleBarButtonFound = false
             var isTitleBarButtonFound = false
             
             
-            let sortedSubviews = self.subviews.sorted(by: { (view1 : UIView, view2 : UIView) -> Bool in
-                
-                let x1 = view1.frame.minX
-                let y1 = view1.frame.minY
-                let x2 = view2.frame.minX
-                let y2 = view2.frame.minY
-                
-                if x1 != x2 {
-                    return x1 < x2
+            let sortedSubviews = self.subviews.sorted(by: { (view1: UIView, view2: UIView) -> Bool in
+                if view1.frame.minX != view2.frame.minX {
+                    return view1.frame.minX < view2.frame.minX
                 } else {
                 } else {
-                    return y1 < y2
+                    return view1.frame.minY < view2.frame.minY
                 }
                 }
             })
             })
             
             
@@ -310,42 +297,42 @@ open class IQToolbar: UIToolbar , UIInputViewAudioFeedback {
                 }
                 }
             }
             }
             
             
-            let titleMargin : CGFloat = 16
-            let maxWidth : CGFloat = self.frame.width - titleMargin*2 - (leftRect.isNull ? 0 : leftRect.maxX) - (rightRect.isNull ? 0 : self.frame.width - rightRect.minX)
+            let titleMargin: CGFloat = 16
+            let maxWidth: CGFloat = self.frame.width - titleMargin*2 - (leftRect.isNull ? 0 : leftRect.maxX) - (rightRect.isNull ? 0 : self.frame.width - rightRect.minX)
             let maxHeight = self.frame.height
             let maxHeight = self.frame.height
             
             
             let sizeThatFits = customTitleView.sizeThatFits(CGSize(width: maxWidth, height: maxHeight))
             let sizeThatFits = customTitleView.sizeThatFits(CGSize(width: maxWidth, height: maxHeight))
             
             
-            var titleRect : CGRect
+            var titleRect: CGRect
 
 
             if sizeThatFits.width > 0 && sizeThatFits.height > 0 {
             if sizeThatFits.width > 0 && sizeThatFits.height > 0 {
                 let width = min(sizeThatFits.width, maxWidth)
                 let width = min(sizeThatFits.width, maxWidth)
                 let height = min(sizeThatFits.height, maxHeight)
                 let height = min(sizeThatFits.height, maxHeight)
                 
                 
-                var x : CGFloat
+                var xPosition: CGFloat
                 
                 
-                if (leftRect.isNull == false) {
-                    x = titleMargin + leftRect.maxX + ((maxWidth - width)/2)
+                if leftRect.isNull == false {
+                    xPosition = titleMargin + leftRect.maxX + ((maxWidth - width)/2)
                 } else {
                 } else {
-                    x = titleMargin
+                    xPosition = titleMargin
                 }
                 }
 
 
-                let y = (maxHeight - height)/2
+                let yPosition = (maxHeight - height)/2
                 
                 
-                titleRect = CGRect(x: x, y: y, width: width, height: height)
+                titleRect = CGRect(x: xPosition, y: yPosition, width: width, height: height)
             } else {
             } else {
                 
                 
-                var x : CGFloat
+                var xPosition: CGFloat
                 
                 
-                if (leftRect.isNull == false) {
-                    x = titleMargin + leftRect.maxX
+                if leftRect.isNull == false {
+                    xPosition = titleMargin + leftRect.maxX
                 } else {
                 } else {
-                    x = titleMargin
+                    xPosition = titleMargin
                 }
                 }
 
 
-                let width : CGFloat = self.frame.width - titleMargin*2 - (leftRect.isNull ? 0 : leftRect.maxX) - (rightRect.isNull ? 0 : self.frame.width - rightRect.minX)
+                let width: CGFloat = self.frame.width - titleMargin*2 - (leftRect.isNull ? 0 : leftRect.maxX) - (rightRect.isNull ? 0 : self.frame.width - rightRect.minX)
                 
                 
-                titleRect = CGRect(x: x, y: 0, width: width, height: maxHeight)
+                titleRect = CGRect(x: xPosition, y: 0, width: width, height: maxHeight)
             }
             }
             
             
             customTitleView.frame = titleRect
             customTitleView.frame = titleRect

+ 51 - 61
IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift

@@ -21,7 +21,6 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 
 
-
 import UIKit
 import UIKit
 
 
 private var kIQShouldHideToolbarPlaceholder = "kIQShouldHideToolbarPlaceholder"
 private var kIQShouldHideToolbarPlaceholder = "kIQShouldHideToolbarPlaceholder"
@@ -32,10 +31,10 @@ private var kIQKeyboardToolbar              = "kIQKeyboardToolbar"
 /**
 /**
  IQBarButtonItemConfiguration for creating toolbar with bar button items
  IQBarButtonItemConfiguration for creating toolbar with bar button items
  */
  */
-@objc public class IQBarButtonItemConfiguration : NSObject {
+@objc public class IQBarButtonItemConfiguration: NSObject {
     
     
     #if swift(>=4.2)
     #if swift(>=4.2)
-    @objc public init(barButtonSystemItem : UIBarButtonItem.SystemItem, action: Selector) {
+    @objc public init(barButtonSystemItem: UIBarButtonItem.SystemItem, action: Selector) {
         self.barButtonSystemItem = barButtonSystemItem
         self.barButtonSystemItem = barButtonSystemItem
         self.image = nil
         self.image = nil
         self.title = nil
         self.title = nil
@@ -43,7 +42,7 @@ private var kIQKeyboardToolbar              = "kIQKeyboardToolbar"
         super.init()
         super.init()
     }
     }
     #else
     #else
-    @objc public init(barButtonSystemItem : UIBarButtonSystemItem, action: Selector) {
+    @objc public init(barButtonSystemItem: UIBarButtonSystemItem, action: Selector) {
         self.barButtonSystemItem = barButtonSystemItem
         self.barButtonSystemItem = barButtonSystemItem
         self.image = nil
         self.image = nil
         self.title = nil
         self.title = nil
@@ -52,7 +51,7 @@ private var kIQKeyboardToolbar              = "kIQKeyboardToolbar"
     }
     }
     #endif
     #endif
 
 
-    @objc public init(image : UIImage, action: Selector) {
+    @objc public init(image: UIImage, action: Selector) {
         self.barButtonSystemItem = nil
         self.barButtonSystemItem = nil
         self.image = image
         self.image = image
         self.title = nil
         self.title = nil
@@ -60,7 +59,7 @@ private var kIQKeyboardToolbar              = "kIQKeyboardToolbar"
         super.init()
         super.init()
     }
     }
     
     
-    @objc public init(title : String, action: Selector) {
+    @objc public init(title: String, action: Selector) {
         self.barButtonSystemItem = nil
         self.barButtonSystemItem = nil
         self.image = nil
         self.image = nil
         self.title = title
         self.title = title
@@ -69,16 +68,16 @@ private var kIQKeyboardToolbar              = "kIQKeyboardToolbar"
     }
     }
     
     
     #if swift(>=4.2)
     #if swift(>=4.2)
-    public let barButtonSystemItem : UIBarButtonItem.SystemItem?    //System Item to be used to instantiate bar button.
+    public let barButtonSystemItem: UIBarButtonItem.SystemItem?    //System Item to be used to instantiate bar button.
     #else
     #else
-    public let barButtonSystemItem : UIBarButtonSystemItem?    //System Item to be used to instantiate bar button.
+    public let barButtonSystemItem: UIBarButtonSystemItem?    //System Item to be used to instantiate bar button.
     #endif
     #endif
     
     
-    @objc public let image : UIImage?    //Image to show on bar button item if it's not a system item.
+    @objc public let image: UIImage?    //Image to show on bar button item if it's not a system item.
     
     
-    @objc public let title : String?     //Title to show on bar button item if it's not a system item.
+    @objc public let title: String?     //Title to show on bar button item if it's not a system item.
     
     
-    @objc public let action : Selector?  //action for bar button item. Usually 'doneAction:(IQBarButtonItem*)item'.
+    @objc public let action: Selector?  //action for bar button item. Usually 'doneAction:(IQBarButtonItem*)item'.
 }
 }
 
 
 /**
 /**
@@ -89,7 +88,7 @@ private var kIQKeyboardToolbar              = "kIQKeyboardToolbar"
     @objc static func keyboardPreviousiOS9Image() -> UIImage? {
     @objc static func keyboardPreviousiOS9Image() -> UIImage? {
         
         
         struct Static {
         struct Static {
-            static var keyboardPreviousiOS9Image : UIImage?
+            static var keyboardPreviousiOS9Image: UIImage?
         }
         }
 
 
         if Static.keyboardPreviousiOS9Image == nil {
         if Static.keyboardPreviousiOS9Image == nil {
@@ -116,7 +115,7 @@ private var kIQKeyboardToolbar              = "kIQKeyboardToolbar"
     @objc static func keyboardNextiOS9Image() -> UIImage? {
     @objc static func keyboardNextiOS9Image() -> UIImage? {
         
         
         struct Static {
         struct Static {
-            static var keyboardNextiOS9Image : UIImage?
+            static var keyboardNextiOS9Image: UIImage?
         }
         }
         
         
         if Static.keyboardNextiOS9Image == nil {
         if Static.keyboardNextiOS9Image == nil {
@@ -143,7 +142,7 @@ private var kIQKeyboardToolbar              = "kIQKeyboardToolbar"
     @objc static func keyboardPreviousiOS10Image() -> UIImage? {
     @objc static func keyboardPreviousiOS10Image() -> UIImage? {
         
         
         struct Static {
         struct Static {
-            static var keyboardPreviousiOS10Image : UIImage?
+            static var keyboardPreviousiOS10Image: UIImage?
         }
         }
         
         
         if Static.keyboardPreviousiOS10Image == nil {
         if Static.keyboardPreviousiOS10Image == nil {
@@ -170,7 +169,7 @@ private var kIQKeyboardToolbar              = "kIQKeyboardToolbar"
     @objc static func keyboardNextiOS10Image() -> UIImage? {
     @objc static func keyboardNextiOS10Image() -> UIImage? {
         
         
         struct Static {
         struct Static {
-            static var keyboardNextiOS10Image : UIImage?
+            static var keyboardNextiOS10Image: UIImage?
         }
         }
         
         
         if Static.keyboardNextiOS10Image == nil {
         if Static.keyboardNextiOS10Image == nil {
@@ -228,8 +227,7 @@ UIView category methods to add IQToolbar on UIKeyboard.
     @objc var keyboardToolbar: IQToolbar {
     @objc var keyboardToolbar: IQToolbar {
         var toolbar = inputAccessoryView as? IQToolbar
         var toolbar = inputAccessoryView as? IQToolbar
         
         
-        if (toolbar == nil)
-        {
+        if toolbar == nil {
             toolbar = objc_getAssociatedObject(self, &kIQKeyboardToolbar) as? IQToolbar
             toolbar = objc_getAssociatedObject(self, &kIQKeyboardToolbar) as? IQToolbar
         }
         }
         
         
@@ -292,14 +290,11 @@ UIView category methods to add IQToolbar on UIKeyboard.
      */
      */
     @objc var drawingToolbarPlaceholder: String? {
     @objc var drawingToolbarPlaceholder: String? {
 
 
-        if (self.shouldHideToolbarPlaceholder)
-        {
+        if self.shouldHideToolbarPlaceholder {
             return nil
             return nil
-        }
-        else if (self.toolbarPlaceholder?.isEmpty == false) {
+        } else if self.toolbarPlaceholder?.isEmpty == false {
             return self.toolbarPlaceholder
             return self.toolbarPlaceholder
-        }
-        else if self.responds(to: #selector(getter: UITextField.placeholder)) {
+        } else if self.responds(to: #selector(getter: UITextField.placeholder)) {
             
             
             if let textField = self as? UITextField {
             if let textField = self as? UITextField {
                 return textField.placeholder
                 return textField.placeholder
@@ -308,8 +303,7 @@ UIView category methods to add IQToolbar on UIKeyboard.
             } else {
             } else {
                 return nil
                 return nil
             }
             }
-        }
-        else {
+        } else {
             return nil
             return nil
         }
         }
     }
     }
@@ -322,7 +316,7 @@ UIView category methods to add IQToolbar on UIKeyboard.
         
         
         struct Static {
         struct Static {
             
             
-            static let nilButton = IQBarButtonItem(barButtonSystemItem:.flexibleSpace, target: nil, action: nil)
+            static let nilButton = IQBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
         }
         }
         
         
         Static.nilButton.isSystemItem = true
         Static.nilButton.isSystemItem = true
@@ -333,7 +327,7 @@ UIView category methods to add IQToolbar on UIKeyboard.
     /// MARK: Common
     /// MARK: Common
     ///-------------
     ///-------------
 
 
-    @objc func addKeyboardToolbarWithTarget(target : AnyObject?, titleText : String?, rightBarButtonConfiguration:IQBarButtonItemConfiguration?, previousBarButtonConfiguration:IQBarButtonItemConfiguration? = nil, nextBarButtonConfiguration:IQBarButtonItemConfiguration? = nil) {
+    @objc func addKeyboardToolbarWithTarget(target: AnyObject?, titleText: String?, rightBarButtonConfiguration: IQBarButtonItemConfiguration?, previousBarButtonConfiguration: IQBarButtonItemConfiguration? = nil, nextBarButtonConfiguration: IQBarButtonItemConfiguration? = nil) {
         
         
         //If can't set InputAccessoryView. Then return
         //If can't set InputAccessoryView. Then return
         if self.responds(to: #selector(setter: UITextField.inputAccessoryView)) {
         if self.responds(to: #selector(setter: UITextField.inputAccessoryView)) {
@@ -341,7 +335,7 @@ UIView category methods to add IQToolbar on UIKeyboard.
             //  Creating a toolBar for phoneNumber keyboard
             //  Creating a toolBar for phoneNumber keyboard
             let toolbar = self.keyboardToolbar
             let toolbar = self.keyboardToolbar
             
             
-            var items : [IQBarButtonItem] = []
+            var items: [IQBarButtonItem] = []
             
             
             if let prevConfig = previousBarButtonConfiguration {
             if let prevConfig = previousBarButtonConfiguration {
 
 
@@ -415,8 +409,7 @@ UIView category methods to add IQToolbar on UIKeyboard.
                 toolbar.titleBarButton.title = titleText
                 toolbar.titleBarButton.title = titleText
                 
                 
                 #if swift(>=3.2)
                 #if swift(>=3.2)
-                if #available(iOS 11, *) {}
-                else {
+                if #available(iOS 11, *) {} else {
                     toolbar.titleBarButton.customView?.frame = CGRect.zero
                     toolbar.titleBarButton.customView?.frame = CGRect.zero
                 }
                 }
                 #else
                 #else
@@ -488,38 +481,36 @@ UIView category methods to add IQToolbar on UIKeyboard.
     /// MARK: Right
     /// MARK: Right
     ///------------
     ///------------
 
 
-    @objc func addDoneOnKeyboardWithTarget(_ target : AnyObject?, action : Selector, shouldShowPlaceholder: Bool = false) {
+    @objc func addDoneOnKeyboardWithTarget(_ target: AnyObject?, action: Selector, shouldShowPlaceholder: Bool = false) {
         
         
-        addDoneOnKeyboardWithTarget(target, action: action, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder : nil))
+        addDoneOnKeyboardWithTarget(target, action: action, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))
     }
     }
 
 
-    @objc func addDoneOnKeyboardWithTarget(_ target : AnyObject?, action : Selector, titleText: String?) {
+    @objc func addDoneOnKeyboardWithTarget(_ target: AnyObject?, action: Selector, titleText: String?) {
         
         
         let rightConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .done, action: action)
         let rightConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .done, action: action)
         
         
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration)
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration)
     }
     }
-    
 
 
-    @objc func addRightButtonOnKeyboardWithImage(_ image : UIImage, target : AnyObject?, action : Selector, shouldShowPlaceholder: Bool = false) {
+    @objc func addRightButtonOnKeyboardWithImage(_ image: UIImage, target: AnyObject?, action: Selector, shouldShowPlaceholder: Bool = false) {
         
         
-        addRightButtonOnKeyboardWithImage(image, target: target, action: action, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder : nil))
+        addRightButtonOnKeyboardWithImage(image, target: target, action: action, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))
     }
     }
     
     
-    @objc func addRightButtonOnKeyboardWithImage(_ image : UIImage, target : AnyObject?, action : Selector, titleText: String?) {
+    @objc func addRightButtonOnKeyboardWithImage(_ image: UIImage, target: AnyObject?, action: Selector, titleText: String?) {
         
         
         let rightConfiguration = IQBarButtonItemConfiguration(image: image, action: action)
         let rightConfiguration = IQBarButtonItemConfiguration(image: image, action: action)
         
         
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration)
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration)
     }
     }
-    
 
 
-    @objc func addRightButtonOnKeyboardWithText(_ text : String, target : AnyObject?, action : Selector, shouldShowPlaceholder: Bool = false) {
+    @objc func addRightButtonOnKeyboardWithText(_ text: String, target: AnyObject?, action: Selector, shouldShowPlaceholder: Bool = false) {
         
         
-        addRightButtonOnKeyboardWithText(text, target: target, action: action, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder : nil))
+        addRightButtonOnKeyboardWithText(text, target: target, action: action, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))
     }
     }
     
     
-    @objc func addRightButtonOnKeyboardWithText(_ text : String, target : AnyObject?, action : Selector, titleText: String?) {
+    @objc func addRightButtonOnKeyboardWithText(_ text: String, target: AnyObject?, action: Selector, titleText: String?) {
         
         
         let rightConfiguration = IQBarButtonItemConfiguration(title: text, action: action)
         let rightConfiguration = IQBarButtonItemConfiguration(title: text, action: action)
         
         
@@ -530,30 +521,30 @@ UIView category methods to add IQToolbar on UIKeyboard.
     /// MARK: Right/Left
     /// MARK: Right/Left
     ///-----------------
     ///-----------------
 
 
-    @objc func addCancelDoneOnKeyboardWithTarget(_ target : AnyObject?, cancelAction : Selector, doneAction : Selector, shouldShowPlaceholder: Bool = false) {
+    @objc func addCancelDoneOnKeyboardWithTarget(_ target: AnyObject?, cancelAction: Selector, doneAction: Selector, shouldShowPlaceholder: Bool = false) {
         
         
-        addCancelDoneOnKeyboardWithTarget(target, cancelAction: cancelAction, doneAction: doneAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder : nil))
+        addCancelDoneOnKeyboardWithTarget(target, cancelAction: cancelAction, doneAction: doneAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))
     }
     }
 
 
-    @objc func addRightLeftOnKeyboardWithTarget(_ target : AnyObject?, leftButtonTitle : String, rightButtonTitle : String, leftButtonAction : Selector, rightButtonAction : Selector, shouldShowPlaceholder: Bool = false) {
+    @objc func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?, leftButtonTitle: String, rightButtonTitle: String, leftButtonAction: Selector, rightButtonAction: Selector, shouldShowPlaceholder: Bool = false) {
         
         
-        addRightLeftOnKeyboardWithTarget(target, leftButtonTitle: leftButtonTitle, rightButtonTitle: rightButtonTitle, leftButtonAction: leftButtonAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder : nil))
+        addRightLeftOnKeyboardWithTarget(target, leftButtonTitle: leftButtonTitle, rightButtonTitle: rightButtonTitle, leftButtonAction: leftButtonAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))
     }
     }
     
     
-    @objc func addRightLeftOnKeyboardWithTarget(_ target : AnyObject?, leftButtonImage : UIImage, rightButtonImage : UIImage, leftButtonAction : Selector, rightButtonAction : Selector, shouldShowPlaceholder: Bool = false) {
+    @objc func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?, leftButtonImage: UIImage, rightButtonImage: UIImage, leftButtonAction: Selector, rightButtonAction: Selector, shouldShowPlaceholder: Bool = false) {
         
         
-        addRightLeftOnKeyboardWithTarget(target, leftButtonImage: leftButtonImage, rightButtonImage: rightButtonImage, leftButtonAction: leftButtonAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder : nil))
+        addRightLeftOnKeyboardWithTarget(target, leftButtonImage: leftButtonImage, rightButtonImage: rightButtonImage, leftButtonAction: leftButtonAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))
     }
     }
     
     
-    @objc func addCancelDoneOnKeyboardWithTarget(_ target : AnyObject?, cancelAction : Selector, doneAction : Selector, titleText: String?) {
+    @objc func addCancelDoneOnKeyboardWithTarget(_ target: AnyObject?, cancelAction: Selector, doneAction: Selector, titleText: String?) {
         
         
         let leftConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .cancel, action: cancelAction)
         let leftConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .cancel, action: cancelAction)
-        let rightConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .done , action: doneAction)
+        let rightConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .done, action: doneAction)
         
         
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: leftConfiguration)
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: leftConfiguration)
     }
     }
     
     
-    @objc func addRightLeftOnKeyboardWithTarget(_ target : AnyObject?, leftButtonTitle : String, rightButtonTitle : String, leftButtonAction : Selector, rightButtonAction : Selector, titleText: String?) {
+    @objc func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?, leftButtonTitle: String, rightButtonTitle: String, leftButtonAction: Selector, rightButtonAction: Selector, titleText: String?) {
         
         
         let leftConfiguration = IQBarButtonItemConfiguration(title: leftButtonTitle, action: leftButtonAction)
         let leftConfiguration = IQBarButtonItemConfiguration(title: leftButtonTitle, action: leftButtonAction)
         let rightConfiguration = IQBarButtonItemConfiguration(title: rightButtonTitle, action: rightButtonAction)
         let rightConfiguration = IQBarButtonItemConfiguration(title: rightButtonTitle, action: rightButtonAction)
@@ -561,7 +552,7 @@ UIView category methods to add IQToolbar on UIKeyboard.
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: leftConfiguration)
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: leftConfiguration)
     }
     }
     
     
-    @objc func addRightLeftOnKeyboardWithTarget(_ target : AnyObject?, leftButtonImage : UIImage, rightButtonImage : UIImage, leftButtonAction : Selector, rightButtonAction : Selector, titleText: String?) {
+    @objc func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?, leftButtonImage: UIImage, rightButtonImage: UIImage, leftButtonAction: Selector, rightButtonAction: Selector, titleText: String?) {
         
         
         let leftConfiguration = IQBarButtonItemConfiguration(image: leftButtonImage, action: leftButtonAction)
         let leftConfiguration = IQBarButtonItemConfiguration(image: leftButtonImage, action: leftButtonAction)
         let rightConfiguration = IQBarButtonItemConfiguration(image: rightButtonImage, action: rightButtonAction)
         let rightConfiguration = IQBarButtonItemConfiguration(image: rightButtonImage, action: rightButtonAction)
@@ -573,22 +564,22 @@ UIView category methods to add IQToolbar on UIKeyboard.
     /// MARK: Previous/Next/Right
     /// MARK: Previous/Next/Right
     ///--------------------------
     ///--------------------------
 
 
-    @objc func addPreviousNextDoneOnKeyboardWithTarget (_ target : AnyObject?, previousAction : Selector, nextAction : Selector, doneAction : Selector, shouldShowPlaceholder: Bool = false) {
+    @objc func addPreviousNextDoneOnKeyboardWithTarget (_ target: AnyObject?, previousAction: Selector, nextAction: Selector, doneAction: Selector, shouldShowPlaceholder: Bool = false) {
 
 
-        addPreviousNextDoneOnKeyboardWithTarget(target, previousAction: previousAction, nextAction: nextAction, doneAction: doneAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder : nil))
+        addPreviousNextDoneOnKeyboardWithTarget(target, previousAction: previousAction, nextAction: nextAction, doneAction: doneAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))
     }
     }
 
 
-    @objc func addPreviousNextRightOnKeyboardWithTarget(_ target : AnyObject?, rightButtonImage : UIImage, previousAction : Selector, nextAction : Selector, rightButtonAction : Selector, shouldShowPlaceholder : Bool = false) {
+    @objc func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?, rightButtonImage: UIImage, previousAction: Selector, nextAction: Selector, rightButtonAction: Selector, shouldShowPlaceholder: Bool = false) {
         
         
-        addPreviousNextRightOnKeyboardWithTarget(target, rightButtonImage: rightButtonImage, previousAction: previousAction, nextAction: nextAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder : nil))
+        addPreviousNextRightOnKeyboardWithTarget(target, rightButtonImage: rightButtonImage, previousAction: previousAction, nextAction: nextAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))
     }
     }
     
     
-    @objc func addPreviousNextRightOnKeyboardWithTarget(_ target : AnyObject?, rightButtonTitle : String, previousAction : Selector, nextAction : Selector, rightButtonAction : Selector, shouldShowPlaceholder : Bool = false) {
+    @objc func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?, rightButtonTitle: String, previousAction: Selector, nextAction: Selector, rightButtonAction: Selector, shouldShowPlaceholder: Bool = false) {
         
         
-        addPreviousNextRightOnKeyboardWithTarget(target, rightButtonTitle: rightButtonTitle, previousAction: previousAction, nextAction: nextAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder : nil))
+        addPreviousNextRightOnKeyboardWithTarget(target, rightButtonTitle: rightButtonTitle, previousAction: previousAction, nextAction: nextAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))
     }
     }
     
     
-    @objc func addPreviousNextDoneOnKeyboardWithTarget (_ target : AnyObject?, previousAction : Selector, nextAction : Selector, doneAction : Selector,  titleText: String?) {
+    @objc func addPreviousNextDoneOnKeyboardWithTarget (_ target: AnyObject?, previousAction: Selector, nextAction: Selector, doneAction: Selector, titleText: String?) {
         
         
         let rightConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .done, action: doneAction)
         let rightConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .done, action: doneAction)
         let nextConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardNextImage() ?? UIImage(), action: nextAction)
         let nextConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardNextImage() ?? UIImage(), action: nextAction)
@@ -597,7 +588,7 @@ UIView category methods to add IQToolbar on UIKeyboard.
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: prevConfiguration, nextBarButtonConfiguration: nextConfiguration)
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: prevConfiguration, nextBarButtonConfiguration: nextConfiguration)
     }
     }
     
     
-    @objc func addPreviousNextRightOnKeyboardWithTarget(_ target : AnyObject?, rightButtonImage : UIImage, previousAction : Selector, nextAction : Selector, rightButtonAction : Selector, titleText : String?) {
+    @objc func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?, rightButtonImage: UIImage, previousAction: Selector, nextAction: Selector, rightButtonAction: Selector, titleText: String?) {
         
         
         let rightConfiguration = IQBarButtonItemConfiguration(image: rightButtonImage, action: rightButtonAction)
         let rightConfiguration = IQBarButtonItemConfiguration(image: rightButtonImage, action: rightButtonAction)
         let nextConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardNextImage() ?? UIImage(), action: nextAction)
         let nextConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardNextImage() ?? UIImage(), action: nextAction)
@@ -606,7 +597,7 @@ UIView category methods to add IQToolbar on UIKeyboard.
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: prevConfiguration, nextBarButtonConfiguration: nextConfiguration)
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: prevConfiguration, nextBarButtonConfiguration: nextConfiguration)
     }
     }
     
     
-    @objc func addPreviousNextRightOnKeyboardWithTarget(_ target : AnyObject?, rightButtonTitle : String, previousAction : Selector, nextAction : Selector, rightButtonAction : Selector, titleText : String?) {
+    @objc func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?, rightButtonTitle: String, previousAction: Selector, nextAction: Selector, rightButtonAction: Selector, titleText: String?) {
         
         
         let rightConfiguration = IQBarButtonItemConfiguration(title: rightButtonTitle, action: rightButtonAction)
         let rightConfiguration = IQBarButtonItemConfiguration(title: rightButtonTitle, action: rightButtonAction)
         let nextConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardNextImage() ?? UIImage(), action: nextAction)
         let nextConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardNextImage() ?? UIImage(), action: nextAction)
@@ -615,4 +606,3 @@ UIView category methods to add IQToolbar on UIKeyboard.
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: prevConfiguration, nextBarButtonConfiguration: nextConfiguration)
         addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: prevConfiguration, nextBarButtonConfiguration: nextConfiguration)
     }
     }
 }
 }
-

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff