remove rxkeyboard implementation. Use RxKeyboard pod instead

This commit is contained in:
nikAshanin 2017-01-12 17:10:08 +03:00
parent 1d582bac8f
commit f8d59d4cfa
7 changed files with 0 additions and 318 deletions

View File

@ -21,7 +21,6 @@
7827C9391DE4ADB2009DA4E6 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7827C9331DE4ADB2009DA4E6 /* RxSwift.framework */; };
7834236A1DB8D0E100A79643 /* StoryboardProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 783423691DB8D0E100A79643 /* StoryboardProtocol.swift */; };
7837F60F1CBCF5C0000D74C1 /* EstimatedViewHeightProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7837F60E1CBCF5C0000D74C1 /* EstimatedViewHeightProtocol.swift */; };
7845A15A1E0BCD9A00B527BB /* KeyboardNotificationValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7845A1591E0BCD9A00B527BB /* KeyboardNotificationValues.swift */; };
786D78E81D53C378006B2CEA /* AlamofireRequest+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786D78E71D53C378006B2CEA /* AlamofireRequest+Extensions.swift */; };
786D78EC1D53C46E006B2CEA /* AlamofireManager+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786D78EB1D53C46E006B2CEA /* AlamofireManager+Extensions.swift */; };
7873D14F1E1127BC001816EB /* LeadKitError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7873D14E1E1127BC001816EB /* LeadKitError.swift */; };
@ -39,12 +38,7 @@
788EC15A1CF64528009CFB6B /* UIStoryboard+InstantiateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 788EC1591CF64528009CFB6B /* UIStoryboard+InstantiateViewController.swift */; };
789CC6081DE5835600F789D3 /* CursorType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789CC6071DE5835600F789D3 /* CursorType.swift */; };
789CC60B1DE584F800F789D3 /* CursorType+Slice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789CC60A1DE584F800F789D3 /* CursorType+Slice.swift */; };
789F5A0C1DFECB71004A3694 /* UIViewAnimationCurve+AnimationOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789F5A0B1DFECB71004A3694 /* UIViewAnimationCurve+AnimationOptions.swift */; };
789F5A121DFECD11004A3694 /* KeyboardDidNotificationValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789F5A111DFECD11004A3694 /* KeyboardDidNotificationValues.swift */; };
789F5A141DFECD54004A3694 /* KeyboardNotificationValuesError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789F5A131DFECD54004A3694 /* KeyboardNotificationValuesError.swift */; };
789F5A161DFECD82004A3694 /* KeyboardWillNotificationValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789F5A151DFECD82004A3694 /* KeyboardWillNotificationValues.swift */; };
789F5A1E1DFECF5F004A3694 /* NotificationCenter+RxKeyboardExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789F5A1D1DFECF5F004A3694 /* NotificationCenter+RxKeyboardExtensions.swift */; };
789F5A201DFECF9F004A3694 /* KeyboardNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789F5A1F1DFECF9F004A3694 /* KeyboardNotification.swift */; };
78A0FCC71DC366A10070B5E1 /* StoryboardProtocol+DefaultBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78A0FCC51DC366A10070B5E1 /* StoryboardProtocol+DefaultBundle.swift */; };
78A0FCC81DC366A10070B5E1 /* StoryboardProtocol+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78A0FCC61DC366A10070B5E1 /* StoryboardProtocol+Extensions.swift */; };
78A74EA91C6B373700FE9724 /* UIView+DefaultNibName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78A74EA81C6B373700FE9724 /* UIView+DefaultNibName.swift */; };
@ -104,7 +98,6 @@
7827C9331DE4ADB2009DA4E6 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = ../../../Carthage/Build/iOS/RxSwift.framework; sourceTree = "<group>"; };
783423691DB8D0E100A79643 /* StoryboardProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardProtocol.swift; sourceTree = "<group>"; };
7837F60E1CBCF5C0000D74C1 /* EstimatedViewHeightProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EstimatedViewHeightProtocol.swift; sourceTree = "<group>"; };
7845A1591E0BCD9A00B527BB /* KeyboardNotificationValues.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardNotificationValues.swift; sourceTree = "<group>"; };
786D78E71D53C378006B2CEA /* AlamofireRequest+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AlamofireRequest+Extensions.swift"; sourceTree = "<group>"; };
786D78EB1D53C46E006B2CEA /* AlamofireManager+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AlamofireManager+Extensions.swift"; sourceTree = "<group>"; };
7873D14E1E1127BC001816EB /* LeadKitError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeadKitError.swift; sourceTree = "<group>"; };
@ -122,12 +115,7 @@
788EC1591CF64528009CFB6B /* UIStoryboard+InstantiateViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIStoryboard+InstantiateViewController.swift"; sourceTree = "<group>"; };
789CC6071DE5835600F789D3 /* CursorType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CursorType.swift; sourceTree = "<group>"; };
789CC60A1DE584F800F789D3 /* CursorType+Slice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CursorType+Slice.swift"; sourceTree = "<group>"; };
789F5A0B1DFECB71004A3694 /* UIViewAnimationCurve+AnimationOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewAnimationCurve+AnimationOptions.swift"; sourceTree = "<group>"; };
789F5A111DFECD11004A3694 /* KeyboardDidNotificationValues.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardDidNotificationValues.swift; sourceTree = "<group>"; };
789F5A131DFECD54004A3694 /* KeyboardNotificationValuesError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardNotificationValuesError.swift; sourceTree = "<group>"; };
789F5A151DFECD82004A3694 /* KeyboardWillNotificationValues.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardWillNotificationValues.swift; sourceTree = "<group>"; };
789F5A1D1DFECF5F004A3694 /* NotificationCenter+RxKeyboardExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NotificationCenter+RxKeyboardExtensions.swift"; sourceTree = "<group>"; };
789F5A1F1DFECF9F004A3694 /* KeyboardNotification.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardNotification.swift; sourceTree = "<group>"; };
78A0FCC51DC366A10070B5E1 /* StoryboardProtocol+DefaultBundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "StoryboardProtocol+DefaultBundle.swift"; sourceTree = "<group>"; };
78A0FCC61DC366A10070B5E1 /* StoryboardProtocol+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "StoryboardProtocol+Extensions.swift"; sourceTree = "<group>"; };
78A74EA81C6B373700FE9724 /* UIView+DefaultNibName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIView+DefaultNibName.swift"; path = "LeadKit/Extensions/UIView/UIView+DefaultNibName.swift"; sourceTree = SOURCE_ROOT; };
@ -207,8 +195,6 @@
isa = PBXGroup;
children = (
78753E231DE58A5D006BC0FB /* CursorError.swift */,
789F5A131DFECD54004A3694 /* KeyboardNotificationValuesError.swift */,
789F5A1F1DFECF9F004A3694 /* KeyboardNotification.swift */,
7873D14E1E1127BC001816EB /* LeadKitError.swift */,
);
path = Enums;
@ -217,7 +203,6 @@
78011AAE1D48B46100EA16A2 /* Structures */ = {
isa = PBXGroup;
children = (
789F5A101DFECCFE004A3694 /* KeyboardNotificationValues */,
78011AB11D48B53600EA16A2 /* Api */,
);
path = Structures;
@ -328,24 +313,6 @@
path = CursorType;
sourceTree = "<group>";
};
789F5A0A1DFECB52004A3694 /* UIViewAnimationCurve */ = {
isa = PBXGroup;
children = (
789F5A0B1DFECB71004A3694 /* UIViewAnimationCurve+AnimationOptions.swift */,
);
path = UIViewAnimationCurve;
sourceTree = "<group>";
};
789F5A101DFECCFE004A3694 /* KeyboardNotificationValues */ = {
isa = PBXGroup;
children = (
789F5A111DFECD11004A3694 /* KeyboardDidNotificationValues.swift */,
789F5A151DFECD82004A3694 /* KeyboardWillNotificationValues.swift */,
7845A1591E0BCD9A00B527BB /* KeyboardNotificationValues.swift */,
);
path = KeyboardNotificationValues;
sourceTree = "<group>";
};
789F5A1C1DFECF44004A3694 /* NotificationCenter */ = {
isa = PBXGroup;
children = (
@ -463,7 +430,6 @@
C372153938A7B7D327F55124 /* UIStoryboard */,
78E59B2B1C786CBF00C6BFE9 /* UITableView */,
78E59B2C1C786CD500C6BFE9 /* UIView */,
789F5A0A1DFECB52004A3694 /* UIViewAnimationCurve */,
78D4B5441DA64D31005B0764 /* UIViewController */,
7884DB9A1DC1432B00E52A63 /* UserDefaults */,
);
@ -727,7 +693,6 @@
78CFEE541C5C45E500F50370 /* UIView+LoadFromNib.swift in Sources */,
EF2921A61E165DF400E8F43B /* TimeInterval+DateComponents.swift in Sources */,
78D4B5461DA64D49005B0764 /* UIViewController+DefaultStoryboardIdentifier.swift in Sources */,
789F5A141DFECD54004A3694 /* KeyboardNotificationValuesError.swift in Sources */,
7834236A1DB8D0E100A79643 /* StoryboardProtocol.swift in Sources */,
78CFEE521C5C45E500F50370 /* UITableView+CellRegistration.swift in Sources */,
78B0FC7F1C6B2C4D00358B64 /* Log.swift in Sources */,
@ -735,7 +700,6 @@
789CC60B1DE584F800F789D3 /* CursorType+Slice.swift in Sources */,
78753E2C1DE58BF9006BC0FB /* StaticCursor.swift in Sources */,
78D4B54A1DA64EAB005B0764 /* Any+TypeName.swift in Sources */,
789F5A201DFECF9F004A3694 /* KeyboardNotification.swift in Sources */,
78CFEE571C5C45E500F50370 /* StaticNibNameProtocol.swift in Sources */,
788EC15A1CF64528009CFB6B /* UIStoryboard+InstantiateViewController.swift in Sources */,
787783671CA04D4A001CDC9B /* String+SizeCalculation.swift in Sources */,
@ -744,7 +708,6 @@
78011A641D47ABC500EA16A2 /* UIView+DefaultReuseIdentifier.swift in Sources */,
786D78EC1D53C46E006B2CEA /* AlamofireManager+Extensions.swift in Sources */,
78B0FC811C6B2CD500358B64 /* App.swift in Sources */,
7845A15A1E0BCD9A00B527BB /* KeyboardNotificationValues.swift in Sources */,
78B036491DA562C30021D5CC /* CGImage+Template.swift in Sources */,
789F5A1E1DFECF5F004A3694 /* NotificationCenter+RxKeyboardExtensions.swift in Sources */,
7873D14F1E1127BC001816EB /* LeadKitError.swift in Sources */,
@ -762,7 +725,6 @@
786D78E81D53C378006B2CEA /* AlamofireRequest+Extensions.swift in Sources */,
78C36F811D8021DD00E7EBEA /* UIColor+Hex.swift in Sources */,
78CFEE5B1C5C45E500F50370 /* ViewModelProtocol.swift in Sources */,
789F5A121DFECD11004A3694 /* KeyboardDidNotificationValues.swift in Sources */,
EF5FB5691E0141610030E4BE /* UIView+Rotation.swift in Sources */,
780F56CC1E0D7ACA004530B6 /* ObservableMappable.swift in Sources */,
780D23431DA412470084620D /* CGImage+Alpha.swift in Sources */,
@ -777,10 +739,8 @@
789CC6081DE5835600F789D3 /* CursorType.swift in Sources */,
78B0364B1DA61EDE0021D5CC /* CGImage+Crop.swift in Sources */,
78B036451DA561D00021D5CC /* CGImage+Utils.swift in Sources */,
789F5A0C1DFECB71004A3694 /* UIViewAnimationCurve+AnimationOptions.swift in Sources */,
78CFEE591C5C45E500F50370 /* StoryboardIdentifierProtocol.swift in Sources */,
78011AB31D48B53600EA16A2 /* ApiRequestParameters.swift in Sources */,
789F5A161DFECD82004A3694 /* KeyboardWillNotificationValues.swift in Sources */,
78B0FC7D1C6B2BE200358B64 /* LogFormatter.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -1,45 +0,0 @@
//
// Copyright (c) 2017 Touch Instinct
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import Foundation
/// A type representing an possible keyboard notifications emitted by notification center
/// with accociated keyboard notification values
///
/// - willShow: UIKeyboardWillShow notification
/// - didShow: UIKeyboardDidShow notification
/// - willHide: UIKeyboardWillHide notification
/// - didHide: UIKeyboardDidHide notification
/// - willChangeFrame: UIKeyboardWillChangeFrame notification
/// - didChangeFrame: UIKeyboardDidChangeFrame notification
public enum KeyboardNotification {
case willShow(notificationValues: KeyboardWillNotificationValues)
case didShow(notificationValues: KeyboardDidNotificationValues)
case willHide(notificationValues: KeyboardWillNotificationValues)
case didHide(notificationValues: KeyboardDidNotificationValues)
case willChangeFrame(notificationValues: KeyboardWillNotificationValues)
case didChangeFrame(notificationValues: KeyboardDidNotificationValues)
}

View File

@ -1,33 +0,0 @@
//
// Copyright (c) 2017 Touch Instinct
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import Foundation
/// A type representing an possible errors that can be thrown during
/// initializing KeyboardWillNotificationValues or KeyboardDidNotificationValues
///
/// - failedToInit: failed to init notification values object from given notification
public enum KeyboardNotificationValuesError: Error {
case failedToInit(fromNotification: Notification)
}

View File

@ -1,41 +0,0 @@
//
// Copyright (c) 2017 Touch Instinct
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import Foundation
public extension UIViewAnimationCurve {
/// UIViewAnimationOptions value matching current animation curve
var animationOptions: UIViewAnimationOptions {
switch self {
case .easeInOut:
return .curveEaseInOut
case .easeIn:
return .curveEaseIn
case .easeOut:
return .curveEaseOut
case .linear:
return .curveLinear
}
}
}

View File

@ -1,54 +0,0 @@
//
// Copyright (c) 2017 Touch Instinct
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import UIKit
/// Struct which keeps values from one of those notifications:
/// UIKeyboardDidShow, UIKeyboardDidHide, UIKeyboardDidChangeFrame
public struct KeyboardDidNotificationValues {
let sizeBegin: CGSize
let sizeEnd: CGSize
let isLocal: Bool
// Animation key/value pairs are only available for the "will" family of notification. (UIWindow.h)
}
public extension KeyboardDidNotificationValues {
init(notification: Notification) throws {
let notificationValues = KeyboardNotificationValues(notification: notification)
guard let sizeBegin = notificationValues.frameBegin?.size,
let sizeEnd = notificationValues.frameEnd?.size,
let isLocal = notificationValues.isLocal else {
throw KeyboardNotificationValuesError.failedToInit(fromNotification: notification)
}
self.sizeBegin = sizeBegin
self.sizeEnd = sizeEnd
self.isLocal = isLocal
}
}

View File

@ -1,47 +0,0 @@
//
// Copyright (c) 2017 Touch Instinct
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import UIKit
internal struct KeyboardNotificationValues {
let frameBegin: CGRect?
let frameEnd: CGRect?
let animationDuration: TimeInterval?
let animationCurve: UIViewAnimationCurve?
let isLocal: Bool?
init(notification: Notification) {
frameBegin = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue
frameEnd = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue
animationDuration = (notification.userInfo?[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue
if let rawValue = (notification.userInfo?[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber)?.intValue {
animationCurve = UIViewAnimationCurve(rawValue: rawValue)
} else {
animationCurve = nil
}
isLocal = (notification.userInfo?[UIKeyboardIsLocalUserInfoKey] as? NSNumber)?.boolValue
}
}

View File

@ -1,58 +0,0 @@
//
// Copyright (c) 2017 Touch Instinct
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import UIKit
/// Struct which keeps values from one of those notifications:
/// UIKeyboardWillShow, UIKeyboardWillHide, UIKeyboardWillChangeFrame
public struct KeyboardWillNotificationValues {
let sizeBegin: CGSize
let sizeEnd: CGSize
let animationDuration: TimeInterval
let animationCurve: UIViewAnimationCurve
let isLocal: Bool
}
public extension KeyboardWillNotificationValues {
init(notification: Notification) throws {
let notificationValues = KeyboardNotificationValues(notification: notification)
guard let sizeBegin = notificationValues.frameBegin?.size,
let sizeEnd = notificationValues.frameEnd?.size,
let animationDuration = notificationValues.animationDuration,
let animationCurve = notificationValues.animationCurve,
let isLocal = notificationValues.isLocal else {
throw KeyboardNotificationValuesError.failedToInit(fromNotification: notification)
}
self.sizeBegin = sizeBegin
self.sizeEnd = sizeEnd
self.animationDuration = animationDuration
self.animationCurve = animationCurve
self.isLocal = isLocal
}
}