Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/1.1.1'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Example/ViewController.swift
  • Loading branch information
AlexLittlejohn committed Oct 3, 2016
2 parents 6ab8c0f + 8fcbd20 commit b3cf4e8
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 108 deletions.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
2 changes: 1 addition & 1 deletion ALTextInputBar.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "ALTextInputBar"
spec.version = "1.1.0"
spec.version = "1.1.1"
spec.summary = "An auto growing text input bar for messaging apps"
spec.source = { :git => "https://github.com/AlexLittlejohn/ALTextInputBar.git", :tag => spec.version.to_s }
spec.requires_arc = true
Expand Down
28 changes: 21 additions & 7 deletions ALTextInputBar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,17 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = zero;
TargetAttributes = {
FA61C9401AEAEC5F00920E37 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = GAPQH4AM76;
LastSwiftMigration = 0800;
};
FA61C9551AEAEC5F00920E37 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 0800;
TestTargetID = FA61C9401AEAEC5F00920E37;
};
};
Expand Down Expand Up @@ -277,8 +280,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -301,7 +306,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -323,8 +328,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -340,9 +347,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -353,11 +361,13 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
DEVELOPMENT_TEAM = GAPQH4AM76;
INFOPLIST_FILE = "$(SRCROOT)/Example/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.zero.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = com.zero.TextInputBar;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -367,11 +377,13 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
DEVELOPMENT_TEAM = GAPQH4AM76;
INFOPLIST_FILE = "$(SRCROOT)/Example/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.zero.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = com.zero.TextInputBar;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -392,6 +404,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.zero.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ALTextInputBar.app/ALTextInputBar";
};
name = Debug;
Expand All @@ -408,6 +421,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.zero.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ALTextInputBar.app/ALTextInputBar";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
29 changes: 16 additions & 13 deletions ALTextInputBar/ALKeyboardObservingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,28 @@ public class ALKeyboardObservingView: UIView {
private weak var observedView: UIView?
private var defaultHeight: CGFloat = 44

override public func intrinsicContentSize() -> CGSize {
return CGSizeMake(UIViewNoIntrinsicMetric, defaultHeight)
override public var intrinsicContentSize: CGSize {
return CGSize(width: UIViewNoIntrinsicMetric, height: defaultHeight)
}



public override func willMoveToSuperview(newSuperview: UIView?) {
public override func willMove(toSuperview newSuperview: UIView?) {

removeKeyboardObserver()
if let _newSuperview = newSuperview {
addKeyboardObserver(_newSuperview)
addKeyboardObserver(newSuperview: _newSuperview)
}

super.willMoveToSuperview(newSuperview)
super.willMove(toSuperview: newSuperview)
}

public override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {


public override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if object as? NSObject == superview && keyPath == keyboardHandlingKeyPath() {
keyboardDidChangeFrame(superview!.frame)
keyboardDidChangeFrame(frame: superview!.frame)
} else {
super.observeValueForKeyPath(keyPath, ofObject: object, change: change, context: context)
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
}
}

Expand All @@ -46,7 +49,7 @@ public class ALKeyboardObservingView: UIView {
}

for constraint in constraints {
if constraint.firstAttribute == NSLayoutAttribute.Height && constraint.firstItem as! NSObject == self {
if constraint.firstAttribute == NSLayoutAttribute.height && constraint.firstItem as! NSObject == self {
constraint.constant = height < defaultHeight ? defaultHeight : height
}
}
Expand All @@ -62,7 +65,7 @@ public class ALKeyboardObservingView: UIView {

private func addKeyboardObserver(newSuperview: UIView) {
observedView = newSuperview
newSuperview.addObserver(self, forKeyPath: keyboardHandlingKeyPath(), options: NSKeyValueObservingOptions.New, context: nil)
newSuperview.addObserver(self, forKeyPath: keyboardHandlingKeyPath(), options: NSKeyValueObservingOptions.new, context: nil)
}

private func removeKeyboardObserver() {
Expand All @@ -73,8 +76,8 @@ public class ALKeyboardObservingView: UIView {
}

private func keyboardDidChangeFrame(frame: CGRect) {
let userInfo = [UIKeyboardFrameEndUserInfoKey: NSValue(CGRect:frame)]
NSNotificationCenter.defaultCenter().postNotificationName(ALKeyboardFrameDidChangeNotification, object: nil, userInfo: userInfo)
let userInfo: [AnyHashable : Any] = [UIKeyboardFrameEndUserInfoKey: NSValue(cgRect:frame)]
NotificationCenter.default.post(name: NSNotification.Name(rawValue: ALKeyboardFrameDidChangeNotification), object: nil, userInfo: userInfo)
}

deinit {
Expand Down
Loading

0 comments on commit b3cf4e8

Please sign in to comment.