Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
02c71dde
Unverified
Commit
02c71dde
authored
Jan 10, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added MotionTransition, initial commit
parent
18273849
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
172 additions
and
154 deletions
+172
-154
Material.xcodeproj/project.pbxproj
+12
-12
Sources/iOS/BottomNavigationController.swift
+4
-34
Sources/iOS/MotionAnimation.swift
+0
-0
Sources/iOS/MotionTransition.swift
+149
-0
Sources/iOS/NavigationController.swift
+7
-1
Sources/iOS/TransitionMotion.swift
+0
-107
No files found.
Material.xcodeproj/project.pbxproj
View file @
02c71dde
...
...
@@ -46,9 +46,9 @@
96334EF61C8B84660083986B
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96334EF51C8B84660083986B
/* Assets.xcassets */
;
};
963832421B88DFD80015F710
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963832361B88DFD80015F710
/* Material.framework */
;
};
965E80C81DD4C50600D61E4B
/* Motion.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76D1CB40DC500C806FE
/* Motion.swift */
;
};
965E80C91DD4C50600D61E4B
/*
TransitionMotion.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78B1CB40DC500C806FE
/* TransitionMo
tion.swift */
;
};
965E80C91DD4C50600D61E4B
/*
MotionTransition.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78B1CB40DC500C806FE
/* MotionTransi
tion.swift */
;
};
965E80CA1DD4C50600D61E4B
/* KeyframeMotion.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77E1CB40DC500C806FE
/* KeyframeMotion.swift */
;
};
965E80CB1DD4C50600D61E4B
/*
BasicMotion.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96E3C39D1D3A1D0C0086A024
/* BasicMo
tion.swift */
;
};
965E80CB1DD4C50600D61E4B
/*
MotionAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96E3C39D1D3A1D0C0086A024
/* MotionAnima
tion.swift */
;
};
965E80CC1DD4C50600D61E4B
/* Bar.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7981CB40DC500C806FE
/* Bar.swift */
;
};
965E80CD1DD4C50600D61E4B
/* Button.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7701CB40DC500C806FE
/* Button.swift */
;
};
965E80CE1DD4C50600D61E4B
/* FABButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75F1CB40DC500C806FE
/* FABButton.swift */
;
};
...
...
@@ -129,7 +129,7 @@
9660162A1CB2F04E00AAB661
/* Material.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C091C1328D800B91418
/* Material.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9661222E1D3EC414008BB4CB
/* Color.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9661222D1D3EC414008BB4CB
/* Color.swift */
;
};
96815B381CA07BA20006CBE2
/* MaterialViewTests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967887881C9777CB0037F6C9
/* MaterialViewTests.swift */
;
};
9697F7BC1D8F2572004741EC
/*
BasicMotion.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96E3C39D1D3A1D0C0086A024
/* BasicMo
tion.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9697F7BC1D8F2572004741EC
/*
MotionAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96E3C39D1D3A1D0C0086A024
/* MotionAnima
tion.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9697F7BF1D8F2572004741EC
/* Divider.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96230AB71D6A520C00AF47DC
/* Divider.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9697F7C01D8F2572004741EC
/* Material+CALayer.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96F1DC871D654FDF0025F925
/* Material+CALayer.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9697F7C11D8F2572004741EC
/* Material+Array.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96C1C8801D42C62800E6608F
/* Material+Array.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
...
@@ -151,7 +151,7 @@
96BCB7FA1CB40DE900C806FE
/* Roboto-Regular.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7F11CB40DE900C806FE
/* Roboto-Regular.ttf */
;
};
96BCB7FB1CB40DE900C806FE
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7F21CB40DE900C806FE
/* Roboto-Thin.ttf */
;
};
96BCB7FC1CB40DE900C806FE
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7F21CB40DE900C806FE
/* Roboto-Thin.ttf */
;
};
96BCB8101CB4115200C806FE
/*
TransitionMotion.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78B1CB40DC500C806FE
/* TransitionMo
tion.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8101CB4115200C806FE
/*
MotionTransition.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78B1CB40DC500C806FE
/* MotionTransi
tion.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8111CB4115200C806FE
/* Motion.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76D1CB40DC500C806FE
/* Motion.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8131CB4115200C806FE
/* KeyframeMotion.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77E1CB40DC500C806FE
/* KeyframeMotion.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8141CB4115200C806FE
/* PulseMotion.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7821CB40DC500C806FE
/* PulseMotion.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
...
@@ -304,7 +304,7 @@
96BCB7871CB40DC500C806FE
/* InterimSpace.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
InterimSpace.swift
;
sourceTree
=
"<group>"
;
};
96BCB7881CB40DC500C806FE
/* Switch.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Switch.swift
;
sourceTree
=
"<group>"
;
};
96BCB7891CB40DC500C806FE
/* TableViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TableViewCell.swift
;
sourceTree
=
"<group>"
;
};
96BCB78B1CB40DC500C806FE
/*
TransitionMotion.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TransitionMo
tion.swift
;
sourceTree
=
"<group>"
;
};
96BCB78B1CB40DC500C806FE
/*
MotionTransition.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MotionTransi
tion.swift
;
sourceTree
=
"<group>"
;
};
96BCB78C1CB40DC500C806FE
/* View.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
View.swift
;
sourceTree
=
"<group>"
;
};
96BCB78E1CB40DC500C806FE
/* Menu.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
indentWidth
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Menu.swift
;
sourceTree
=
"<group>"
;
tabWidth
=
4
;
};
96BCB7901CB40DC500C806FE
/* NavigationBar.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NavigationBar.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -333,7 +333,7 @@
96D88BFD1C1328D800B91418
/* LICENSE */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text
;
path
=
LICENSE
;
sourceTree
=
"<group>"
;
};
96D88C091C1328D800B91418
/* Material.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
Material.h
;
sourceTree
=
"<group>"
;
};
96E3C3931D397AE90086A024
/* Material+UIView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIView.swift"
;
sourceTree
=
"<group>"
;
};
96E3C39D1D3A1D0C0086A024
/*
BasicMotion.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BasicMo
tion.swift
;
sourceTree
=
"<group>"
;
};
96E3C39D1D3A1D0C0086A024
/*
MotionAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MotionAnima
tion.swift
;
sourceTree
=
"<group>"
;
};
96F1DC871D654FDF0025F925
/* Material+CALayer.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+CALayer.swift"
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
...
...
@@ -797,9 +797,9 @@
isa
=
PBXGroup
;
children
=
(
96BCB76D1CB40DC500C806FE
/* Motion.swift */
,
96BCB78B1CB40DC500C806FE
/* TransitionMotion.swift */
,
96E3C39D1D3A1D0C0086A024
/* MotionAnimation.swift */
,
96BCB78B1CB40DC500C806FE
/* MotionTransition.swift */
,
96BCB77E1CB40DC500C806FE
/* KeyframeMotion.swift */
,
96E3C39D1D3A1D0C0086A024
/* BasicMotion.swift */
,
96BCB7821CB40DC500C806FE
/* PulseMotion.swift */
,
961730351E0E156400A9A297
/* SpringMotion.swift */
,
);
...
...
@@ -878,7 +878,7 @@
buildActionMask
=
2147483647
;
files
=
(
96D88C321C1328D800B91418
/* Material.h in Headers */
,
96BCB8101CB4115200C806FE
/*
TransitionMo
tion.swift in Headers */
,
96BCB8101CB4115200C806FE
/*
MotionTransi
tion.swift in Headers */
,
96BCB8111CB4115200C806FE
/* Motion.swift in Headers */
,
96BCB8131CB4115200C806FE
/* KeyframeMotion.swift in Headers */
,
96BCB8141CB4115200C806FE
/* PulseMotion.swift in Headers */
,
...
...
@@ -931,7 +931,7 @@
96E3C3991D3A1CC20086A024
/* StatusBarController.swift in Headers */
,
96E3C39A1D3A1CC20086A024
/* ErrorTextField.swift in Headers */
,
96E3C39C1D3A1CC20086A024
/* Offset.swift in Headers */
,
9697F7BC1D8F2572004741EC
/*
BasicMo
tion.swift in Headers */
,
9697F7BC1D8F2572004741EC
/*
MotionAnima
tion.swift in Headers */
,
9697F7BF1D8F2572004741EC
/* Divider.swift in Headers */
,
9697F7C01D8F2572004741EC
/* Material+CALayer.swift in Headers */
,
9697F7C11D8F2572004741EC
/* Material+Array.swift in Headers */
,
...
...
@@ -1212,12 +1212,12 @@
965E80FE1DD4D59500D61E4B
/* ToolbarController.swift in Sources */
,
96328B971E05C0BB009A4C90
/* TableView.swift in Sources */
,
965E80C81DD4C50600D61E4B
/* Motion.swift in Sources */
,
965E80C91DD4C50600D61E4B
/*
TransitionMo
tion.swift in Sources */
,
965E80C91DD4C50600D61E4B
/*
MotionTransi
tion.swift in Sources */
,
965E80CA1DD4C50600D61E4B
/* KeyframeMotion.swift in Sources */
,
965E80F81DD4D59500D61E4B
/* ImageCard.swift in Sources */
,
96328B991E05C0CE009A4C90
/* TableViewController.swift in Sources */
,
965E80F91DD4D59500D61E4B
/* PresenterCard.swift in Sources */
,
965E80CB1DD4C50600D61E4B
/*
BasicMo
tion.swift in Sources */
,
965E80CB1DD4C50600D61E4B
/*
MotionAnima
tion.swift in Sources */
,
965E80CC1DD4C50600D61E4B
/* Bar.swift in Sources */
,
965E80CD1DD4C50600D61E4B
/* Button.swift in Sources */
,
965E80CE1DD4C50600D61E4B
/* FABButton.swift in Sources */
,
...
...
Sources/iOS/BottomNavigationController.swift
View file @
02c71dde
...
...
@@ -30,38 +30,9 @@
import
UIKit
public
class
BottomNavigationFadeAnimatedTransitioning
:
NSObject
,
UIViewControllerAnimatedTransitioning
{
public
func
animateTransition
(
using
transitionContext
:
UIViewControllerContextTransitioning
)
{
let
fromView
:
UIView
=
transitionContext
.
view
(
forKey
:
UITransitionContextViewKey
.
from
)
!
let
toView
:
UIView
=
transitionContext
.
view
(
forKey
:
UITransitionContextViewKey
.
to
)
!
toView
.
alpha
=
0
transitionContext
.
containerView
.
addSubview
(
fromView
)
transitionContext
.
containerView
.
addSubview
(
toView
)
UIView
.
animate
(
withDuration
:
transitionDuration
(
using
:
transitionContext
),
animations
:
{
_
in
toView
.
alpha
=
1
fromView
.
alpha
=
0
})
{
_
in
transitionContext
.
completeTransition
(
true
)
}
}
public
func
transitionDuration
(
using
transitionContext
:
UIViewControllerContextTransitioning
?)
->
TimeInterval
{
return
0.35
}
}
@objc(BottomNavigationTransitionAnimation)
public
enum
BottomNavigationTransitionAnimation
:
Int
{
case
none
case
fade
}
open
class
BottomNavigationController
:
UITabBarController
,
UITabBarControllerDelegate
{
/// The transition animation to use when selecting a new tab.
open
var
transitionAnimation
=
BottomNavigationTransitionAnima
tion
.
fade
open
var
motionTransition
=
MotionTransi
tion
.
fade
/**
An initializer that initializes the object with a NSCoder object.
...
...
@@ -148,12 +119,11 @@ open class BottomNavigationController: UITabBarController, UITabBarControllerDel
/// Handles transitions when tabBarItems are pressed.
open
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
animationControllerForTransitionFrom
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
let
fVC
:
UIViewController
?
=
fromVC
let
tVC
:
UIViewController
?
=
toVC
if
nil
==
fVC
||
nil
==
tVC
{
guard
nil
!=
fromVC
,
nil
!=
toVC
else
{
return
nil
}
return
.
fade
==
transitionAnimation
?
BottomNavigationFadeAnimatedTransitioning
()
:
nil
return
.
fade
==
motionTransition
?
FadeMotionTransition
()
:
nil
}
/// Prepares the tabBar.
...
...
Sources/iOS/
BasicMo
tion.swift
→
Sources/iOS/
MotionAnima
tion.swift
View file @
02c71dde
File moved
Sources/iOS/MotionTransition.swift
0 → 100644
View file @
02c71dde
/*
* Copyright (C) 2015 - 2017, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
@objc(MotionTransition)
public
enum
MotionTransition
:
Int
{
case
none
case
fade
}
extension
UIViewController
:
UIViewControllerTransitioningDelegate
{
public
func
animationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
,
source
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
return
FadeMotionTransition
()
}
}
open
class
FadeMotionTransition
:
NSObject
,
UIViewControllerAnimatedTransitioning
{
open
func
animateTransition
(
using
transitionContext
:
UIViewControllerContextTransitioning
)
{
guard
let
fromView
=
transitionContext
.
view
(
forKey
:
UITransitionContextViewKey
.
from
)
else
{
return
}
guard
let
toView
=
transitionContext
.
view
(
forKey
:
UITransitionContextViewKey
.
to
)
else
{
return
}
toView
.
alpha
=
0
transitionContext
.
containerView
.
addSubview
(
fromView
)
transitionContext
.
containerView
.
addSubview
(
toView
)
UIView
.
animate
(
withDuration
:
transitionDuration
(
using
:
transitionContext
),
animations
:
{
_
in
toView
.
alpha
=
1
fromView
.
alpha
=
0
})
{
_
in
transitionContext
.
completeTransition
(
true
)
}
}
open
func
transitionDuration
(
using
transitionContext
:
UIViewControllerContextTransitioning
?)
->
TimeInterval
{
return
0.35
}
}
//@objc(TransitionMotion)
//public enum TransitionMotion: Int {
// case fade
// case moveIn
// case push
// case reveal
//}
//
//@objc(TransitionMotionDirection)
//public enum TransitionMotionDirection: Int {
// case `default`
// case right
// case left
// case top
// case bottom
//}
//
///**
// Converts an TransitionMotion to a corresponding CATransition key.
// - Parameter transition: An TransitionMotion.
// - Returns: A CATransition key String.
// */
//public func TransitionMotionToValue(transition type: TransitionMotion) -> String {
// switch type {
// case .fade:
// return kCATransitionFade
// case .moveIn:
// return kCATransitionMoveIn
// case .push:
// return kCATransitionPush
// case .reveal:
// return kCATransitionReveal
// }
//}
//
///**
// Converts an TransitionMotionDirection to a corresponding CATransition direction key.
// - Parameter direction: An TransitionMotionDirection.
// - Returns: An optional CATransition direction key String.
// */
//public func TransitionMotionDirectionToValue(direction: TransitionMotionDirection) -> String? {
// switch direction {
// case .default:
// return nil
// case .right:
// return kCATransitionFromRight
// case .left:
// return kCATransitionFromLeft
// case .top:
// return kCATransitionFromBottom
// case .bottom:
// return kCATransitionFromTop
// }
//}
//
//extension Motion {
// /**
// Creates a CATransition animation.
// - Parameter type: An TransitionMotion.
// - Parameter direction: An optional TransitionMotionDirection.
// - Parameter duration: An optional duration time.
// - Returns: A CATransition.
// */
// public static func transition(type: TransitionMotion, direction: TransitionMotionDirection = .default, duration: CFTimeInterval? = nil) -> CATransition {
// let animation = CATransition()
// animation.type = TransitionMotionToValue(transition: type)
// animation.subtype = TransitionMotionDirectionToValue(direction: direction)
//
// if let v = duration {
// animation.duration = v
// }
//
// return animation
// }
//}
Sources/iOS/NavigationController.swift
View file @
02c71dde
...
...
@@ -121,7 +121,7 @@ open class NavigationController: UINavigationController {
open
func
prepare
()
{
navigationBar
.
heightPreset
=
.
normal
navigationBar
.
width
=
view
.
width
delegate
=
self
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
.
white
view
.
contentScaleFactor
=
Screen
.
scale
...
...
@@ -134,6 +134,12 @@ open class NavigationController: UINavigationController {
}
}
extension
NavigationController
:
UINavigationControllerDelegate
{
open
func
navigationController
(
_
navigationController
:
UINavigationController
,
animationControllerFor
operation
:
UINavigationControllerOperation
,
from
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
return
FadeMotionTransition
()
}
}
extension
NavigationController
:
UINavigationBarDelegate
{
/**
Delegation method that is called when a new UINavigationItem is about to be pushed.
...
...
Sources/iOS/TransitionMotion.swift
deleted
100644 → 0
View file @
18273849
/*
* Copyright (C) 2015 - 2017, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
@objc(TransitionMotion)
public
enum
TransitionMotion
:
Int
{
case
fade
case
moveIn
case
push
case
reveal
}
@objc(TransitionMotionDirection)
public
enum
TransitionMotionDirection
:
Int
{
case
`
default
`
case
right
case
left
case
top
case
bottom
}
/**
Converts an TransitionMotion to a corresponding CATransition key.
- Parameter transition: An TransitionMotion.
- Returns: A CATransition key String.
*/
public
func
TransitionMotionToValue
(
transition
type
:
TransitionMotion
)
->
String
{
switch
type
{
case
.
fade
:
return
kCATransitionFade
case
.
moveIn
:
return
kCATransitionMoveIn
case
.
push
:
return
kCATransitionPush
case
.
reveal
:
return
kCATransitionReveal
}
}
/**
Converts an TransitionMotionDirection to a corresponding CATransition direction key.
- Parameter direction: An TransitionMotionDirection.
- Returns: An optional CATransition direction key String.
*/
public
func
TransitionMotionDirectionToValue
(
direction
:
TransitionMotionDirection
)
->
String
?
{
switch
direction
{
case
.
default
:
return
nil
case
.
right
:
return
kCATransitionFromRight
case
.
left
:
return
kCATransitionFromLeft
case
.
top
:
return
kCATransitionFromBottom
case
.
bottom
:
return
kCATransitionFromTop
}
}
extension
Motion
{
/**
Creates a CATransition animation.
- Parameter type: An TransitionMotion.
- Parameter direction: An optional TransitionMotionDirection.
- Parameter duration: An optional duration time.
- Returns: A CATransition.
*/
public
static
func
transition
(
type
:
TransitionMotion
,
direction
:
TransitionMotionDirection
=
.
default
,
duration
:
CFTimeInterval
?
=
nil
)
->
CATransition
{
let
animation
=
CATransition
()
animation
.
type
=
TransitionMotionToValue
(
transition
:
type
)
animation
.
subtype
=
TransitionMotionDirectionToValue
(
direction
:
direction
)
if
let
v
=
duration
{
animation
.
duration
=
v
}
return
animation
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment