Commit 392f0689 by Daniel Dahan

development: fixed issue when detecting motion transitions

parent df2f0742
......@@ -1408,7 +1408,7 @@
INFOPLIST_FILE = Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.Material;
PRODUCT_BUNDLE_IDENTIFIER = com.cosmicmind.Material;
PRODUCT_NAME = Material;
PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES;
......@@ -1433,7 +1433,7 @@
INFOPLIST_FILE = Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.Material;
PRODUCT_BUNDLE_IDENTIFIER = com.cosmicmind.Material;
PRODUCT_NAME = Material;
PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES;
......@@ -1457,7 +1457,7 @@
);
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "io.cosmicmind.Material-iOS-Tests";
PRODUCT_BUNDLE_IDENTIFIER = "com.cosmicmind.Material-iOS-Tests";
PRODUCT_NAME = Material;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
......@@ -1475,7 +1475,7 @@
);
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "io.cosmicmind.Material-iOS-Tests";
PRODUCT_BUNDLE_IDENTIFIER = "com.cosmicmind.Material-iOS-Tests";
PRODUCT_NAME = Material;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
......@@ -1498,7 +1498,7 @@
INFOPLIST_FILE = Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.Material;
PRODUCT_BUNDLE_IDENTIFIER = com.cosmicmind.Material;
PRODUCT_NAME = Material;
SDKROOT = macosx;
SKIP_INSTALL = YES;
......@@ -1522,7 +1522,7 @@
INFOPLIST_FILE = Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.Material;
PRODUCT_BUNDLE_IDENTIFIER = com.cosmicmind.Material;
PRODUCT_NAME = Material;
SDKROOT = macosx;
SKIP_INSTALL = YES;
......@@ -1542,7 +1542,7 @@
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = "io.cosmicmind.Material-OSX-Tests";
PRODUCT_BUNDLE_IDENTIFIER = "com.cosmicmind.Material-OSX-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_VERSION = 3.0;
......@@ -1559,7 +1559,7 @@
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = "io.cosmicmind.Material-OSX-Tests";
PRODUCT_BUNDLE_IDENTIFIER = "com.cosmicmind.Material-OSX-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_VERSION = 3.0;
......
......@@ -117,7 +117,7 @@ public struct Motion {
cancelable?(false)
}
return cancelable;
return cancelable
}
/**
......
......@@ -235,7 +235,7 @@ open class MotionTransition: NSObject {
open var transitionContext: UIViewControllerContextTransitioning!
open var delay: TimeInterval = 0
open var duration: TimeInterval = 0
open var duration: TimeInterval = 0.35
open var containerView: UIView!
open var transitionView = UIView()
......@@ -331,11 +331,11 @@ extension MotionTransition {
fileprivate func prepareTransitionPairs() {
for from in fromSubviews {
guard 0 < from.motionTransitionIdentifier.utf16.count else {
continue
}
for to in toSubviews {
guard 0 < from.motionTransitionAnimations.count else {
return
}
guard to.motionTransitionIdentifier == from.motionTransitionIdentifier else {
continue
}
......@@ -372,17 +372,14 @@ extension MotionTransition {
addBackgroundMotionAnimation()
cleanupAnimation()
cleanupFromView()
cleanupTransitionSnapshot()
hideFromView()
removeTransitionSnapshot()
}
}
extension MotionTransition {
fileprivate func addTransitionAnimations() {
for (from, to) in transitionPairs {
let t = motionDelay(animations: to.motionTransitionAnimations)
let d = motionDuration(animations: to.motionTransitionAnimations)
var snapshotAnimations = [CABasicAnimation]()
var snapshotChildAnimations = [CABasicAnimation]()
......@@ -399,10 +396,12 @@ extension MotionTransition {
snapshotChildAnimations.append(sizeAnimation)
snapshotChildAnimations.append(Motion.position(x: to.bounds.width / 2, y: to.bounds.height / 2))
let d = motionDuration(animations: to.motionTransitionAnimations)
let snapshot = from.motionTransitionSnapshot(afterUpdates: true)
transitionView.addSubview(snapshot)
Motion.delay(t) { [weak self, weak to] in
Motion.delay(motionDelay(animations: to.motionTransitionAnimations)) { [weak self, weak to] in
guard let s = self else {
return
}
......@@ -451,7 +450,7 @@ extension MotionTransition {
}
fileprivate func motionDuration(animations: [MotionAnimation]) -> TimeInterval {
var t: TimeInterval = 0
var t: TimeInterval = 0.35
for a in animations {
switch a {
case let .duration(time):
......@@ -492,13 +491,13 @@ extension MotionTransition {
}
}
fileprivate func cleanupFromView() {
fileprivate func hideFromView() {
Motion.delay(delay) { [weak self] in
self?.fromView.isHidden = true
}
}
fileprivate func cleanupTransitionSnapshot() {
fileprivate func removeTransitionSnapshot() {
Motion.delay(delay) { [weak self] in
self?.transitionSnapshot.removeFromSuperview()
}
......
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