diff --git a/KeyboardAdjuster.podspec b/KeyboardAdjuster.podspec index da1f4b1..d3379ef 100644 --- a/KeyboardAdjuster.podspec +++ b/KeyboardAdjuster.podspec @@ -1,8 +1,9 @@ # vim: ft=ruby Pod::Spec.new do |s| + s.name = "KeyboardAdjuster" - s.version = "3.0.3" + s.version = "3.1.1" s.summary = "Automatically resizes and adjust views to scroll when a keyboard appears." s.homepage = "https://github.com/lionheart/KeyboardAdjuster" s.license = { :type => 'Apache 2.0', :file => 'LICENSE' } @@ -11,12 +12,8 @@ Pod::Spec.new do |s| s.social_media_url = 'https://twitter.com/dwlz' s.documentation_url = 'https://code.lionheart.software/KeyboardAdjuster/' - s.platform = :ios, '9.3' - s.requires_arc = true - - s.pod_target_xcconfig = { - 'SWIFT_VERSION' => '4.0' - } - - s.source_files = 'Pod/Classes/**/*' + s.platform = :ios, '9.3' + s.requires_arc = true + s.swift_version = '4.0' + s.source_files = 'Pod/Classes/**/*' end diff --git a/KeyboardAdjuster.xcodeproj/project.pbxproj b/KeyboardAdjuster.xcodeproj/project.pbxproj index dbc748b..96889c9 100644 --- a/KeyboardAdjuster.xcodeproj/project.pbxproj +++ b/KeyboardAdjuster.xcodeproj/project.pbxproj @@ -247,7 +247,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 1000; + LastUpgradeCheck = 0940; ORGANIZATIONNAME = "Lionheart Software LLC"; TargetAttributes = { 3736F8FE1C763B9100666FB1 = { diff --git a/Pod/Classes/KeyboardAdjuster.swift b/Pod/Classes/KeyboardAdjuster.swift index bc73479..2a6e400 100644 --- a/Pod/Classes/KeyboardAdjuster.swift +++ b/Pod/Classes/KeyboardAdjuster.swift @@ -34,10 +34,17 @@ public class KeyboardLayoutGuide: UILayoutGuide { view.addLayoutGuide(self) - leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true - trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true - bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true - constraint = topAnchor.constraint(equalTo: view.bottomAnchor) + if #available(iOS 11.0, *) { + leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor).isActive = true + trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor).isActive = true + bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true + constraint = topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor) + } else { + leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true + trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true + bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true + constraint = topAnchor.constraint(equalTo: view.bottomAnchor) + } constraint.isActive = true } diff --git a/README.md b/README.md index 13d12ed..e70b734 100644 --- a/README.md +++ b/README.md @@ -65,18 +65,6 @@ pod "KeyboardAdjuster", "~> 3" } ``` -
- NOTE: If you're using iOS 11 and your view is using the safeAreaLayoutGuide to set constraints, click here to view an alternate approach. - - ```swift - func viewDidLoad() { - super.viewDidLoad() - - tableView.bottomAnchor.constraint(lessThanOrEqualTo: keyboardLayoutGuide.topAnchor).isActive = true - } - ``` -
- 3. And you're done! Whenever a keyboard appears, your view will be automatically resized. ## Optional Features