Skip to content

Commit

Permalink
Replaced version check with #available, updated v3.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hackiftekhar committed Sep 19, 2015
1 parent 6e076c3 commit 367fce1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Demo/Objective_C_Demo/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.3.1</string>
<string>3.3.2</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
Expand Down
2 changes: 1 addition & 1 deletion Demo/Swift_Demo/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.3.1</string>
<string>3.3.2</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,3 @@ public enum IQLayoutGuidePosition : Int {
case Top
case Bottom
}


internal let IQ_IS_IOS8_OR_GREATER = (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1)
12 changes: 9 additions & 3 deletions IQKeyboardManagerSwift/IQKeyboardManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ public class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {

if let unwrappedController = controller {
//frame size needs to be adjusted on iOS8 due to orientation structure changes.
if IQ_IS_IOS8_OR_GREATER == true {
if #available(iOS 8.0, *) {
frame.size = unwrappedController.view.frame.size
}

Expand Down Expand Up @@ -784,7 +784,13 @@ public class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {
let textFieldViewRect = optionalTextFieldViewRect!

//If it's iOS8 then we should do calculations according to portrait orientations. // (Bug ID: #64, #66)
let interfaceOrientation = (IQ_IS_IOS8_OR_GREATER) ? UIInterfaceOrientation.Portrait : rootController.interfaceOrientation
let interfaceOrientation : UIInterfaceOrientation

if #available(iOS 8.0, *) {
interfaceOrientation = UIInterfaceOrientation.Portrait
} else {
interfaceOrientation = rootController.interfaceOrientation
}

// Getting RootViewRect.
var rootViewRect = rootController.view.frame
Expand Down Expand Up @@ -1416,7 +1422,7 @@ public class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {
if let rootViewController = _rootViewController {

//frame size needs to be adjusted on iOS8 due to orientation API changes.
if IQ_IS_IOS8_OR_GREATER == true {
if #available(iOS 8.0, *) {
_topViewBeginRect.size = rootViewController.view.frame.size
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ public extension UIView {
let prev : IQBarButtonItem
let next : IQBarButtonItem

if IQ_IS_IOS8_OR_GREATER {
if #available(iOS 8.0, *) {

// Get the top level "bundle" which may actually be the framework
var bundle = NSBundle(forClass: IQKeyboardManager.self)
Expand Down Expand Up @@ -769,7 +769,7 @@ public extension UIView {
let prev : IQBarButtonItem
let next : IQBarButtonItem

if IQ_IS_IOS8_OR_GREATER {
if #available(iOS 8.0, *) {

// Get the top level "bundle" which may actually be the framework
var bundle = NSBundle(forClass: IQKeyboardManager.self)
Expand Down

0 comments on commit 367fce1

Please sign in to comment.