Commit 3401ebd9 by Daniel Dahan

issue-1: removed default delegation being set for UINavigationController and UITabBarController

parent 0c93a339
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Motion' s.name = 'Motion'
s.version = '1.0.2' s.version = '1.0.3'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'Seamless animations and transitions in Swift.' s.summary = 'Seamless animations and transitions in Swift.'
s.homepage = 'http://cosmicmind.com' s.homepage = 'http://cosmicmind.com'
......
...@@ -260,7 +260,9 @@ ...@@ -260,7 +260,9 @@
buildSettings = { buildSettings = {
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1; DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
...@@ -283,6 +285,7 @@ ...@@ -283,6 +285,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1; DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.2</string> <string>1.0.3</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
......
...@@ -99,7 +99,7 @@ fileprivate struct MotionInstanceController { ...@@ -99,7 +99,7 @@ fileprivate struct MotionInstanceController {
fileprivate weak var delegate: MotionDelegate? fileprivate weak var delegate: MotionDelegate?
} }
extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegate { extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegate, UINavigationControllerDelegate, UITabBarControllerDelegate {
/// MotionInstanceController Reference. /// MotionInstanceController Reference.
fileprivate var motionInstanceController: MotionInstanceController { fileprivate var motionInstanceController: MotionInstanceController {
get { get {
...@@ -121,6 +121,8 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat ...@@ -121,6 +121,8 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
modalPresentationStyle = .custom modalPresentationStyle = .custom
transitioningDelegate = self transitioningDelegate = self
motionDelegate = self motionDelegate = self
(self as? UINavigationController)?.delegate = self
(self as? UITabBarController)?.delegate = self
} }
motionInstanceController.isEnabled = value motionInstanceController.isEnabled = value
...@@ -135,6 +137,15 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat ...@@ -135,6 +137,15 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
motionInstanceController.delegate = value motionInstanceController.delegate = value
} }
} }
@objc(navigationController:animationControllerForOperation:fromViewController:toViewController:)
open func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return fromVC.isMotionEnabled ? Motion(isPresenting: operation == .push, isContainer: true) : nil
}
open func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return fromVC.isMotionEnabled ? Motion(isPresenting: true, isContainer: true) : nil
}
} }
extension UIViewController { extension UIViewController {
...@@ -151,24 +162,6 @@ extension UIViewController { ...@@ -151,24 +162,6 @@ extension UIViewController {
} }
} }
extension UINavigationController: UINavigationControllerDelegate {
open override func viewDidLoad() {
super.viewDidLoad()
delegate = self
}
@objc(navigationController:animationControllerForOperation:fromViewController:toViewController:)
open func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return fromVC.isMotionEnabled ? Motion(isPresenting: operation == .push, isContainer: true) : nil
}
}
extension UITabBarController: UITabBarControllerDelegate {
open func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return fromVC.isMotionEnabled ? Motion(isPresenting: true, isContainer: true) : nil
}
}
extension UIView { extension UIView {
/// MaterialTransitionItem Reference. /// MaterialTransitionItem Reference.
fileprivate var motionInstance: MotionInstance { fileprivate var motionInstance: MotionInstance {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment