├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── Demo
├── Demo.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── Qing.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── Qing.xcuserdatad
│ │ └── xcschemes
│ │ ├── Demo.xcscheme
│ │ ├── TabBarDemo.xcscheme
│ │ └── xcschememanagement.plist
├── Demo.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Demo
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── 60 - iPhone@2x.png
│ │ │ ├── 60 - iPhone@3x.png
│ │ │ └── Contents.json
│ │ ├── Cell Icon
│ │ │ ├── Alipay60x60.imageset
│ │ │ │ ├── Alipay60x60@2x.png
│ │ │ │ ├── Alipay60x60@3x.png
│ │ │ │ └── Contents.json
│ │ │ ├── Blixt60x60.imageset
│ │ │ │ ├── Blixt60x60@2x.png
│ │ │ │ └── Contents.json
│ │ │ ├── Contents.json
│ │ │ ├── Elevate60x60.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Elevate60x60@2x.png
│ │ │ │ └── Elevate60x60@3x.png
│ │ │ ├── IBanTang60x60.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── IBanTang60x60@2x.png
│ │ │ │ └── IBanTang60x60@3x.png
│ │ │ ├── MeituanMovie60x60.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── MeituanMovie60x60@2x.png
│ │ │ │ └── MeituanMovie60x60@3x.png
│ │ │ ├── OmniFocus60x60.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── OmniFocus60x60@2x.png
│ │ │ │ └── OmniFocus60x60@3x.png
│ │ │ ├── Scanbot60x60.imageset
│ │ │ │ ├── AppIcon60x60@2x.png
│ │ │ │ ├── AppIcon60x60@3x.png
│ │ │ │ └── Contents.json
│ │ │ ├── Taasky60x60.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Taasky60x60@2x.png
│ │ │ │ └── Tassky60x60@3x.png
│ │ │ ├── Twitter60x60.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Twitter60x60@2x.png
│ │ │ │ └── Twitter60x60@3x.png
│ │ │ └── WeChat60x60.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── WeChat60x60@2x.png
│ │ │ │ └── WeChat60x60@3x.png
│ │ ├── Contents.json
│ │ ├── Logo.imageset
│ │ │ ├── Contents.json
│ │ │ ├── Logo@2x.png
│ │ │ └── Logo@3x.png
│ │ └── img_swipe_down.imageset
│ │ │ ├── Contents.json
│ │ │ ├── img_swipe_down@2x.png
│ │ │ └── img_swipe_down@3x.png
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── InteractiveViewController.swift
│ ├── MainViewController.swift
│ ├── ModalViewController.swift
│ └── SecondViewController.swift
├── Podfile
├── Podfile.lock
├── Pods
│ ├── Local Podspecs
│ │ └── TransitionTreasury.podspec.json
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ │ ├── project.pbxproj
│ │ └── xcuserdata
│ │ │ └── Qing.xcuserdatad
│ │ │ └── xcschemes
│ │ │ ├── Pods-Demo.xcscheme
│ │ │ ├── Pods-TabBarDemo.xcscheme
│ │ │ └── xcschememanagement.plist
│ └── Target Support Files
│ │ ├── Pods-Demo
│ │ ├── Info.plist
│ │ ├── Pods-Demo-acknowledgements.markdown
│ │ ├── Pods-Demo-acknowledgements.plist
│ │ ├── Pods-Demo-dummy.m
│ │ ├── Pods-Demo-frameworks.sh
│ │ ├── Pods-Demo-resources.sh
│ │ ├── Pods-Demo-umbrella.h
│ │ ├── Pods-Demo.debug.xcconfig
│ │ ├── Pods-Demo.modulemap
│ │ └── Pods-Demo.release.xcconfig
│ │ ├── Pods-TabBarDemo
│ │ ├── Info.plist
│ │ ├── Pods-TabBarDemo-acknowledgements.markdown
│ │ ├── Pods-TabBarDemo-acknowledgements.plist
│ │ ├── Pods-TabBarDemo-dummy.m
│ │ ├── Pods-TabBarDemo-frameworks.sh
│ │ ├── Pods-TabBarDemo-resources.sh
│ │ ├── Pods-TabBarDemo-umbrella.h
│ │ ├── Pods-TabBarDemo.debug.xcconfig
│ │ ├── Pods-TabBarDemo.modulemap
│ │ └── Pods-TabBarDemo.release.xcconfig
│ │ └── TransitionTreasury
│ │ ├── Info.plist
│ │ ├── TransitionTreasury-dummy.m
│ │ ├── TransitionTreasury-prefix.pch
│ │ ├── TransitionTreasury-umbrella.h
│ │ ├── TransitionTreasury.modulemap
│ │ └── TransitionTreasury.xcconfig
└── TabBarDemo
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── icon_tab@2x.png
│ │ └── icon_tab@3x.png
│ ├── Contents.json
│ ├── first.imageset
│ │ ├── Contents.json
│ │ └── first.pdf
│ └── second.imageset
│ │ ├── Contents.json
│ │ └── second.pdf
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── FirstViewController.swift
│ ├── Info.plist
│ ├── SecondViewController.swift
│ ├── ThirdViewController.swift
│ └── ViewController.swift
├── Documentation
├── Advance-Usage.md
├── Animation-Guide.md
├── Basic-Usage.md
├── Introduction.md
└── TransitionTreasury 3.0 Migration Guide.md
├── Example
├── Example.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ │ └── contents.xcworkspacedata
├── Example.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Example
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── 60 - iPhone@2x.png
│ │ │ ├── 60 - iPhone@3x.png
│ │ │ └── Contents.json
│ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── FirstViewController.swift
│ ├── Info.plist
│ ├── ModalViewController.swift
│ └── SecondViewController.swift
├── ExampleWithoutAnimation
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── 60 - iPhone@2x.png
│ │ │ ├── 60 - iPhone@3x.png
│ │ │ └── Contents.json
│ │ └── Contents.json
│ ├── Base.lproj
│ │ └── LaunchScreen.storyboard
│ ├── FirstViewController.swift
│ ├── Info.plist
│ ├── ModalViewController.swift
│ ├── SecondViewController.swift
│ └── Transition.swift
├── Podfile
└── Podfile.lock
├── LICENSE
├── README.md
├── Supporting Files
├── Info.plist
├── TransitionAnimation.h
└── TransitionTreasury.h
├── TransitionAnimation.podspec
├── TransitionAnimation
├── BlixtTransitionAnimation.swift
├── DefaultPercentDrivenInteractiveTransition.swift
├── DefaultPushTransitionAnimation.swift
├── ElevateTransitionAnimation.swift
├── FadeTransitionAnimation.swift
├── IBanTangTransitionAnimation.swift
├── OMNITransitionAnimation.swift
├── PageTransitionAnimation.swift
├── PopTipTransitionAnimation.swift
├── ScanbotTransitionAnimation.swift
├── SlideTransitionAnimation.swift
├── TRTransitionAnimations.swift
├── TaaskyFlipTransitionAnimation.swift
├── TransitionAnimationHelper.swift
└── TwitterTransitionAnimation.swift
├── TransitionTreasury.podspec
├── TransitionTreasury.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── xcshareddata
│ └── xcschemes
│ │ ├── TransitionAnimation.xcscheme
│ │ └── TransitionTreasury.xcscheme
└── xcuserdata
│ └── Qing.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ └── xcschememanagement.plist
├── TransitionTreasury
├── PresentTransition
│ ├── TRViewControllerTransitionDelegate.swift
│ └── UIViewController+TRPresent.swift
├── PushTransition
│ ├── TRNavgationTransitionDelegate.swift
│ └── UINavigationController+TRPushPop.swift
├── TRStatusBarStyle.swift
├── TRViewControllerAnimatedTransitioning.swift
├── TabBarTransition
│ ├── TRTabBarControllerDelegate.swift
│ ├── TRTabBarTransitionDelegate.swift
│ └── UITabBarController+TRTransition.swift
└── TransitionTreasury.swift
└── transitiontreasury.png
/.gitignore:
--------------------------------------------------------------------------------
1 | _site
2 | TODO
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
8 |
9 | ## Build generated
10 | build/
11 | DerivedData/
12 |
13 | ## Various settings
14 | *.pbxuser
15 | !default.pbxuser
16 | *.mode1v3
17 | !default.mode1v3
18 | *.mode2v3
19 | !default.mode2v3
20 | *.perspectivev3
21 | !default.perspectivev3
22 | xcuserdata/
23 |
24 | ## Other
25 | *.moved-aside
26 | *.xcuserstate
27 |
28 | ## Obj-C/Swift specific
29 | *.hmap
30 | *.ipa
31 | *.dSYM.zip
32 | *.dSYM
33 |
34 | ## Playgrounds
35 | timeline.xctimeline
36 | playground.xcworkspace
37 |
38 | # Swift Package Manager
39 | #
40 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
41 | # Packages/
42 | .build/
43 |
44 | # CocoaPods
45 | #
46 | # We recommend against adding the Pods directory to your .gitignore. However
47 | # you should judge for yourself, the pros and cons are mentioned at:
48 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
49 | #
50 | Pods/
51 |
52 | # Carthage
53 | #
54 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
55 | Carthage/Checkouts
56 |
57 | Carthage/Build
58 |
59 | # fastlane
60 | #
61 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
62 | # screenshots whenever they are needed.
63 | # For more information about the recommended setup visit:
64 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
65 |
66 | fastlane/report.xml
67 | fastlane/Preview.html
68 | fastlane/screenshots
69 | fastlane/test_output
70 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
2 | osx_image: xcode10.0
3 | xcode_project: TransitionTreasury.xcodeproj
4 |
--------------------------------------------------------------------------------
/Demo/Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/Qing.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/Qing.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Demo/Demo.xcodeproj/xcuserdata/Qing.xcuserdatad/xcschemes/Demo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/Demo/Demo.xcodeproj/xcuserdata/Qing.xcuserdatad/xcschemes/TabBarDemo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/Demo/Demo.xcodeproj/xcuserdata/Qing.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Demo.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | TabBarDemo.xcscheme
13 |
14 | orderHint
15 | 3
16 |
17 |
18 | SuppressBuildableAutocreation
19 |
20 | 26BEB6851C646250001510CE
21 |
22 | primary
23 |
24 |
25 | 26BEB6A61C646415001510CE
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Demo/Demo.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Demo/Demo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Demo/Demo/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // Demo
4 | //
5 | // Created by 宋宋 on 16/2/5.
6 | // Copyright © 2016年 DianQK. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/AppIcon.appiconset/60 - iPhone@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/AppIcon.appiconset/60 - iPhone@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/AppIcon.appiconset/60 - iPhone@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/AppIcon.appiconset/60 - iPhone@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "60x60",
35 | "idiom" : "iphone",
36 | "filename" : "60 - iPhone@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "60 - iPhone@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "idiom" : "ios-marketing",
47 | "size" : "1024x1024",
48 | "scale" : "1x"
49 | }
50 | ],
51 | "info" : {
52 | "version" : 1,
53 | "author" : "xcode"
54 | }
55 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Alipay60x60.imageset/Alipay60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Alipay60x60.imageset/Alipay60x60@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Alipay60x60.imageset/Alipay60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Alipay60x60.imageset/Alipay60x60@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Alipay60x60.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Alipay60x60@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "Alipay60x60@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Blixt60x60.imageset/Blixt60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Blixt60x60.imageset/Blixt60x60@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Blixt60x60.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Blixt60x60@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Elevate60x60.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Elevate60x60@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "Elevate60x60@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Elevate60x60.imageset/Elevate60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Elevate60x60.imageset/Elevate60x60@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Elevate60x60.imageset/Elevate60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Elevate60x60.imageset/Elevate60x60@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/IBanTang60x60.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "IBanTang60x60@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "IBanTang60x60@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/IBanTang60x60.imageset/IBanTang60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/IBanTang60x60.imageset/IBanTang60x60@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/IBanTang60x60.imageset/IBanTang60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/IBanTang60x60.imageset/IBanTang60x60@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/MeituanMovie60x60.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "MeituanMovie60x60@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "MeituanMovie60x60@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/MeituanMovie60x60.imageset/MeituanMovie60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/MeituanMovie60x60.imageset/MeituanMovie60x60@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/MeituanMovie60x60.imageset/MeituanMovie60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/MeituanMovie60x60.imageset/MeituanMovie60x60@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/OmniFocus60x60.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "OmniFocus60x60@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "OmniFocus60x60@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/OmniFocus60x60.imageset/OmniFocus60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/OmniFocus60x60.imageset/OmniFocus60x60@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/OmniFocus60x60.imageset/OmniFocus60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/OmniFocus60x60.imageset/OmniFocus60x60@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Scanbot60x60.imageset/AppIcon60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Scanbot60x60.imageset/AppIcon60x60@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Scanbot60x60.imageset/AppIcon60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Scanbot60x60.imageset/AppIcon60x60@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Scanbot60x60.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "AppIcon60x60@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "AppIcon60x60@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Taasky60x60.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Taasky60x60@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "Tassky60x60@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Taasky60x60.imageset/Taasky60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Taasky60x60.imageset/Taasky60x60@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Taasky60x60.imageset/Tassky60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Taasky60x60.imageset/Tassky60x60@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Twitter60x60.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Twitter60x60@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "Twitter60x60@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Twitter60x60.imageset/Twitter60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Twitter60x60.imageset/Twitter60x60@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/Twitter60x60.imageset/Twitter60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/Twitter60x60.imageset/Twitter60x60@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/WeChat60x60.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "WeChat60x60@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "WeChat60x60@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/WeChat60x60.imageset/WeChat60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/WeChat60x60.imageset/WeChat60x60@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Cell Icon/WeChat60x60.imageset/WeChat60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Cell Icon/WeChat60x60.imageset/WeChat60x60@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Logo.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Logo@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "Logo@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Logo.imageset/Logo@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Logo.imageset/Logo@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/Logo.imageset/Logo@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/Logo.imageset/Logo@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/img_swipe_down.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "img_swipe_down@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "img_swipe_down@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/img_swipe_down.imageset/img_swipe_down@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/img_swipe_down.imageset/img_swipe_down@2x.png
--------------------------------------------------------------------------------
/Demo/Demo/Assets.xcassets/img_swipe_down.imageset/img_swipe_down@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/Demo/Assets.xcassets/img_swipe_down.imageset/img_swipe_down@3x.png
--------------------------------------------------------------------------------
/Demo/Demo/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
30 |
36 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Demo/Demo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Demo/Demo/InteractiveViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // InteractiveViewController.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 1/15/16.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import TransitionTreasury
11 | import TransitionAnimation
12 |
13 | class InteractiveViewController: UIViewController, ModalTransitionDelegate, NavgationTransitionable {
14 |
15 | var tr_presentTransition: TRViewControllerTransitionDelegate?
16 |
17 | var tr_pushTransition: TRNavgationTransitionDelegate?
18 |
19 | override func viewDidLoad() {
20 | super.viewDidLoad()
21 |
22 | // Do any additional setup after loading the view.
23 | let pan = UIPanGestureRecognizer(target: self, action: #selector(InteractiveViewController.interactiveTransition(_:)))
24 | pan.delegate = self
25 | view.addGestureRecognizer(pan)
26 | }
27 |
28 | @IBAction func PresentClick(_ sender: UIButton) {
29 | let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ModalViewController") as! ModalViewController
30 | vc.modalDelegate = self
31 | tr_presentViewController(vc, method: TRPresentTransitionMethod.scanbot(present: nil, dismiss: vc.dismissGestureRecognizer), completion: {
32 | print("Present finished")
33 | })
34 | }
35 |
36 | @IBAction func popClick(_ sender: UIButton) {
37 | _ = navigationController?.popViewController(animated: true)
38 | }
39 |
40 | @objc func interactiveTransition(_ sender: UIPanGestureRecognizer) {
41 | switch sender.state {
42 | case .began:
43 | guard sender.velocity(in: view).y > 0 else {
44 | break
45 | }
46 | let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ModalViewController") as! ModalViewController
47 | vc.modalDelegate = self
48 | tr_presentViewController(vc, method: TRPresentTransitionMethod.scanbot(present: sender, dismiss: vc.dismissGestureRecognizer), completion: {
49 | print("Present finished")
50 | })
51 | default: break
52 | }
53 | }
54 |
55 | func modalViewControllerDismiss(interactive: Bool, callbackData data: Any?) {
56 | tr_dismissViewController(interactive, completion: nil)
57 | }
58 |
59 | }
60 |
61 | extension InteractiveViewController: UIGestureRecognizerDelegate {
62 | func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
63 | if let ges = gestureRecognizer as? UIPanGestureRecognizer {
64 | return ges.translation(in: ges.view).y != 0
65 | }
66 | return false
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/Demo/Demo/ModalViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ModalViewController.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/20/15.
6 | // Copyright © 2015 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import TransitionTreasury
11 |
12 | class ModalViewController: UIViewController {
13 |
14 | weak var modalDelegate: ModalViewControllerDelegate?
15 |
16 | @IBOutlet weak var backButton: UIButton!
17 |
18 | lazy var dismissGestureRecognizer: UIPanGestureRecognizer = {
19 | let pan = UIPanGestureRecognizer(target: self, action: #selector(ModalViewController.panDismiss(_:)))
20 | self.view.addGestureRecognizer(pan)
21 | return pan
22 | }()
23 |
24 | override func viewDidLoad() {
25 | super.viewDidLoad()
26 |
27 | backButton.isHidden = !(navigationController?.isNavigationBarHidden ?? true)
28 | }
29 |
30 | @IBAction func dismissClick(_ sender: AnyObject) {
31 | modalDelegate?.modalViewControllerDismiss(callbackData: ["title":title ?? ""])
32 | }
33 |
34 |
35 | @objc func panDismiss(_ sender: UIPanGestureRecognizer) {
36 | switch sender.state {
37 | case .began :
38 | guard sender.translation(in: view).y < 0 else {
39 | break
40 | }
41 | modalDelegate?.modalViewControllerDismiss(true, callbackData: nil)
42 | default : break
43 | }
44 | }
45 |
46 | deinit {
47 | print("Modal deinit.")
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/Demo/Demo/SecondViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SecondViewController.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/30/15.
6 | // Copyright © 2015 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import TransitionTreasury
11 | import TransitionAnimation
12 |
13 | class SecondViewController: UIViewController, NavgationTransitionable {
14 | var tr_pushTransition: TRNavgationTransitionDelegate?
15 |
16 | override func viewDidAppear(_ animated: Bool) {
17 | super.viewDidAppear(animated)
18 | /**
19 | Advande Usage (Get keyView or KeyViewCopy)
20 | Issue: https://github.com/DianQK/TransitionTreasury/issues/1
21 | */
22 | if let transitionAnimation = tr_pushTransition?.transition as? IBanTangTransitionAnimation {
23 | print(transitionAnimation.keyView)
24 | print(transitionAnimation.keyViewCopy)
25 | }
26 | if let view = view.viewWithTag(20000) {
27 | print(view)
28 | }
29 | }
30 |
31 | @IBAction func popClick(_ sender: AnyObject) {
32 | _ = navigationController?.tr_popViewController({ () -> Void in
33 | print("Pop finished.")
34 | })
35 | }
36 |
37 | deinit {
38 | print("Second deinit.")
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Demo/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 | platform :ios, '8.0'
3 |
4 | use_frameworks!
5 |
6 | # Our Libraries
7 | def libraries
8 | pod 'TransitionTreasury', :path => "../"
9 | pod 'TransitionAnimation', :path => "../"
10 | end
11 |
12 | target 'Demo' do
13 | libraries
14 | end
15 |
16 | target 'TabBarDemo' do
17 | libraries
18 | end
19 |
20 |
--------------------------------------------------------------------------------
/Demo/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - TransitionAnimation (7.0.0):
3 | - TransitionTreasury (~> 7.0.0)
4 | - TransitionTreasury (7.0.0)
5 |
6 | DEPENDENCIES:
7 | - TransitionAnimation (from `../`)
8 | - TransitionTreasury (from `../`)
9 |
10 | EXTERNAL SOURCES:
11 | TransitionAnimation:
12 | :path: "../"
13 | TransitionTreasury:
14 | :path: "../"
15 |
16 | SPEC CHECKSUMS:
17 | TransitionAnimation: cf8926e5e11e4f3b3d8b8a4260d1e7953567af58
18 | TransitionTreasury: f88c2bdf282c85d02386362c3c25981174fec995
19 |
20 | PODFILE CHECKSUM: 9bd788565ad1f90aad399b5f8ad013f745f2212d
21 |
22 | COCOAPODS: 1.7.5
23 |
--------------------------------------------------------------------------------
/Demo/Pods/Local Podspecs/TransitionTreasury.podspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "TransitionTreasury",
3 | "version": "7.0.0",
4 | "license": {
5 | "type": "MIT",
6 | "file": "LICENSE"
7 | },
8 | "summary": "Easier way to push your viewController.",
9 | "homepage": "https://github.com/DianQK/TransitionTreasury",
10 | "screenshots": "https://raw.githubusercontent.com/DianQK/TransitionTreasury/master/transitiontreasury.png",
11 | "social_media_url": "http://transitiontreasury.com",
12 | "authors": {
13 | "DianQK": "xiaoqing@dianqk.org"
14 | },
15 | "source": {
16 | "git": "https://github.com/DianQK/TransitionTreasury.git",
17 | "tag": "7.0.0"
18 | },
19 | "source_files": [
20 | "TransitionTreasury/*.swift",
21 | "TransitionTreasury/*/*.swift"
22 | ],
23 | "platforms": {
24 | "ios": "8.0"
25 | },
26 | "requires_arc": true,
27 | "swift_versions": "5.0",
28 | "swift_version": "5.0"
29 | }
30 |
--------------------------------------------------------------------------------
/Demo/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - TransitionAnimation (7.0.0):
3 | - TransitionTreasury (~> 7.0.0)
4 | - TransitionTreasury (7.0.0)
5 |
6 | DEPENDENCIES:
7 | - TransitionAnimation (from `../`)
8 | - TransitionTreasury (from `../`)
9 |
10 | EXTERNAL SOURCES:
11 | TransitionAnimation:
12 | :path: "../"
13 | TransitionTreasury:
14 | :path: "../"
15 |
16 | SPEC CHECKSUMS:
17 | TransitionAnimation: cf8926e5e11e4f3b3d8b8a4260d1e7953567af58
18 | TransitionTreasury: f88c2bdf282c85d02386362c3c25981174fec995
19 |
20 | PODFILE CHECKSUM: 9bd788565ad1f90aad399b5f8ad013f745f2212d
21 |
22 | COCOAPODS: 1.7.5
23 |
--------------------------------------------------------------------------------
/Demo/Pods/Pods.xcodeproj/xcuserdata/Qing.xcuserdatad/xcschemes/Pods-Demo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
47 |
48 |
54 |
55 |
56 |
57 |
58 |
59 |
65 |
66 |
68 |
69 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/Demo/Pods/Pods.xcodeproj/xcuserdata/Qing.xcuserdatad/xcschemes/Pods-TabBarDemo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
47 |
48 |
54 |
55 |
56 |
57 |
58 |
59 |
65 |
66 |
68 |
69 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/Demo/Pods/Pods.xcodeproj/xcuserdata/Qing.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Pods-Demo.xcscheme
8 |
9 | isShown
10 |
11 |
12 | Pods-TabBarDemo.xcscheme
13 |
14 | isShown
15 |
16 |
17 | TransitionAnimation.xcscheme
18 |
19 | isShown
20 |
21 |
22 | TransitionTreasury.xcscheme
23 |
24 | isShown
25 |
26 |
27 |
28 | SuppressBuildableAutocreation
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-Demo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## TransitionAnimation
5 |
6 | The MIT License (MIT)
7 |
8 | Copyright (c) 2015
9 |
10 | Permission is hereby granted, free of charge, to any person obtaining a copy
11 | of this software and associated documentation files (the "Software"), to deal
12 | in the Software without restriction, including without limitation the rights
13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 | copies of the Software, and to permit persons to whom the Software is
15 | furnished to do so, subject to the following conditions:
16 |
17 | The above copyright notice and this permission notice shall be included in all
18 | copies or substantial portions of the Software.
19 |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 | SOFTWARE.
27 |
28 |
29 |
30 | ## TransitionTreasury
31 |
32 | The MIT License (MIT)
33 |
34 | Copyright (c) 2015
35 |
36 | Permission is hereby granted, free of charge, to any person obtaining a copy
37 | of this software and associated documentation files (the "Software"), to deal
38 | in the Software without restriction, including without limitation the rights
39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40 | copies of the Software, and to permit persons to whom the Software is
41 | furnished to do so, subject to the following conditions:
42 |
43 | The above copyright notice and this permission notice shall be included in all
44 | copies or substantial portions of the Software.
45 |
46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52 | SOFTWARE.
53 |
54 |
55 | Generated by CocoaPods - https://cocoapods.org
56 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | The MIT License (MIT)
18 |
19 | Copyright (c) 2015
20 |
21 | Permission is hereby granted, free of charge, to any person obtaining a copy
22 | of this software and associated documentation files (the "Software"), to deal
23 | in the Software without restriction, including without limitation the rights
24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25 | copies of the Software, and to permit persons to whom the Software is
26 | furnished to do so, subject to the following conditions:
27 |
28 | The above copyright notice and this permission notice shall be included in all
29 | copies or substantial portions of the Software.
30 |
31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37 | SOFTWARE.
38 |
39 |
40 | License
41 | MIT
42 | Title
43 | TransitionAnimation
44 | Type
45 | PSGroupSpecifier
46 |
47 |
48 | FooterText
49 | The MIT License (MIT)
50 |
51 | Copyright (c) 2015
52 |
53 | Permission is hereby granted, free of charge, to any person obtaining a copy
54 | of this software and associated documentation files (the "Software"), to deal
55 | in the Software without restriction, including without limitation the rights
56 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
57 | copies of the Software, and to permit persons to whom the Software is
58 | furnished to do so, subject to the following conditions:
59 |
60 | The above copyright notice and this permission notice shall be included in all
61 | copies or substantial portions of the Software.
62 |
63 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
64 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
66 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
67 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
68 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
69 | SOFTWARE.
70 |
71 |
72 | License
73 | MIT
74 | Title
75 | TransitionTreasury
76 | Type
77 | PSGroupSpecifier
78 |
79 |
80 | FooterText
81 | Generated by CocoaPods - https://cocoapods.org
82 | Title
83 |
84 | Type
85 | PSGroupSpecifier
86 |
87 |
88 | StringsTable
89 | Acknowledgements
90 | Title
91 | Acknowledgements
92 |
93 |
94 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_Demo : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_Demo
5 | @end
6 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_DemoVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_DemoVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo.debug.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TransitionAnimation" "${PODS_CONFIGURATION_BUILD_DIR}/TransitionTreasury"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TransitionAnimation/TransitionAnimation.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/TransitionTreasury/TransitionTreasury.framework/Headers"
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_LDFLAGS = $(inherited) -framework "TransitionAnimation" -framework "TransitionTreasury"
7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
8 | PODS_BUILD_DIR = ${BUILD_DIR}
9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
11 | PODS_ROOT = ${SRCROOT}/Pods
12 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_Demo {
2 | umbrella header "Pods-Demo-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo.release.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TransitionAnimation" "${PODS_CONFIGURATION_BUILD_DIR}/TransitionTreasury"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TransitionAnimation/TransitionAnimation.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/TransitionTreasury/TransitionTreasury.framework/Headers"
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_LDFLAGS = $(inherited) -framework "TransitionAnimation" -framework "TransitionTreasury"
7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
8 | PODS_BUILD_DIR = ${BUILD_DIR}
9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
11 | PODS_ROOT = ${SRCROOT}/Pods
12 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-TabBarDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-TabBarDemo/Pods-TabBarDemo-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## TransitionAnimation
5 |
6 | The MIT License (MIT)
7 |
8 | Copyright (c) 2015
9 |
10 | Permission is hereby granted, free of charge, to any person obtaining a copy
11 | of this software and associated documentation files (the "Software"), to deal
12 | in the Software without restriction, including without limitation the rights
13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 | copies of the Software, and to permit persons to whom the Software is
15 | furnished to do so, subject to the following conditions:
16 |
17 | The above copyright notice and this permission notice shall be included in all
18 | copies or substantial portions of the Software.
19 |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 | SOFTWARE.
27 |
28 |
29 |
30 | ## TransitionTreasury
31 |
32 | The MIT License (MIT)
33 |
34 | Copyright (c) 2015
35 |
36 | Permission is hereby granted, free of charge, to any person obtaining a copy
37 | of this software and associated documentation files (the "Software"), to deal
38 | in the Software without restriction, including without limitation the rights
39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40 | copies of the Software, and to permit persons to whom the Software is
41 | furnished to do so, subject to the following conditions:
42 |
43 | The above copyright notice and this permission notice shall be included in all
44 | copies or substantial portions of the Software.
45 |
46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52 | SOFTWARE.
53 |
54 |
55 | Generated by CocoaPods - https://cocoapods.org
56 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-TabBarDemo/Pods-TabBarDemo-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | The MIT License (MIT)
18 |
19 | Copyright (c) 2015
20 |
21 | Permission is hereby granted, free of charge, to any person obtaining a copy
22 | of this software and associated documentation files (the "Software"), to deal
23 | in the Software without restriction, including without limitation the rights
24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25 | copies of the Software, and to permit persons to whom the Software is
26 | furnished to do so, subject to the following conditions:
27 |
28 | The above copyright notice and this permission notice shall be included in all
29 | copies or substantial portions of the Software.
30 |
31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37 | SOFTWARE.
38 |
39 |
40 | License
41 | MIT
42 | Title
43 | TransitionAnimation
44 | Type
45 | PSGroupSpecifier
46 |
47 |
48 | FooterText
49 | The MIT License (MIT)
50 |
51 | Copyright (c) 2015
52 |
53 | Permission is hereby granted, free of charge, to any person obtaining a copy
54 | of this software and associated documentation files (the "Software"), to deal
55 | in the Software without restriction, including without limitation the rights
56 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
57 | copies of the Software, and to permit persons to whom the Software is
58 | furnished to do so, subject to the following conditions:
59 |
60 | The above copyright notice and this permission notice shall be included in all
61 | copies or substantial portions of the Software.
62 |
63 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
64 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
66 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
67 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
68 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
69 | SOFTWARE.
70 |
71 |
72 | License
73 | MIT
74 | Title
75 | TransitionTreasury
76 | Type
77 | PSGroupSpecifier
78 |
79 |
80 | FooterText
81 | Generated by CocoaPods - https://cocoapods.org
82 | Title
83 |
84 | Type
85 | PSGroupSpecifier
86 |
87 |
88 | StringsTable
89 | Acknowledgements
90 | Title
91 | Acknowledgements
92 |
93 |
94 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-TabBarDemo/Pods-TabBarDemo-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_TabBarDemo : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_TabBarDemo
5 | @end
6 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-TabBarDemo/Pods-TabBarDemo-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_TabBarDemoVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_TabBarDemoVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-TabBarDemo/Pods-TabBarDemo.debug.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TransitionAnimation" "${PODS_CONFIGURATION_BUILD_DIR}/TransitionTreasury"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TransitionAnimation/TransitionAnimation.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/TransitionTreasury/TransitionTreasury.framework/Headers"
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_LDFLAGS = $(inherited) -framework "TransitionAnimation" -framework "TransitionTreasury"
7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
8 | PODS_BUILD_DIR = ${BUILD_DIR}
9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
11 | PODS_ROOT = ${SRCROOT}/Pods
12 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-TabBarDemo/Pods-TabBarDemo.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_TabBarDemo {
2 | umbrella header "Pods-TabBarDemo-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/Pods-TabBarDemo/Pods-TabBarDemo.release.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TransitionAnimation" "${PODS_CONFIGURATION_BUILD_DIR}/TransitionTreasury"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TransitionAnimation/TransitionAnimation.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/TransitionTreasury/TransitionTreasury.framework/Headers"
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_LDFLAGS = $(inherited) -framework "TransitionAnimation" -framework "TransitionTreasury"
7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
8 | PODS_BUILD_DIR = ${BUILD_DIR}
9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
11 | PODS_ROOT = ${SRCROOT}/Pods
12 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/TransitionTreasury/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 5.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/TransitionTreasury/TransitionTreasury-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_TransitionTreasury : NSObject
3 | @end
4 | @implementation PodsDummy_TransitionTreasury
5 | @end
6 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/TransitionTreasury/TransitionTreasury-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/TransitionTreasury/TransitionTreasury-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double TransitionTreasuryVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char TransitionTreasuryVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/TransitionTreasury/TransitionTreasury.modulemap:
--------------------------------------------------------------------------------
1 | framework module TransitionTreasury {
2 | umbrella header "TransitionTreasury-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Demo/Pods/Target Support Files/TransitionTreasury/TransitionTreasury.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/TransitionTreasury
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
4 | PODS_BUILD_DIR = ${BUILD_DIR}
5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
6 | PODS_ROOT = ${SRCROOT}
7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 |
--------------------------------------------------------------------------------
/Demo/TabBarDemo/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // TransitionTreasuryTabbarDemo
4 | //
5 | // Created by DianQK on 16/1/16.
6 | // Copyright © 2016年 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import TransitionTreasury
11 | import TransitionAnimation
12 |
13 | @UIApplicationMain
14 | class AppDelegate: UIResponder, UIApplicationDelegate, TRTabBarControllerDelegate {
15 | var window: UIWindow?
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | if let tabBarController = window?.rootViewController as? UITabBarController {
20 | tabBarController.tr_transitionDelegate = TRTabBarTransitionDelegate(method: TRTabBarTransitionMethod.slide)
21 | tabBarController.tr_delegate = self
22 | }
23 | return true
24 | }
25 |
26 | func tr_tabBarController(_ tabBarController: UITabBarController, didSelectViewController viewController: UIViewController) {
27 | print("You did select \(type(of: viewController)).")
28 | }
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/Demo/TabBarDemo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "60x60",
35 | "idiom" : "iphone",
36 | "filename" : "icon_tab@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "icon_tab@3x.png",
43 | "scale" : "3x"
44 | }
45 | ],
46 | "info" : {
47 | "version" : 1,
48 | "author" : "xcode"
49 | }
50 | }
--------------------------------------------------------------------------------
/Demo/TabBarDemo/Assets.xcassets/AppIcon.appiconset/icon_tab@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/TabBarDemo/Assets.xcassets/AppIcon.appiconset/icon_tab@2x.png
--------------------------------------------------------------------------------
/Demo/TabBarDemo/Assets.xcassets/AppIcon.appiconset/icon_tab@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/TabBarDemo/Assets.xcassets/AppIcon.appiconset/icon_tab@3x.png
--------------------------------------------------------------------------------
/Demo/TabBarDemo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Demo/TabBarDemo/Assets.xcassets/first.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "first.pdf"
6 | }
7 | ],
8 | "info" : {
9 | "version" : 1,
10 | "author" : "xcode"
11 | }
12 | }
--------------------------------------------------------------------------------
/Demo/TabBarDemo/Assets.xcassets/first.imageset/first.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/TabBarDemo/Assets.xcassets/first.imageset/first.pdf
--------------------------------------------------------------------------------
/Demo/TabBarDemo/Assets.xcassets/second.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "second.pdf"
6 | }
7 | ],
8 | "info" : {
9 | "version" : 1,
10 | "author" : "xcode"
11 | }
12 | }
--------------------------------------------------------------------------------
/Demo/TabBarDemo/Assets.xcassets/second.imageset/second.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Demo/TabBarDemo/Assets.xcassets/second.imageset/second.pdf
--------------------------------------------------------------------------------
/Demo/TabBarDemo/FirstViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FirstViewController.swift
3 | // TransitionTreasuryTabbarDemo
4 | //
5 | // Created by DianQK on 16/1/16.
6 | // Copyright © 2016年 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class FirstViewController: UIViewController {
12 |
13 | lazy var gesture: UIPanGestureRecognizer = {
14 | let gesture = UIPanGestureRecognizer(target: self, action: #selector(FirstViewController.swipeTransition(_:)))
15 | return gesture
16 | }()
17 |
18 | override func viewDidLoad() {
19 | super.viewDidLoad()
20 | view.addGestureRecognizer(gesture)
21 | }
22 |
23 | @objc func swipeTransition(_ sender: UIPanGestureRecognizer) {
24 | switch sender.state {
25 | case .began :
26 | if sender.translation(in: sender.view).x < 0 {
27 | tabBarController?.tr_selected(1, gesture: sender)
28 | }
29 | default : break
30 | }
31 | }
32 |
33 |
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/Demo/TabBarDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Demo/TabBarDemo/SecondViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SecondViewController.swift
3 | // TransitionTreasuryTabbarDemo
4 | //
5 | // Created by DianQK on 16/1/16.
6 | // Copyright © 2016年 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class SecondViewController: UIViewController {
12 |
13 | lazy var gesture: UIPanGestureRecognizer = {
14 | let gesture = UIPanGestureRecognizer(target: self, action: #selector(SecondViewController.swipeTransition(_:)))
15 | return gesture
16 | }()
17 |
18 | override func viewDidLoad() {
19 | super.viewDidLoad()
20 | // Do any additional setup after loading the view, typically from a nib.
21 | view.addGestureRecognizer(gesture)
22 | }
23 |
24 | @objc func swipeTransition(_ sender: UIPanGestureRecognizer) {
25 | switch sender.state {
26 | case .began :
27 | print("Began")
28 | if sender.translation(in: sender.view).x >= 0 {
29 | tabBarController?.tr_selected(0, gesture: sender)
30 | } else if sender.translation(in: sender.view).x < 0 {
31 | tabBarController?.tr_selected(2, gesture: sender)
32 | }
33 |
34 | default : break
35 | }
36 | }
37 |
38 |
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/Demo/TabBarDemo/ThirdViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ThirdViewController.swift
3 | // Demo
4 | //
5 | // Created by 宋宋 on 16/3/7.
6 | // Copyright © 2016年 DianQK. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ThirdViewController: UIViewController {
12 |
13 | lazy var gesture: UIPanGestureRecognizer = {
14 | let gesture = UIPanGestureRecognizer(target: self, action: #selector(ThirdViewController.swipeTransition(_:)))
15 | return gesture
16 | }()
17 |
18 | override func viewDidLoad() {
19 | super.viewDidLoad()
20 | // Do any additional setup after loading the view, typically from a nib.
21 | view.addGestureRecognizer(gesture)
22 | }
23 |
24 | @objc func swipeTransition(_ sender: UIPanGestureRecognizer) {
25 | switch sender.state {
26 | case .began :
27 | print("Began")
28 | if sender.translation(in: sender.view).x >= 0 {
29 | tabBarController?.tr_selected(1, gesture: sender)
30 | }
31 | default : break
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/Demo/TabBarDemo/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // TabBarDemo
4 | //
5 | // Created by 宋宋 on 16/2/5.
6 | // Copyright © 2016年 DianQK. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 | // Do any additional setup after loading the view, typically from a nib.
16 | }
17 |
18 | override func didReceiveMemoryWarning() {
19 | super.didReceiveMemoryWarning()
20 | // Dispose of any resources that can be recreated.
21 | }
22 |
23 |
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/Documentation/Advance-Usage.md:
--------------------------------------------------------------------------------
1 | ### Custom Animation
2 |
3 | Now, there is just **Custom Animation**, other usages are coming after next version.
4 |
5 | Like **Basic-Usage**, just replace `method` paramters to `Custom(TRViewControllerAnimatedTransitioning)`, provide your animation object.
6 |
7 | > Note:
8 | > Thanks to Swift's Enum. I can write more concise code.
9 | > You also can use exist transition animation, just a joke~, here just be used to show an example.
10 |
11 | Example:
12 |
13 | ```swift
14 | navigationController?.tr_pushViewController(vc, method: .Custom(OMINTransitionAnimation(key: view)), completion: {
15 | print("Push finished")
16 | })
17 | ```
18 |
19 | > About write your animation, you can read [Animation-Guide](https://github.com/DianQK/TransitionTreasury/wiki/Animation-Guide), I happy to you will share your animation for this project.
20 |
21 | ### Status Bar Style
22 |
23 | If you want to update status bar style, you should add key `View controller-based status bar appearance` in **info.plist**, and set value is `false`.
24 |
25 | Then like **Basic Usage**, just add param `statusBarStyle`:
26 |
27 | ```swift
28 | // Push & Pop
29 | tr_pushViewController(viewController: UIViewController, method: TRPushTransitionMethod, statusBarStyle: UIStatusBarStyle = .Default)
30 |
31 | // Present & Dismiss
32 | tr_presentViewController(viewControllerToPresent: UIViewController, method: TRPresentTransitionMethod, statusBarStyle: UIStatusBarStyle = .Default)
33 | ```
34 |
35 | ### Interactive Transition Animation
36 |
37 | See TransitionTreasuryDemo Scheme:
38 |
39 | ```swift
40 | func interactiveTransition(sender: UIPanGestureRecognizer) {
41 | switch sender.state {
42 | case .Began :
43 | guard sender.translationInView(view).y > 0 else {
44 | break
45 | }
46 | let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("ModalViewController") as! ModalViewController
47 | vc.modalDelegate = self
48 | tr_presentViewController(vc, method: .Scanbot(present: sender, dismiss: vc.dismissGestureRecognizer), completion: {
49 | print("Present finished")
50 | })
51 | default : break
52 | }
53 | }
54 | ```
55 | > Warning:
56 | > Make sure you just call `tr_presentViewController(_:_:_:)` once.
57 |
58 | ### TabBar Transition Animation
59 |
60 | Just Add this code:
61 |
62 | ```swift
63 | tabBarController.tr_transitionDelegate = TRTabBarTransitionDelegate(method: .Swipe)
64 | ```
65 |
66 | > Note:
67 | > If you need `delegate`, please use `tr_delegate`.
68 |
69 | You can see TransitionTreasuryTabBarDemo Scheme.
--------------------------------------------------------------------------------
/Documentation/Animation-Guide.md:
--------------------------------------------------------------------------------
1 | ## Fade Animation
2 |
3 | Just let your Class conform `TRViewControllerAnimatedTransitioning`, I name the class is `FadeTransitionAnimation`. You should implement:
4 |
5 | ```swift
6 | /// Required implement.
7 | var transitionStatus: TransitionStatus?{get set}
8 | /// Rquired implement.
9 | var transitionContext: UIViewControllerContextTransitioning?{get set}
10 | ```
11 |
12 | Just add:
13 |
14 | ```swift
15 | public var transitionStatus: TransitionStatus?
16 | public var transitionContext: UIViewControllerContextTransitioning?
17 | ```
18 |
19 | You can also add:
20 |
21 | ```swift
22 | var interacting: Bool{get set}
23 | /// Rquired implement.
24 | var transitionContext: UIViewControllerContextTransitioning?{get set}
25 |
26 | var cancelPop: Bool{get set}
27 | /// Option
28 | var completion: (() -> Void)?{get set}
29 | /// Option
30 | var interactivePrecent: CGFloat{get}
31 | /**
32 | Option
33 |
34 | - parameter index: index of navgationViewController.viewcontrollers
35 | */
36 | func popToVCIndex(index: Int)
37 | ```
38 |
39 | > Note:
40 | > this property and method just use for `TRNavgationTransitionDelegate` and `TRViewControllerTransitionDelegate`. You should set `tansitionContext`.
41 |
42 | We need a `init` method, here we don't need other parameters.
43 |
44 | We also should implement this methods, due to `TRViewControllerAnimatedTransitioning` conform `UIViewControllerAnimatedTransitioning`:
45 |
46 | ```swift
47 | // This is used for percent driven interactive transitions, as well as for container controllers that have companion animations that might need to
48 | // synchronize with the main animation.
49 | public func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval
50 | // This method can only be a nop if the transition is interactive and not a percentDriven interactive transition.
51 | public func animateTransition(transitionContext: UIViewControllerContextTransitioning)
52 | ```
53 |
54 | For `transitionDuration(_:)`, set return 0.3s:
55 |
56 | ```swift
57 | public func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
58 | return 0.3
59 | }
60 | ```
61 |
62 | For `animateTransition(_:)`, here is `Present` code:
63 |
64 | ```swift
65 | public func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
66 | self.transitionContext = transitionContext
67 | let fromVC = transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)
68 | let toVC = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)
69 | let containView = transitionContext.containerView()
70 |
71 | containView?.addSubview(fromVC!.view)
72 | containView?.addSubview(toVC!.view)
73 | toVC!.view.layer.opacity = 0
74 |
75 | UIView.animateWithDuration(transitionDuration(transitionContext), delay: 0, options: .CurveEaseInOut, animations: {
76 | toVC!.view.layer.opacity = 1
77 | }) { (finished) -> Void in
78 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled())
79 | }
80 | }
81 | ```
82 |
83 | Hey~ We have completed `Dismiss`, same to `Present`~
84 |
85 | > For more, we can swap `fromVC` and `toVC`, or rename to you like.
86 | > You can see Full code on [FadeTransitionAnimation](https://github.com/DianQK/TransitionTreasury/Source/FadeTransitionAnimation).
87 | > About more animation, you can read `[官方文档](https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html)、[A GUIDE TO IOS ANIMATION](http://book.kittenyang.com)、[iOS Core Animation Advanced Techniques](http://www.amazon.com/iOS-Core-Animation-Advanced-Techniques-ebook/dp/B00EHJCORC)、[iOS Animations by Tutorials Second Edition](http://www.raywenderlich.com/store/ios-animations-by-tutorials)`. I just introduce how to write animation for this project.
88 |
89 | Try your code now~:
90 |
91 | ```swift
92 | tr_presentViewController(nav, method: .Custom(FadeTransitionAnimation()), completion: nil)
93 | ```
94 |
95 | > You can use `Fade` to show guide viewController for you app. ^_^
96 |
97 | ## Other Tips
98 |
99 | ### Gesture
100 |
101 | I have write **Swipe Back**. For more gestures , you have to write your code on your file.
102 |
103 | > I have some troubles for `PhotoTransitionAnimation` that is following Apple's Photos. If you are intresting this, see `PhotoTransitionAnimation.swift`.
104 |
--------------------------------------------------------------------------------
/Documentation/Basic-Usage.md:
--------------------------------------------------------------------------------
1 | ### Make a Push
2 |
3 | If we need to push `FirstViewController` to `SecondViewController`, `SecondViewController` should conform `NavgationTransitionable`, and add code `var tr_transition: TRNavgationTransitionDelegate?`, I need use this property to retain animation object. Of course, you can use this do more, but it is dangerous.
4 |
5 | When you need to push, just call `public func tr_pushViewController(viewController: UIViewController, method: TRPushTransitionMethod, completion: (() -> Void)?)`, like Apple method. About `method` parameter, see [transitiontreasury.com](http://transitiontreasury.com).
6 |
7 | Example:
8 |
9 | ```swift
10 | /// FirstViewController.swift
11 | class FirstViewController: UIViewController {
12 |
13 | func push() {
14 | let vc = SecondViewController()
15 | navigationController?.tr_pushViewController(vc, method: .Fade, completion: {
16 | print("Push finish")
17 | })
18 | }
19 | }
20 |
21 | /// SecondViewController.swift
22 | class SecondViewController: UIViewController, TRTransition {
23 |
24 | var tr_transition: TRNavgationTransitionDelegate?
25 |
26 | func pop() {
27 | tr_popViewController()
28 | }
29 | }
30 | ```
31 |
32 | When you need to pop, just call `public func tr_popViewController(completion: (() -> Void)? = nil) -> UIViewController?`.
33 |
34 | ### Make a Present
35 |
36 | If we present `MainViewController` to `ModalViewController`:
37 |
38 | * `MainViewController` should conform `ModalTransitionDelegate`, and add `var tr_transition: TRViewControllerTransitionDelegate?`
39 | * Add `weak var modalDelegate: ModalViewControllerDelegate?` for `ModalViewController`.
40 |
41 | Example:
42 |
43 | ```Swift
44 | /// MainViewController.swift
45 | class MainViewController: UIViewController, ModalTransitionDelegate {
46 |
47 | var tr_transition: TRViewControllerTransitionDelegate?
48 |
49 | func present() {
50 | let vc = ModalViewController()
51 | vc.modalDelegate = self // Don't forget to set modalDelegate
52 | tr_presentViewController(vc, method: .Fade, completion: {
53 | print("Present finished.")
54 | })
55 | }
56 | }
57 |
58 | /// ModalViewController.swift
59 | class ModalViewController: UIViewController {
60 |
61 | weak var modalDelegate: ModalViewControllerDelegate?
62 |
63 | func dismiss() {
64 | modalDelegate?.modalViewControllerDismiss(callbackData: nil)
65 | }
66 | }
67 | ```
68 |
69 | if you need `callbackData` , your `MianViewController` should implement :
70 |
71 | ```swift
72 | func modalViewControllerDismiss(interactive interactive: Bool, callbackData data:AnyObject?)
73 |
74 | // or
75 |
76 | func modalViewControllerDismiss(callbackData data:AnyObject?)
77 | ```
78 |
79 | `interactive` just for interactive dismiss, for more see Advanced Usage.
80 |
81 | > Note:
82 | > If you don't need callbackData, maybe you haven't implemented `func modalViewControllerDismiss(callbackData data:AnyObject?)`.
83 | > If you don't want to use `ModalTransitionDelegate`, you can use `ViewControllerTransitionable` which only for Animation.
84 | > Warning:
85 | > You shouldn't use `tr_dismissViewController()` in your **ModalViewController**. Please use `delegate`. I have implented this, just use `modalDelegate?.modalViewControllerDismiss(callbackData: ["data":"back"])`. For more, you can read [Dismissing a Presented View Controller](http://stackoverflow.com/questions/14636891/dismissing-a-presented-view-controller).
--------------------------------------------------------------------------------
/Documentation/Introduction.md:
--------------------------------------------------------------------------------
1 | ## Framework
2 |
3 | [](http://transitiontreasury.com/assets/images/framework.png)
4 |
5 | > View [pdf](http://transitiontreasury.com/assets/images/framework.pdf).
6 |
7 | ## API
8 |
9 | ```swift
10 | public func tr_pushViewController(viewcontroller: UIViewController, method: TRPushMethod, completion: (() -> Void)?)
11 | ```
--------------------------------------------------------------------------------
/Documentation/TransitionTreasury 3.0 Migration Guide.md:
--------------------------------------------------------------------------------
1 | # TransitionTreasury 3.0 Migration Guide
2 |
3 | ## Breaking changes:
4 |
5 | * `tr_transition` has been replaced with `tr_pushTranstion` and `tr_presentTransition`.
6 | * Case `custom(TRViewControllerAnimatedTransitioning)` has been remove from this framework.
7 | * Update present method to `tr_presentViewController(viewControllerToPresent: UIViewController, method: TransitionAnimationable, statusBarStyle: TRStatusBarStyle = .Default, completion: (() -> Void)? = nil)`. Now we use protocol `TransitionAnimationable`,so if you need call like this:
8 | ```swift
9 | tr_presentViewController(nav, method: TRPresentTransitionMethod.Twitter, completion: {
10 | print("Present finished.")
11 | })
12 | ```
13 |
14 | > Now create your Transition struct or enum will be easier. Just conform `TransitionAnimationable`.
15 |
16 | ## Help
17 |
18 | If you have any additional questions around migration, feel free to open a documentation issue on Github to get more clarity added to this guide.
19 |
--------------------------------------------------------------------------------
/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/Example.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/Example/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // Example
4 | //
5 | // Created by DianQK on 16/3/24.
6 | // Copyright © 2016年 com.transitiontreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/Example/Example/Assets.xcassets/AppIcon.appiconset/60 - iPhone@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Example/Example/Assets.xcassets/AppIcon.appiconset/60 - iPhone@2x.png
--------------------------------------------------------------------------------
/Example/Example/Assets.xcassets/AppIcon.appiconset/60 - iPhone@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Example/Example/Assets.xcassets/AppIcon.appiconset/60 - iPhone@3x.png
--------------------------------------------------------------------------------
/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "60x60",
35 | "idiom" : "iphone",
36 | "filename" : "60 - iPhone@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "60 - iPhone@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "idiom" : "ios-marketing",
47 | "size" : "1024x1024",
48 | "scale" : "1x"
49 | }
50 | ],
51 | "info" : {
52 | "version" : 1,
53 | "author" : "xcode"
54 | }
55 | }
--------------------------------------------------------------------------------
/Example/Example/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Example/Example/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Example/Example/FirstViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FirstViewController.swift
3 | // Example
4 | //
5 | // Created by DianQK on 16/3/24.
6 | // Copyright © 2016年 com.transitiontreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import TransitionTreasury
11 | import TransitionAnimation
12 |
13 | class FirstViewController: UIViewController, ModalTransitionDelegate {
14 |
15 | var tr_presentTransition: TRViewControllerTransitionDelegate?
16 |
17 | @IBAction func pushClick(_ sender: UIButton) {
18 | let second = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "SecondViewController") as! SecondViewController
19 | navigationController?.tr_pushViewController(second, method: TRPushTransitionMethod.page)
20 | }
21 |
22 |
23 | @IBAction func presentClick(_ sender: UIButton) {
24 | let model = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ModalViewController") as! ModalViewController
25 | model.modalDelegate = self
26 | tr_presentViewController(model, method: TRPresentTransitionMethod.twitter)
27 | }
28 |
29 | func modalViewControllerDismiss(callbackData data: Any?) {
30 | tr_dismissViewController()
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/Example/Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Example/Example/ModalViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ModalViewController.swift
3 | // Example
4 | //
5 | // Created by DianQK on 16/3/24.
6 | // Copyright © 2016年 com.transitiontreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import TransitionTreasury
11 | import TransitionAnimation
12 |
13 | class ModalViewController: UIViewController {
14 |
15 | weak var modalDelegate: ModalViewControllerDelegate?
16 |
17 | @IBAction func dissmissClick(_ sender: UIButton) {
18 | modalDelegate?.modalViewControllerDismiss(callbackData: nil)
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Example/Example/SecondViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SecondViewController.swift
3 | // Example
4 | //
5 | // Created by DianQK on 16/3/24.
6 | // Copyright © 2016年 com.transitiontreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import TransitionTreasury
11 | import TransitionAnimation
12 |
13 | class SecondViewController: UIViewController, NavgationTransitionable {
14 |
15 | var tr_pushTransition: TRNavgationTransitionDelegate?
16 |
17 | @IBAction func popClick(_ sender: UIButton) {
18 | _ = navigationController?.tr_popViewController()
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // ExampleWithoutAnimation
4 | //
5 | // Created by DianQK on 16/3/24.
6 | // Copyright © 2016年 com.transitiontreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/Assets.xcassets/AppIcon.appiconset/60 - iPhone@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Example/ExampleWithoutAnimation/Assets.xcassets/AppIcon.appiconset/60 - iPhone@2x.png
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/Assets.xcassets/AppIcon.appiconset/60 - iPhone@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/Example/ExampleWithoutAnimation/Assets.xcassets/AppIcon.appiconset/60 - iPhone@3x.png
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "3x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "3x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "57x57",
31 | "scale" : "1x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "57x57",
36 | "scale" : "2x"
37 | },
38 | {
39 | "size" : "60x60",
40 | "idiom" : "iphone",
41 | "filename" : "60 - iPhone@2x.png",
42 | "scale" : "2x"
43 | },
44 | {
45 | "size" : "60x60",
46 | "idiom" : "iphone",
47 | "filename" : "60 - iPhone@3x.png",
48 | "scale" : "3x"
49 | }
50 | ],
51 | "info" : {
52 | "version" : 1,
53 | "author" : "xcode"
54 | }
55 | }
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/FirstViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FirstViewController.swift
3 | // Example
4 | //
5 | // Created by DianQK on 16/3/24.
6 | // Copyright © 2016年 com.transitiontreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import TransitionTreasury
11 |
12 | class FirstViewController: UIViewController, ModalTransitionDelegate {
13 |
14 | var tr_presentTransition: TRViewControllerTransitionDelegate?
15 |
16 | @IBAction func pushClick(_ sender: UIButton) {
17 | let second = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "SecondViewController") as! SecondViewController
18 | navigationController?.tr_pushViewController(second, method: Transition.push)
19 | }
20 |
21 |
22 | @IBAction func presentClick(_ sender: UIButton) {
23 | let model = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ModalViewController") as! ModalViewController
24 | model.modalDelegate = self
25 | tr_presentViewController(model, method: Transition.present)
26 | }
27 |
28 | func modalViewControllerDismiss(callbackData data: AnyObject?) {
29 | tr_dismissViewController()
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/ModalViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ModalViewController.swift
3 | // Example
4 | //
5 | // Created by DianQK on 16/3/24.
6 | // Copyright © 2016年 com.transitiontreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import TransitionTreasury
11 |
12 | class ModalViewController: UIViewController {
13 |
14 | weak var modalDelegate: ModalViewControllerDelegate?
15 |
16 | @IBAction func dissmissClick(_ sender: UIButton) {
17 | modalDelegate?.modalViewControllerDismiss(callbackData: nil)
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/SecondViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SecondViewController.swift
3 | // Example
4 | //
5 | // Created by DianQK on 16/3/24.
6 | // Copyright © 2016年 com.transitiontreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import TransitionTreasury
11 |
12 | class SecondViewController: UIViewController, NavgationTransitionable {
13 |
14 | var tr_pushTransition: TRNavgationTransitionDelegate?
15 |
16 | @IBAction func popClick(_ sender: UIButton) {
17 | navigationController?.tr_popViewController()
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/Example/ExampleWithoutAnimation/Transition.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FadeTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/22/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 |
11 | public enum Transition: TransitionAnimationable {
12 | case push
13 | case present
14 |
15 | public func transitionAnimation() -> TRViewControllerAnimatedTransitioning {
16 | switch self {
17 | case .push:
18 | return FadeTransitionAnimation()
19 | case .present:
20 | return FadeTransitionAnimation(status: .present)
21 | }
22 | }
23 | }
24 |
25 | open class FadeTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning, TransitionInteractiveable {
26 |
27 | open var transitionStatus: TransitionStatus
28 |
29 | open var transitionContext: UIViewControllerContextTransitioning?
30 |
31 | open var percentTransition: UIPercentDrivenInteractiveTransition?
32 |
33 | open var completion: (() -> Void)?
34 |
35 | open var cancelPop: Bool = false
36 |
37 | open var interacting: Bool = false
38 |
39 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
40 | return 0.3
41 | }
42 |
43 | public init(status: TransitionStatus = .push) {
44 | transitionStatus = status
45 | super.init()
46 | }
47 |
48 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
49 | self.transitionContext = transitionContext
50 | let fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
51 | let toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
52 | let containView = transitionContext.containerView
53 |
54 | containView.addSubview(fromVC!.view)
55 | containView.addSubview(toVC!.view)
56 | toVC!.view.layer.opacity = 0
57 |
58 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseInOut, animations: {
59 | toVC!.view.layer.opacity = 1
60 | }) { finished in
61 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
62 | if !self.cancelPop {
63 | if finished {
64 | self.completion?()
65 | self.completion = nil
66 | }
67 | }
68 | self.cancelPop = false
69 | }
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 | platform :ios, '8.0'
3 |
4 | use_frameworks!
5 |
6 | # Our Libraries
7 | def libraries
8 | pod 'TransitionTreasury', :path => "../"
9 | pod 'TransitionAnimation', :path => "../"
10 | end
11 |
12 | target 'Example' do
13 | libraries
14 | end
15 |
16 | target 'ExampleWithoutAnimation' do
17 | libraries
18 | end
19 |
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - TransitionAnimation (7.0.0):
3 | - TransitionTreasury (~> 7.0.0)
4 | - TransitionTreasury (7.0.0)
5 |
6 | DEPENDENCIES:
7 | - TransitionAnimation (from `../`)
8 | - TransitionTreasury (from `../`)
9 |
10 | EXTERNAL SOURCES:
11 | TransitionAnimation:
12 | :path: "../"
13 | TransitionTreasury:
14 | :path: "../"
15 |
16 | SPEC CHECKSUMS:
17 | TransitionAnimation: cf8926e5e11e4f3b3d8b8a4260d1e7953567af58
18 | TransitionTreasury: f88c2bdf282c85d02386362c3c25981174fec995
19 |
20 | PODFILE CHECKSUM: a8cf91f01b6192d3d50628e3cccbcd61902bef12
21 |
22 | COCOAPODS: 1.7.5
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/Supporting Files/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 6.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Supporting Files/TransitionAnimation.h:
--------------------------------------------------------------------------------
1 | //
2 | // TransitionAnimation.h
3 | // TransitionAnimation
4 | //
5 | // Created by 宋宋 on 16/2/5.
6 | // Copyright © 2016年 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for TransitionAnimation.
12 | FOUNDATION_EXPORT double TransitionAnimationVersionNumber;
13 |
14 | //! Project version string for TransitionAnimation.
15 | FOUNDATION_EXPORT const unsigned char TransitionAnimationVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Supporting Files/TransitionTreasury.h:
--------------------------------------------------------------------------------
1 | //
2 | // TransitionTreasury.h
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/30/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for TransitionTreasury.
12 | FOUNDATION_EXPORT double TransitionTreasuryVersionNumber;
13 |
14 | //! Project version string for TransitionTreasury.
15 | FOUNDATION_EXPORT const unsigned char TransitionTreasuryVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/TransitionAnimation.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'TransitionAnimation'
3 | s.version = '7.0.0'
4 | s.license = { :type => "MIT", :file => "LICENSE" }
5 | s.summary = 'Transition Animation with TransitionTreasury'
6 | s.homepage = 'https://github.com/DianQK/TransitionTreasury'
7 | s.screenshots = 'https://raw.githubusercontent.com/DianQK/TransitionTreasury/master/transitiontreasury.png'
8 | s.social_media_url = 'http://transitiontreasury.com'
9 | s.authors = { 'DianQK' => 'xiaoqing@dianqk.org' }
10 | s.source = { :git => 'https://github.com/DianQK/TransitionTreasury.git', :tag => s.version }
11 | s.source_files = ['TransitionAnimation/*.swift']
12 | s.ios.deployment_target = '8.0'
13 | s.requires_arc = true
14 |
15 | s.dependency 'TransitionTreasury', '~> 7.0.0'
16 |
17 | s.swift_version = '5.0'
18 | end
19 |
--------------------------------------------------------------------------------
/TransitionAnimation/BlixtTransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BlixtTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 1/1/16.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 |
11 | open class BlixtTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning, TransitionInteractiveable {
12 |
13 | open var keyView: UIView
14 |
15 | open var transitionStatus: TransitionStatus
16 |
17 | open var transitionContext: UIViewControllerContextTransitioning?
18 |
19 | open var percentTransition: UIPercentDrivenInteractiveTransition?
20 |
21 | open var completion: (() -> Void)?
22 |
23 | open var cancelPop: Bool = false
24 |
25 | open var interacting: Bool = false
26 |
27 | public let toFrame: CGRect
28 |
29 | fileprivate lazy var keyViewCopy: UIView = self.keyView.tr_copyWithSnapshot()
30 |
31 | public init(key: UIView, toFrame frame:CGRect, status: TransitionStatus = .push) {
32 | keyView = key
33 | toFrame = frame
34 | transitionStatus = status
35 | super.init()
36 | }
37 |
38 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
39 | return 0.6
40 | }
41 |
42 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
43 | self.transitionContext = transitionContext
44 | let fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
45 | let toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
46 | let containView = transitionContext.containerView
47 |
48 | let leftX: CGFloat = 0
49 | let rightX = UIScreen.main.bounds.width
50 |
51 | fromVC?.view.layer.frame.origin.x = leftX
52 | toVC?.view.layer.frame.origin.x = transitionStatus == .push ? rightX : -rightX
53 |
54 | containView.addSubview(fromVC!.view)
55 | containView.addSubview(toVC!.view)
56 | containView.tr_addSubview(keyViewCopy, convertFrom: (transitionStatus == .push ? keyView : keyViewCopy))
57 | keyView.layer.opacity = 0
58 |
59 | func bounce(_ completion: (() -> Void)? = nil) {
60 | UIView.animate(withDuration: 0.1) {
61 | self.keyViewCopy.frame = containView.convert(self.keyView.frame.tr_shape(0.97), from: self.keyView.superview)
62 | }
63 | UIView.animate(withDuration: 0.1, delay: 0.1, options: .curveEaseInOut, animations: {
64 | self.keyViewCopy.frame = containView.convert(self.keyView.frame, from: self.keyView.superview)
65 | }) { finished in
66 | completion?()
67 | }
68 | }
69 |
70 | if transitionStatus == .push {
71 | bounce()
72 | }
73 |
74 | UIView.animate(withDuration: transitionDuration(using: transitionContext) - 0.2, delay: 0.2, options: .curveEaseInOut, animations: {
75 | switch self.transitionStatus {
76 | case .push :
77 | fromVC?.view.layer.frame.origin.x = -rightX
78 | toVC?.view.layer.frame.origin.x = leftX
79 | self.keyViewCopy.frame = self.toFrame
80 | case .pop :
81 | fromVC?.view.layer.frame.origin.x = rightX
82 | toVC?.view.layer.frame.origin.x = leftX
83 | self.keyViewCopy.frame = containView.convert(self.keyView.frame, from: self.keyView.superview)
84 | default :
85 | fatalError("You set false status.")
86 | }
87 | }) { finished in
88 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
89 | if finished && !self.cancelPop {
90 | toVC?.view.addSubview(self.keyViewCopy)
91 | if self.transitionStatus == .pop {
92 | self.keyView.layer.opacity = 1
93 | self.keyViewCopy.removeFromSuperview()
94 |
95 | }
96 | self.completion?()
97 | self.completion = nil
98 | }
99 | self.cancelPop = false
100 | }
101 | }
102 |
103 | }
104 |
105 |
--------------------------------------------------------------------------------
/TransitionAnimation/DefaultPercentDrivenInteractiveTransition.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DefaultPercentDrivenInteractiveTransition.swift
3 | // DefaultPercentDrivenInteractiveTransition
4 | //
5 | // Created by John_LS on 2016/12/22.
6 | // Copyright © 2016年 John_LS. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class DefaultPercentDrivenInteractiveTransition: UIPercentDrivenInteractiveTransition {
12 |
13 |
14 | ///以下是自定义交互控制器
15 | var transitionContext : UIViewControllerContextTransitioning!
16 | var formView : UIView!
17 | var toView : UIView!
18 | let x_to : CGFloat = -100.0 ///toview起始x坐标
19 |
20 |
21 | /// 以下----自定义交互控制器
22 | override func startInteractiveTransition(_ transitionContext: UIViewControllerContextTransitioning) {
23 |
24 |
25 | let containerView = transitionContext.containerView
26 |
27 | guard let fromViewController = transitionContext.viewController(forKey: .from),
28 | let toViewController = transitionContext.viewController(forKey: .to) else {
29 | ///预防rootviewcontroller触发
30 | return
31 | }
32 |
33 |
34 | self.transitionContext = transitionContext
35 |
36 |
37 | containerView.insertSubview((toViewController.view)!, belowSubview: (fromViewController.view)!)
38 |
39 |
40 | /// 加点阴影
41 | fromViewController.view.layer.shadowOpacity = 0.8
42 | fromViewController.view.layer.shadowColor = UIColor.black.cgColor
43 | fromViewController.view.layer.shadowOffset = CGSize(width: 3, height: 3)
44 | fromViewController.view.layer.shadowRadius = 3
45 |
46 | self.formView = fromViewController.view
47 | self.toView = toViewController.view
48 | self.toView.frame = CGRect(x:x_to,y:0,width:self.toView.frame.width,height:self.toView.frame.height)
49 |
50 | }
51 | override func update(_ percentComplete: CGFloat) {
52 |
53 | if transitionContext == nil {
54 | ///预防rootviewcontroller触发
55 | return
56 | }
57 |
58 | self.formView?.frame = CGRect(x:(self.formView?.frame.width)!*percentComplete, y:0, width:(self.formView?.frame.width)! , height: (self.formView?.frame.height)!)
59 | self.toView?.frame = CGRect(x:self.x_to+CGFloat(fabsf(Float(self.x_to*percentComplete))), y:0, width:(self.toView?.frame.width)! , height: (self.toView?.frame.height)!)
60 | transitionContext?.updateInteractiveTransition(percentComplete)
61 |
62 | }
63 |
64 |
65 |
66 | func finishBy(cancelled: Bool) {
67 | if self.transitionContext == nil {
68 | ///预防rootviewcontroller触发
69 | return
70 | }
71 | if cancelled {
72 | UIView.animate(withDuration: 0.2, animations: {
73 | self.formView?.frame = CGRect(x:0, y:0, width:(self.formView?.frame.width)! , height: (self.formView?.frame.height)!)
74 | self.toView?.frame = CGRect(x:self.x_to, y:0, width:(self.toView?.frame.width)! , height: (self.toView?.frame.height)!)
75 | }, completion: {completed in
76 | self.transitionContext!.cancelInteractiveTransition()
77 | self.transitionContext!.completeTransition(false)
78 | self.transitionContext = nil
79 | self.toView = nil
80 | self.formView = nil
81 | })
82 | } else {
83 | UIView.animate(withDuration: 0.2, animations: {
84 | self.formView?.frame = CGRect(x:(self.formView?.frame.width)!, y:0, width:(self.formView?.frame.width)! , height: (self.formView?.frame.height)!)
85 | self.toView?.frame = CGRect(x:0, y:0, width:(self.toView?.frame.width)! , height: (self.toView?.frame.height)!)
86 | }, completion: {completed in
87 | self.transitionContext!.finishInteractiveTransition()
88 | self.transitionContext!.completeTransition(true)
89 | self.transitionContext = nil
90 | self.toView = nil
91 | self.formView = nil
92 | })
93 | }
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/TransitionAnimation/DefaultPushTransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DefaultPushTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 16/1/24.
6 | // Copyright © 2016年 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 | /// Apple Default Push Transition
11 | open class DefaultPushTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning, TransitionInteractiveable {
12 |
13 | open var transitionStatus: TransitionStatus
14 |
15 | open var transitionContext: UIViewControllerContextTransitioning?
16 |
17 | public lazy var percentTransition: UIPercentDrivenInteractiveTransition? = {
18 | return UIPercentDrivenInteractiveTransition()
19 | }()
20 |
21 | open var completion: (() -> Void)?
22 |
23 | open var cancelPop: Bool = false
24 |
25 | open var interacting: Bool = false
26 |
27 | fileprivate var shadowOpacityBackup: Float?
28 | fileprivate var shadowOffsetBackup: CGSize?
29 | fileprivate var shadowRadiusBackup: CGFloat?
30 | fileprivate var shadowPathBackup: CGPath?
31 |
32 | public init(status: TransitionStatus = .push) {
33 | transitionStatus = status
34 | super.init()
35 | }
36 |
37 | public func finishByCancelled(_ cancelled: Bool) {
38 | if let percentTransition = percentTransition {
39 | if cancelled {
40 | percentTransition.cancel()
41 | } else {
42 | percentTransition.finish()
43 | }
44 | }
45 | }
46 |
47 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
48 | return 0.3
49 | }
50 |
51 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
52 | self.transitionContext = transitionContext
53 | var fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
54 | var toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
55 | let containView = transitionContext.containerView
56 |
57 | var fromVCStartX: CGFloat = 0
58 | var fromVCEndX = -UIScreen.main.bounds.width/3
59 |
60 | var toVCStartX = UIScreen.main.bounds.width
61 | var toVCEndX: CGFloat = 0
62 |
63 | if transitionStatus == .pop {
64 | swap(&fromVC, &toVC)
65 | swap(&fromVCStartX, &fromVCEndX)
66 | swap(&toVCStartX, &toVCEndX)
67 | }
68 |
69 | containView.addSubview(fromVC!.view)
70 | containView.addSubview(toVC!.view)
71 |
72 | fromVC?.view.frame.origin.x = fromVCStartX
73 |
74 | toVC?.view.frame.origin.x = toVCStartX
75 | shadowOpacityBackup = toVC?.view.layer.shadowOpacity
76 | shadowOffsetBackup = toVC?.view.layer.shadowOffset
77 | shadowRadiusBackup = toVC?.view.layer.shadowRadius
78 | shadowPathBackup = toVC?.view.layer.shadowPath
79 | toVC?.view.layer.shadowOpacity = 0.3
80 | toVC?.view.layer.shadowOffset = CGSize(width: -3, height: 0)
81 | toVC?.view.layer.shadowRadius = 5
82 | toVC?.view.layer.shadowPath = CGPath(rect: toVC!.view.layer.bounds, transform: nil)
83 |
84 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseInOut, animations: {
85 | fromVC?.view.frame.origin.x = fromVCEndX
86 | toVC?.view.frame.origin.x = toVCEndX
87 | }) { finished in
88 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
89 | if !self.cancelPop {
90 | toVC?.view.layer.shadowOpacity = 0
91 | if finished {
92 | toVC?.view.layer.shadowOpacity = self.shadowOpacityBackup ?? 0
93 | toVC?.view.layer.shadowOffset = self.shadowOffsetBackup ?? CGSize(width: 0, height: 0)
94 | toVC?.view.layer.shadowRadius = self.shadowRadiusBackup ?? 0
95 | toVC?.view.layer.shadowPath = self.shadowPathBackup ?? CGPath(rect: CGRect.zero, transform: nil)
96 | self.completion?()
97 | self.completion = nil
98 | }
99 | }
100 | self.cancelPop = false
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/TransitionAnimation/ElevateTransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ElevateTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/31/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 | /// Like Elevate
11 | open class ElevateTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning {
12 |
13 | open var transitionStatus: TransitionStatus
14 |
15 | open var transitionContext: UIViewControllerContextTransitioning?
16 |
17 | public let maskView: UIView
18 |
19 | public let toPosition: CGPoint
20 |
21 | open fileprivate(set) lazy var maskViewCopy: UIView = self.maskView.tr_copyWithContents()
22 |
23 | fileprivate var animationCount: Int = 0
24 |
25 | public init(maskView view: UIView, toPosition position: CGPoint, status: TransitionStatus = .present) {
26 | maskView = view
27 | toPosition = position
28 | transitionStatus = status
29 | super.init()
30 | }
31 |
32 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
33 | return 0.5
34 | }
35 |
36 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
37 | self.transitionContext = transitionContext
38 | var fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
39 | var toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
40 | let containView = transitionContext.containerView
41 |
42 | var startPosition = toVC!.view.convert(maskView.layer.position, from: maskView.superview)
43 | var endPosition = toPosition
44 |
45 | let maskLayer = CAShapeLayer()
46 | maskLayer.position = startPosition
47 | maskLayer.contents = maskView.layer.contents
48 |
49 | func distance(_ point: CGPoint, size: CGSize) -> CGFloat {
50 | switch (point.x < size.width / 2, point.y < size.height / 2) {
51 | case (true, true) :
52 | return sqrt((point.x - size.width)*(point.x - size.width) + (point.y - size.height)*(point.y - size.height))
53 | case (true, false) :
54 | return sqrt((point.x - size.width)*(point.x - size.width) + point.y*point.y)
55 | case (false, true) :
56 | return sqrt(point.x*point.x + (point.y - size.height)*(point.y - size.height))
57 | case (false, false) :
58 | return sqrt(point.x*point.x + point.y*point.y)
59 | }
60 | }
61 |
62 | let distanceResult = distance(startPosition, size: toVC!.view.layer.bounds.size)
63 |
64 | var startSize = maskView.layer.bounds.size
65 | var endSize = maskView.layer.bounds.size.tr_heightFill(distanceResult * 2).tr_widthFill(distanceResult * 2)
66 |
67 | if transitionStatus == .dismiss {
68 | swap(&fromVC, &toVC)
69 | swap(&startSize, &endSize)
70 | swap(&startPosition, &endPosition)
71 | }
72 |
73 | maskLayer.bounds.size = endSize
74 | maskViewCopy.layer.position = endPosition
75 |
76 |
77 | containView.addSubview(fromVC!.view)
78 | containView.addSubview(toVC!.view)
79 | toVC?.view.addSubview(maskViewCopy)
80 | toVC?.view.layer.mask = maskLayer
81 |
82 | let maskLayerAnimation = CABasicAnimation(tr_keyPath: .bounds_size)
83 |
84 | maskLayerAnimation.fromValue = NSValue(cgSize: startSize)
85 | maskLayerAnimation.toValue = NSValue(cgSize: endSize)
86 | maskLayerAnimation.duration = transitionDuration(using: transitionContext)
87 | maskLayerAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
88 | maskLayerAnimation.delegate = self
89 |
90 | maskLayer.add(maskLayerAnimation, forKey: "path")
91 | animationCount += 1
92 |
93 | let maskViewPositionAnimation = CABasicAnimation(tr_keyPath: .position)
94 | maskViewPositionAnimation.fromValue = NSValue(cgPoint: startPosition)
95 | maskViewPositionAnimation.toValue = NSValue(cgPoint: endPosition)
96 | maskViewPositionAnimation.duration = transitionDuration(using: transitionContext)
97 | maskViewPositionAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
98 | maskViewPositionAnimation.delegate = self
99 |
100 | maskViewCopy.layer.add(maskViewPositionAnimation, forKey: "position")
101 | animationCount += 1
102 | }
103 |
104 | }
105 |
106 | extension ElevateTransitionAnimation: CAAnimationDelegate {
107 |
108 | public func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
109 | animationCount -= 1
110 | if animationCount == 0 {
111 | transitionContext?.completeTransition(!transitionContext!.transitionWasCancelled)
112 | transitionContext?.viewController(forKey: UITransitionContextViewControllerKey.from)?.view.layer.mask = nil
113 | transitionContext?.viewController(forKey: UITransitionContextViewControllerKey.to)?.view.layer.mask = nil
114 | }
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/TransitionAnimation/FadeTransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FadeTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/22/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 | /// Fade Out In Animation
11 | open class FadeTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning, TransitionInteractiveable {
12 |
13 | open var transitionStatus: TransitionStatus
14 |
15 | open var transitionContext: UIViewControllerContextTransitioning?
16 |
17 | open var percentTransition: UIPercentDrivenInteractiveTransition?
18 |
19 | open var completion: (() -> Void)?
20 |
21 | open var cancelPop: Bool = false
22 |
23 | open var interacting: Bool = false
24 |
25 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
26 | return 0.3
27 | }
28 |
29 | public init(status: TransitionStatus = .push) {
30 | transitionStatus = status
31 | super.init()
32 | }
33 |
34 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
35 | self.transitionContext = transitionContext
36 | let fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
37 | let toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
38 | let containView = transitionContext.containerView
39 |
40 | containView.addSubview(fromVC!.view)
41 | containView.addSubview(toVC!.view)
42 | toVC!.view.layer.opacity = 0
43 |
44 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseInOut, animations: {
45 | toVC!.view.layer.opacity = 1
46 | }) { finished in
47 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
48 | if !self.cancelPop {
49 | if finished {
50 | self.completion?()
51 | self.completion = nil
52 | }
53 | }
54 | self.cancelPop = false
55 | }
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/TransitionAnimation/IBanTangTransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BTTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/22/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 | /// Like IBanTang, View Move
11 | open class IBanTangTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning, TransitionInteractiveable {
12 |
13 | open fileprivate(set) var keyView: UIView
14 |
15 | open var transitionStatus: TransitionStatus
16 |
17 | open var transitionContext: UIViewControllerContextTransitioning?
18 |
19 | open var percentTransition: UIPercentDrivenInteractiveTransition?
20 |
21 | open var completion: (() -> Void)?
22 |
23 | open var cancelPop: Bool = false
24 |
25 | open var interacting: Bool = false
26 |
27 | lazy open fileprivate(set) var keyViewCopy: UIView = self.keyView.tr_copyWithSnapshot()
28 |
29 | public init(key: UIView, status: TransitionStatus = .push) {
30 | keyView = key
31 | transitionStatus = status
32 | super.init()
33 | }
34 |
35 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
36 | return 0.3
37 | }
38 |
39 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
40 | self.transitionContext = transitionContext
41 | let fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
42 | let toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
43 | let containView = transitionContext.containerView
44 |
45 | let lightMaskLayer: CALayer = {
46 | let layer = CALayer()
47 | layer.frame = CGRect(origin: CGPoint.zero, size: toVC!.view.bounds.size)
48 | layer.backgroundColor = toVC!.view.backgroundColor?.cgColor
49 | let maskAnimation = CABasicAnimation(tr_keyPath: .opacity)
50 | maskAnimation.fromValue = 0
51 | maskAnimation.toValue = 1
52 | maskAnimation.duration = transitionDuration(using: transitionContext)
53 | layer.add(maskAnimation, forKey: "")
54 | return layer
55 | }()
56 |
57 | containView.addSubview(toVC!.view)
58 | containView.addSubview(fromVC!.view)
59 |
60 | if transitionStatus == .push {
61 | containView.layer.addSublayer(lightMaskLayer)
62 | keyViewCopy.layer.position = containView.convert(keyView.layer.position, from: keyView.superview)
63 | containView.addSubview(keyViewCopy)
64 | }
65 |
66 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseInOut, animations: {
67 | switch self.transitionStatus {
68 | case .push :
69 | self.keyViewCopy.layer.position.y = self.keyViewCopy.layer.bounds.height / 2
70 | case .pop where self.interacting == true :
71 | fromVC!.view.layer.position.x = fromVC!.view.layer.bounds.width * 1.5
72 | case .pop where self.interacting == false :
73 | fromVC!.view.layer.opacity = 0
74 | self.keyViewCopy.layer.position = containView.convert(self.keyView.layer.position, from: self.keyView.superview)
75 | default :
76 | fatalError("You set false status.")
77 | }
78 | }) { finished in
79 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
80 | if !self.cancelPop {
81 | if finished {
82 | self.completion?()
83 | self.completion = nil
84 | }
85 | }
86 | if self.transitionStatus == .push {
87 | toVC?.view.addSubview(self.keyViewCopy)
88 | lightMaskLayer.removeFromSuperlayer()
89 | }
90 | self.cancelPop = false
91 |
92 | }
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/TransitionAnimation/OMNITransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // OMINTransition.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/20/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 | /// OmniFocus app push transition implement.
11 | open class OMNITransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning, TransitionInteractiveable {
12 |
13 | open var transitionStatus: TransitionStatus
14 |
15 | open var transitionContext: UIViewControllerContextTransitioning?
16 |
17 | open var percentTransition: UIPercentDrivenInteractiveTransition?
18 |
19 | open var completion: (() -> Void)?
20 |
21 | open var bottomView: UIView = UIView()
22 |
23 | open var cancelPop: Bool = false
24 |
25 | open var interacting: Bool = false
26 |
27 | open fileprivate(set) var keyView: UIView
28 |
29 | public init(key: UIView, status: TransitionStatus = .push) {
30 | keyView = key
31 | transitionStatus = status
32 | super.init()
33 | }
34 |
35 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
36 | return 0.3
37 | }
38 |
39 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
40 | self.transitionContext = transitionContext
41 | var fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
42 | var toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
43 | let containView = transitionContext.containerView
44 |
45 | var topHeight: CGFloat = 0
46 | var bottomHeight = fromVC!.view.layer.bounds.size.height - topHeight
47 |
48 | if transitionStatus == .pop {
49 | swap(&fromVC, &toVC)
50 | topHeight = fromVC!.view.bounds.height - bottomView.bounds.height
51 | bottomHeight = bottomView.bounds.height
52 | }
53 |
54 | if transitionStatus == .push {
55 |
56 | topHeight = containView.convert(keyView.layer.position, from: keyView.superview).y + keyView.layer.bounds.size.height / 2
57 | bottomHeight = fromVC!.view.layer.bounds.size.height - topHeight
58 |
59 | bottomView.frame = CGRect(x: 0, y: topHeight, width: fromVC!.view.layer.bounds.size.width, height: bottomHeight)
60 | bottomView.layer.contents = {
61 | let scale = UIScreen.main.scale
62 | UIGraphicsBeginImageContextWithOptions(fromVC!.view.bounds.size, true, scale)
63 | fromVC!.view.layer.render(in: UIGraphicsGetCurrentContext()!)
64 | let image = UIGraphicsGetImageFromCurrentImageContext() ?? UIImage()
65 | UIGraphicsEndImageContext()
66 | let inRect = CGRect(x: 0, y: topHeight * scale, width: fromVC!.view.layer.bounds.size.width * scale, height: bottomHeight * scale)
67 | let clip = image.cgImage?.cropping(to: inRect)
68 | return clip
69 | }()
70 |
71 | let maskLayer = CAShapeLayer()
72 | maskLayer.path = UIBezierPath(rect: CGRect(x: 0, y: 0, width: fromVC!.view.layer.bounds.size.width, height: topHeight)).cgPath
73 | fromVC!.view.layer.mask = maskLayer
74 | } else {
75 | topHeight = -topHeight
76 | bottomHeight = -bottomHeight
77 | fromVC!.view.layer.position.y += topHeight // workaround: iOS 11 will reset position after push.
78 | }
79 | containView.addSubview(toVC!.view)
80 | containView.addSubview(fromVC!.view)
81 | containView.addSubview(bottomView)
82 |
83 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: [.curveEaseIn, .curveEaseOut], animations: {
84 | fromVC!.view.layer.position.y -= topHeight
85 | self.bottomView.layer.position.y += bottomHeight
86 | }) { finished in
87 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
88 | self.bottomView.removeFromSuperview()
89 | if !self.cancelPop {
90 | if self.transitionStatus == .pop {
91 | transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)?.view.layer.mask = nil
92 | transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)?.view.layer.mask = nil
93 | }
94 | if finished {
95 | self.completion?()
96 | self.completion = nil
97 | }
98 | }
99 | self.cancelPop = false
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/TransitionAnimation/PageTransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PageTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/30/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 | /// Page Motion
11 | open class PageTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning, TransitionInteractiveable {
12 |
13 | open var transitionStatus: TransitionStatus
14 |
15 | open var transitionContext: UIViewControllerContextTransitioning?
16 |
17 | open var percentTransition: UIPercentDrivenInteractiveTransition?
18 |
19 | open var completion: (() -> Void)?
20 |
21 | open var cancelPop: Bool = false
22 |
23 | open var interacting: Bool = false
24 |
25 | fileprivate var transformBackup: CATransform3D?
26 | fileprivate var shadowOpacityBackup: Float?
27 | fileprivate var shadowOffsetBackup: CGSize?
28 | fileprivate var shadowRadiusBackup: CGFloat?
29 | fileprivate var shadowPathBackup: CGPath?
30 |
31 | fileprivate lazy var maskView: UIView = {
32 | let maskView = UIView(frame: UIScreen.main.bounds)
33 | maskView.backgroundColor = UIColor.black
34 | return maskView
35 | }()
36 |
37 | public init(status: TransitionStatus = .push) {
38 | transitionStatus = status
39 | super.init()
40 | }
41 |
42 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
43 | return 0.6
44 | }
45 |
46 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
47 | self.transitionContext = transitionContext
48 | var fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
49 | var toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
50 | let containView = transitionContext.containerView
51 |
52 | var startPositionX: CGFloat = UIScreen.main.bounds.width
53 | var endPositionX: CGFloat = 0
54 |
55 | var startOpacity: Float = 0
56 | var endOpacity: Float = 0.3
57 |
58 | transformBackup = transformBackup ?? fromVC?.view.layer.transform
59 |
60 | var transform3D: CATransform3D = CATransform3DIdentity
61 | transform3D.m34 = -1.0/500.0
62 |
63 | if transitionStatus == .pop {
64 | swap(&fromVC, &toVC)
65 | swap(&startPositionX, &endPositionX)
66 | swap(&startOpacity, &endOpacity)
67 | } else {
68 | transform3D = CATransform3DTranslate(transform3D, 0, 0, -35)
69 | }
70 |
71 | containView.addSubview(fromVC!.view)
72 | containView.addSubview(toVC!.view)
73 | fromVC?.view.addSubview(maskView)
74 |
75 | maskView.layer.opacity = startOpacity
76 | toVC?.view.layer.position.x = startPositionX + toVC!.view.layer.bounds.width / 2
77 | shadowOpacityBackup = toVC?.view.layer.shadowOpacity
78 | shadowOffsetBackup = toVC?.view.layer.shadowOffset
79 | shadowRadiusBackup = toVC?.view.layer.shadowRadius
80 | shadowPathBackup = toVC?.view.layer.shadowPath
81 | toVC?.view.layer.shadowOpacity = 0.5
82 | toVC?.view.layer.shadowOffset = CGSize(width: -3, height: 0)
83 | toVC?.view.layer.shadowRadius = 5
84 | toVC?.view.layer.shadowPath = CGPath(rect: toVC!.view.layer.bounds, transform: nil)
85 |
86 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseInOut, animations: {
87 | self.maskView.layer.opacity = endOpacity
88 | fromVC?.view.layer.transform = transform3D
89 | toVC?.view.layer.position.x = endPositionX + toVC!.view.layer.bounds.width / 2
90 | }) { finished in
91 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
92 | if !self.cancelPop {
93 | toVC?.view.layer.shadowOpacity = 0
94 | if self.transitionStatus == .pop && finished && !self.cancelPop {
95 | self.maskView.removeFromSuperview()
96 | fromVC?.view.layer.transform = self.transformBackup ?? CATransform3DIdentity
97 | }
98 | if finished {
99 | toVC?.view.layer.shadowOpacity = self.shadowOpacityBackup ?? 0
100 | toVC?.view.layer.shadowOffset = self.shadowOffsetBackup ?? CGSize(width: 0, height: 0)
101 | toVC?.view.layer.shadowRadius = self.shadowRadiusBackup ?? 0
102 | toVC?.view.layer.shadowPath = self.shadowPathBackup ?? CGPath(rect: CGRect.zero, transform: nil)
103 | self.completion?()
104 | self.completion = nil
105 | }
106 | }
107 | self.cancelPop = false
108 | }
109 | }
110 |
111 | }
112 |
--------------------------------------------------------------------------------
/TransitionAnimation/PopTipTransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PopTipTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/29/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 | /// Pop Your Tip ViewController.
11 | open class PopTipTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning {
12 |
13 | open var transitionStatus: TransitionStatus
14 |
15 | open var transitionContext: UIViewControllerContextTransitioning?
16 |
17 | open var cancelPop: Bool = false
18 |
19 | open var interacting: Bool = false
20 |
21 | fileprivate var mainVC: UIViewController?
22 |
23 | lazy fileprivate var tapGestureRecognizer: UITapGestureRecognizer = {
24 | let tap = UITapGestureRecognizer(target: self, action: #selector(PopTipTransitionAnimation.tapDismiss(_:)))
25 | return tap
26 | }()
27 |
28 | lazy fileprivate var maskView: UIView = {
29 | let view = UIView()
30 | view.backgroundColor = UIColor.black
31 | return view
32 | }()
33 |
34 | open fileprivate(set) var visibleHeight: CGFloat
35 |
36 | fileprivate let bounce: Bool
37 |
38 | public init(visibleHeight height: CGFloat, bounce: Bool = false, status: TransitionStatus = .present) {
39 | transitionStatus = status
40 | visibleHeight = height
41 | self.bounce = bounce
42 | super.init()
43 | }
44 |
45 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
46 | return 0.3
47 | }
48 |
49 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
50 | self.transitionContext = transitionContext
51 | var fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
52 | var toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
53 |
54 | let containView = transitionContext.containerView
55 | let screenBounds = UIScreen.main.bounds
56 |
57 | var startFrame = screenBounds.offsetBy(dx: 0, dy: screenBounds.size.height)
58 | var finalFrame = screenBounds.offsetBy(dx: 0, dy: screenBounds.height - visibleHeight)
59 |
60 | var startOpacity: CGFloat = 0
61 | var finalOpacity: CGFloat = 0.3
62 |
63 | containView.addSubview(fromVC!.view)
64 |
65 | if transitionStatus == .dismiss {
66 | swap(&fromVC, &toVC)
67 | swap(&startFrame, &finalFrame)
68 | swap(&startOpacity, &finalOpacity)
69 | } else if transitionStatus == .present {
70 | let bottomView = UIView(frame: screenBounds)
71 | bottomView.layer.contents = {
72 | let scale = UIScreen.main.scale
73 | UIGraphicsBeginImageContextWithOptions(fromVC!.view.bounds.size, true, scale)
74 | fromVC!.view.layer.render(in: UIGraphicsGetCurrentContext()!)
75 | let image = UIGraphicsGetImageFromCurrentImageContext()
76 | UIGraphicsEndImageContext()
77 | return image?.cgImage
78 | }()
79 | bottomView.addGestureRecognizer(tapGestureRecognizer)
80 | containView.addSubview(bottomView)
81 | maskView.frame = screenBounds
82 | maskView.alpha = startOpacity
83 | bottomView.addSubview(maskView)
84 | mainVC = fromVC
85 | }
86 |
87 | toVC?.view.layer.frame = startFrame
88 |
89 | containView.addSubview(toVC!.view)
90 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, usingSpringWithDamping: (bounce ? 0.8 : 1), initialSpringVelocity: (bounce ? 0.6 : 1), options: .curveEaseInOut, animations: {
91 | toVC?.view.layer.frame = finalFrame
92 | self.maskView.alpha = finalOpacity
93 | }) { finished in
94 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
95 | }
96 |
97 | }
98 |
99 | @objc func tapDismiss(_ tap: UITapGestureRecognizer) {
100 | mainVC?.presentedViewController?.transitioningDelegate = nil
101 | mainVC?.dismiss(animated: true, completion: nil)
102 | }
103 | }
104 |
105 |
106 |
--------------------------------------------------------------------------------
/TransitionAnimation/SlideTransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SlideTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 16/1/21.
6 | // Copyright © 2016年 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 |
11 | open class SlideTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning, TabBarTransitionInteractiveable {
12 |
13 | open var transitionStatus: TransitionStatus
14 |
15 | open var transitionContext: UIViewControllerContextTransitioning?
16 |
17 | open var completion: (() -> Void)?
18 |
19 | open var gestureRecognizer: UIGestureRecognizer? {
20 | didSet {
21 | gestureRecognizer?.addTarget(self, action: #selector(SlideTransitionAnimation.interactiveTransition(_:)))
22 | }
23 | }
24 |
25 | open var percentTransition: UIPercentDrivenInteractiveTransition = UIPercentDrivenInteractiveTransition()
26 |
27 | open var interactivePrecent: CGFloat = 0.3
28 |
29 | open var interacting: Bool = false
30 |
31 | fileprivate var tabBarTransitionDirection: TabBarTransitionDirection = .right
32 |
33 | public init(status: TransitionStatus = .tabBar) {
34 | transitionStatus = status
35 | super.init()
36 | }
37 |
38 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
39 | return 0.3
40 | }
41 |
42 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
43 | self.transitionContext = transitionContext
44 | let fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
45 | let toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
46 | let containView = transitionContext.containerView
47 | guard let tabBarController = fromVC?.tabBarController else { fatalError("No TabBarController.") }
48 | guard let fromVCIndex = tabBarController.viewControllers?.firstIndex(of: fromVC!)
49 | , let toVCIndex = tabBarController.viewControllers?.firstIndex(of: toVC!) else {
50 | fatalError("VC not in TabBarController.")
51 | }
52 |
53 | let fromVCStartOriginX: CGFloat = 0
54 | var fromVCEndOriginX: CGFloat = -UIScreen.main.bounds.width
55 | var toVCStartOriginX: CGFloat = UIScreen.main.bounds.width
56 | let toVCEndOriginX: CGFloat = 0
57 |
58 | tabBarTransitionDirection = TabBarTransitionDirection.TransitionDirection(fromVCIndex, toVCIndex: toVCIndex)
59 |
60 | if tabBarTransitionDirection == .left {
61 | swap(&fromVCEndOriginX, &toVCStartOriginX)
62 | }
63 |
64 | containView.addSubview(fromVC!.view)
65 | containView.addSubview(toVC!.view)
66 |
67 | fromVC?.view.frame.origin.x = fromVCStartOriginX
68 | toVC?.view.frame.origin.x = toVCStartOriginX
69 |
70 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseInOut, animations: {
71 | fromVC?.view.frame.origin.x = fromVCEndOriginX
72 | toVC?.view.frame.origin.x = toVCEndOriginX
73 | }) { finished in
74 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
75 | if !transitionContext.transitionWasCancelled && finished {
76 | self.completion?()
77 | self.completion = nil
78 | }
79 | }
80 | }
81 |
82 | @objc open func interactiveTransition(_ sender: UIPanGestureRecognizer) {
83 |
84 | guard let view = sender.view else { return }
85 |
86 | let offsetX = tabBarTransitionDirection == .left ? sender.translation(in: view).x : -sender.translation(in: view).x
87 |
88 | var percent = offsetX / view.bounds.size.width
89 |
90 | percent = min(1.0, max(0, percent))
91 |
92 | switch sender.state {
93 | case .began :
94 | percentTransition.startInteractiveTransition(transitionContext!)
95 | interacting = true
96 | case .changed :
97 | interacting = true
98 | percentTransition.update(percent)
99 | default :
100 | interacting = false
101 | if percent > interactivePrecent {
102 | percentTransition.completionSpeed = 1.0 - percentTransition.percentComplete
103 | percentTransition.finish()
104 | gestureRecognizer?.removeTarget(self, action: #selector(SlideTransitionAnimation.interactiveTransition(_:)))
105 | } else {
106 | percentTransition.cancel()
107 | }
108 | }
109 | }
110 |
111 | }
112 |
113 |
--------------------------------------------------------------------------------
/TransitionAnimation/TRTransitionAnimations.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TRTransitionAnimations.swift
3 | // TransitionTreasury
4 | //
5 | // Created by 宋宋 on 16/2/5.
6 | // Copyright © 2016年 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 | /**
11 | ViewController Push Methods
12 |
13 | - OMIN: Like OmniFocus
14 | - IBanTang: Like IBanTang
15 | - Fade: Fade Out In
16 | - Page: Page Motion
17 | */
18 | public enum TRPushTransitionMethod: TransitionAnimationable {
19 | case omni(keyView: UIView)
20 | case iBanTang(keyView: UIView)
21 | case fade
22 | case page
23 | case blixt(keyView: UIView, to: CGRect)
24 | case `default`
25 |
26 | public func transitionAnimation() -> TRViewControllerAnimatedTransitioning {
27 | switch self {
28 | case let .omni(key) :
29 | return OMNITransitionAnimation(key: key)
30 | case let .iBanTang(key) :
31 | return IBanTangTransitionAnimation(key: key)
32 | case .fade :
33 | return FadeTransitionAnimation()
34 | case .page :
35 | return PageTransitionAnimation()
36 | case let .blixt(view, frame) :
37 | return BlixtTransitionAnimation(key: view, toFrame: frame)
38 | case .default :
39 | return DefaultPushTransitionAnimation()
40 | }
41 | }
42 | }
43 |
44 | /**
45 | ViewController Present Methods
46 |
47 | - Twitter: Like Twitter
48 | - Fade: Fade out in
49 | - PopTip: Pop A Tip VC
50 | - Custom: Custom your Animation
51 | */
52 | public enum TRPresentTransitionMethod: TransitionAnimationable {
53 | case twitter
54 | case fade
55 | case popTip(visibleHeight: CGFloat)
56 | case taaskyFlip(blurEffect: Bool)
57 | case elevate(maskView: UIView, to: CGPoint)
58 | case scanbot(present: UIPanGestureRecognizer?, dismiss: UIPanGestureRecognizer?)
59 |
60 | public func transitionAnimation() -> TRViewControllerAnimatedTransitioning {
61 | switch self {
62 | case .twitter :
63 | return TwitterTransitionAnimation()
64 | case .fade :
65 | return FadeTransitionAnimation()
66 | case let .popTip(height) :
67 | return PopTipTransitionAnimation(visibleHeight: height)
68 | case let .taaskyFlip(blur) :
69 | return TaaskyFlipTransitionAnimation(blurEffect: blur)
70 | case let .elevate(view, position) :
71 | return ElevateTransitionAnimation(maskView: view, toPosition: position)
72 | case let .scanbot(presentGesture, dismissGesture) :
73 | return ScanbotTransitionAnimation(presentGesture: presentGesture, dismissGesture: dismissGesture)
74 | }
75 | }
76 | }
77 |
78 | public enum TRTabBarTransitionMethod: TransitionAnimationable {
79 | case fade
80 | case slide
81 |
82 | public func transitionAnimation() -> TRViewControllerAnimatedTransitioning {
83 | switch self {
84 | case .fade :
85 | return FadeTransitionAnimation(status: .tabBar)
86 | case .slide :
87 | return SlideTransitionAnimation()
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/TransitionAnimation/TaaskyFlipTransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TaaskyFlipTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/31/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 |
11 | open class TaaskyFlipTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning {
12 |
13 | open var transitionStatus: TransitionStatus
14 |
15 | open var transitionContext: UIViewControllerContextTransitioning?
16 |
17 | open fileprivate(set) var blurEffect: Bool = true
18 |
19 | fileprivate var anchorPointBackup: CGPoint?
20 |
21 | fileprivate var positionBackup: CGPoint?
22 |
23 | public init(blurEffect blur: Bool = true, status: TransitionStatus = .present) {
24 | blurEffect = blur
25 | transitionStatus = status
26 | super.init()
27 | }
28 |
29 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
30 | return 0.6
31 | }
32 |
33 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
34 | self.transitionContext = transitionContext
35 | var fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
36 | var toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
37 |
38 | let containView = transitionContext.containerView
39 |
40 | let angle = Double.pi / 2
41 | var startTransform = CATransform3DIdentity
42 | startTransform.m34 = -1.0/500.0
43 | startTransform = CATransform3DRotate(startTransform, CGFloat(angle), 0, 1, 0)
44 | var endTransform = CATransform3DIdentity
45 | endTransform.m34 = -1.0/500.0
46 |
47 | if transitionStatus == .dismiss {
48 | swap(&fromVC, &toVC)
49 | swap(&startTransform, &endTransform)
50 | }
51 |
52 | anchorPointBackup = toVC?.view.layer.anchorPoint
53 | positionBackup = toVC?.view.layer.position
54 | toVC?.view.layer.anchorPoint = CGPoint(x: 1, y: 0.5)
55 | toVC?.view.layer.position = CGPoint(x: toVC!.view.layer.position.x + toVC!.view.layer.bounds.width / 2, y: toVC!.view.layer.position.y)
56 | toVC?.view.layer.transform = startTransform
57 |
58 | containView.addSubview(fromVC!.view)
59 | if blurEffect && (transitionStatus == .present) {
60 | let effectView = UIVisualEffectView(frame: fromVC!.view.frame)
61 | effectView.effect = UIBlurEffect(style: .dark)
62 | containView.addSubview(effectView)
63 | }
64 | containView.addSubview(toVC!.view)
65 |
66 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseInOut, animations: {
67 | toVC?.view.layer.transform = endTransform
68 | }) { finished in
69 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
70 | toVC?.view.layer.anchorPoint = self.anchorPointBackup ?? CGPoint(x: 0.5, y: 0.5)
71 | toVC?.view.layer.position = self.positionBackup ?? CGPoint(x: toVC!.view.layer.position.x, y: toVC!.view.layer.position.y - toVC!.view.layer.bounds.height / 2)
72 | }
73 | }
74 |
75 | }
76 |
77 |
--------------------------------------------------------------------------------
/TransitionAnimation/TransitionAnimationHelper.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TransitionAnimationHelper.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/30/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | /**
11 | TransitionTreasury's CAAnimation Enum.
12 |
13 | - opacity: layer.opacity
14 | */
15 | public enum TRKeyPath: String {
16 | case opacity = "opacity"
17 | case bounds = "bounds"
18 | case bounds_size = "bounds.size"
19 | case bounds_height = "bounds.height"
20 | case bounds_width = "bounds.width"
21 | case position = "position"
22 | case transform = "transform"
23 | case strokeEnd = "strokeEnd"
24 | case path = "path"
25 | }
26 | // MARK: - Safety CAAnimation
27 | public extension CABasicAnimation {
28 | /**
29 | TransitionTreasury's CABasicAnimation Init Method.
30 |
31 | - parameter path: TRKeyPath
32 |
33 | - returns: CAAnimation
34 | */
35 | convenience init(tr_keyPath path: TRKeyPath?) {
36 | self.init(keyPath: path?.rawValue)
37 | }
38 | }
39 |
40 | public extension CGSize {
41 | /**
42 | Fit width without shape change.
43 | */
44 | func tr_widthFit(_ width: CGFloat) -> CGSize {
45 | let widthPresent = width / self.width
46 | return CGSize(width: width, height: widthPresent * height)
47 | }
48 | /**
49 | Fit height without shape change.
50 | */
51 | func tr_heightFit(_ height: CGFloat) -> CGSize {
52 | let heightPresent = height / self.height
53 | return CGSize(width: heightPresent * width, height: height)
54 | }
55 | /**
56 | Fill width without shape change.
57 | */
58 | func tr_widthFill(_ width: CGFloat) -> CGSize {
59 | switch self.width >= width {
60 | case true :
61 | return self
62 | case false :
63 | return tr_widthFit(width)
64 | }
65 | }
66 | /**
67 | Fit height without shape change.
68 | */
69 | func tr_heightFill(_ height: CGFloat) -> CGSize {
70 | switch self.height >= height {
71 | case true :
72 | return self
73 | case false :
74 | return tr_heightFit(height)
75 | }
76 | }
77 | }
78 |
79 | public extension UIScreen {
80 | /// Get screen center.
81 | var tr_center: CGPoint {
82 | get {
83 | return CGPoint(x: bounds.width / 2, y: bounds.height / 2)
84 | }
85 | }
86 | }
87 |
88 | public extension CGRect {
89 | /**
90 | Return a rectangle that precent the source rectangle, with the same center point.
91 | */
92 | func tr_shape(_ precent: CGFloat) -> CGRect {
93 | return self.insetBy(dx: width * (1 - precent), dy: height * (1 - precent))
94 | }
95 | /**
96 | Just F**k Xcode.
97 | */
98 | var tr_ns_value: NSValue {
99 | get {
100 | return NSValue(cgRect: self)
101 | }
102 | }
103 | }
104 |
105 | public extension UIView {
106 | /**
107 | Create copy contents view.
108 | */
109 | func tr_copyWithContents() -> UIView {
110 | let view = UIView(frame: frame)
111 | view.layer.contents = layer.contents
112 | view.layer.contentsGravity = layer.contentsGravity
113 | view.layer.contentsScale = layer.contentsScale
114 | view.tag = tag
115 | return view
116 | }
117 | /**
118 | Create copy snapshot view.
119 | */
120 | func tr_copyWithSnapshot() -> UIView {
121 | let view = snapshotView(afterScreenUpdates: false)
122 | view?.frame = frame
123 | return view!
124 | }
125 | /**
126 | Add view with convert point.
127 | */
128 | func tr_addSubview(_ view: UIView, convertFrom fromView: UIView) {
129 | view.layer.position = convert(fromView.layer.position, from: fromView.superview)
130 | addSubview(view)
131 | }
132 |
133 | }
134 |
135 | public extension CATransform3D {
136 | /**
137 | Just F**k Xcode.
138 | */
139 | var tr_ns_value: NSValue {
140 | get {
141 | return NSValue(caTransform3D: self)
142 | }
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/TransitionAnimation/TwitterTransitionAnimation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TwitterTransitionAnimation.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/20/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import TransitionTreasury
10 |
11 | /// Like Twitter Present.
12 | open class TwitterTransitionAnimation: NSObject, TRViewControllerAnimatedTransitioning {
13 |
14 | open var transitionStatus: TransitionStatus
15 |
16 | open var transitionContext: UIViewControllerContextTransitioning?
17 |
18 | fileprivate var anchorPointBackup: CGPoint?
19 |
20 | fileprivate var positionBackup: CGPoint?
21 |
22 | fileprivate var transformBackup: CATransform3D?
23 |
24 | public init(status: TransitionStatus = .present) {
25 | transitionStatus = status
26 | super.init()
27 | }
28 |
29 | open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
30 | return 0.3
31 | }
32 |
33 | open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
34 | self.transitionContext = transitionContext
35 | var fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)
36 | var toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)
37 |
38 | let containView = transitionContext.containerView
39 | let screenBounds = UIScreen.main.bounds
40 | var angle = Double.pi / 48
41 | var transform = CATransform3DIdentity
42 | transform.m34 = -1.0/500.0
43 |
44 | transformBackup = fromVC?.view.layer.transform
45 |
46 | var startFrame = screenBounds.offsetBy(dx: 0, dy: screenBounds.size.height)
47 | var finalFrame = screenBounds
48 |
49 | if transitionStatus == .dismiss {
50 | swap(&fromVC, &toVC)
51 | swap(&startFrame, &finalFrame)
52 | angle = -angle
53 | } else if transitionStatus == .present {
54 | transform = CATransform3DRotate(transform, CGFloat(angle), 1, 0, 0)
55 | anchorPointBackup = fromVC?.view.layer.anchorPoint
56 | positionBackup = fromVC?.view.layer.position
57 | fromVC?.view.layer.anchorPoint = CGPoint(x: 0.5, y: 1)
58 | fromVC?.view.layer.position = CGPoint(x: fromVC!.view.layer.position.x, y: fromVC!.view.layer.position.y + fromVC!.view.layer.bounds.height / 2)
59 | }
60 |
61 | toVC?.view.layer.frame = startFrame
62 |
63 | containView.addSubview(fromVC!.view)
64 | containView.addSubview(toVC!.view)
65 |
66 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseInOut, animations: {
67 | fromVC?.view.layer.transform = transform
68 | toVC?.view.layer.frame = finalFrame
69 | }) { finished in
70 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
71 | if self.transitionStatus == .dismiss && finished {
72 | fromVC?.view.layer.anchorPoint = self.anchorPointBackup ?? CGPoint(x: 0.5, y: 0.5)
73 | fromVC?.view.layer.position = self.positionBackup ?? CGPoint(x: fromVC!.view.layer.position.x, y: fromVC!.view.layer.position.y - fromVC!.view.layer.bounds.height / 2)
74 | fromVC?.view.layer.transform = self.transformBackup ?? CATransform3DIdentity
75 | }
76 | }
77 | }
78 | }
79 |
80 |
--------------------------------------------------------------------------------
/TransitionTreasury.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'TransitionTreasury'
3 | s.version = '7.0.0'
4 | s.license = { :type => "MIT", :file => "LICENSE" }
5 | s.summary = 'Easier way to push your viewController.'
6 | s.homepage = 'https://github.com/DianQK/TransitionTreasury'
7 | s.screenshots = 'https://raw.githubusercontent.com/DianQK/TransitionTreasury/master/transitiontreasury.png'
8 | s.social_media_url = 'http://transitiontreasury.com'
9 | s.authors = { 'DianQK' => 'xiaoqing@dianqk.org' }
10 | s.source = { :git => 'https://github.com/DianQK/TransitionTreasury.git', :tag => s.version }
11 | s.source_files = ['TransitionTreasury/*.swift','TransitionTreasury/*/*.swift']
12 | s.ios.deployment_target = '8.0'
13 | s.requires_arc = true
14 | s.swift_version = '5.0'
15 | end
16 |
--------------------------------------------------------------------------------
/TransitionTreasury.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TransitionTreasury.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/TransitionTreasury.xcodeproj/xcshareddata/xcschemes/TransitionAnimation.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/TransitionTreasury.xcodeproj/xcshareddata/xcschemes/TransitionTreasury.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
34 |
40 |
41 |
42 |
43 |
44 |
50 |
51 |
52 |
53 |
54 |
55 |
65 |
66 |
72 |
73 |
74 |
75 |
76 |
77 |
83 |
84 |
90 |
91 |
92 |
93 |
95 |
96 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/TransitionTreasury.xcodeproj/xcuserdata/Qing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
12 |
13 |
14 |
16 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/TransitionTreasury.xcodeproj/xcuserdata/Qing.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | TransitionAnimation.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 3
11 |
12 | TransitionTreasury.xcscheme_^#shared#^_
13 |
14 | orderHint
15 | 0
16 |
17 |
18 | SuppressBuildableAutocreation
19 |
20 | 260B38841C4A907900835CDC
21 |
22 | primary
23 |
24 |
25 | 263B43901C32E6BD0093593E
26 |
27 | primary
28 |
29 |
30 | 26BEB60E1C64526E001510CE
31 |
32 | primary
33 |
34 |
35 | 26FDFF131C33C4A600CB3995
36 |
37 | primary
38 |
39 |
40 | 26FDFF221C33C4B700CB3995
41 |
42 | primary
43 |
44 |
45 | 26FE2CC11C26D80C005F4DDC
46 |
47 | primary
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/TransitionTreasury/PresentTransition/TRViewControllerTransitionDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TRViewControllerTransitionDelegate.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/20/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | /// Transition(Present) Animation Delegate Object
11 | public class TRViewControllerTransitionDelegate: NSObject, UIViewControllerTransitioningDelegate {
12 | /// The transition animation object
13 | public var transition: TRViewControllerAnimatedTransitioning
14 |
15 | public var previousStatusBarStyle: TRStatusBarStyle?
16 | /**
17 | Init method
18 |
19 | - parameter method: the present method option
20 | - parameter status: default is .Present
21 |
22 | - returns: Transition Animation Delegate Object
23 | */
24 | public init(method: TransitionAnimationable, status: TransitionStatus = .present) {
25 | transition = method.transitionAnimation()
26 | super.init()
27 | }
28 | /**
29 | Update transition status
30 |
31 | - parameter status: .Present or .dismiss
32 | */
33 | public func updateStatus(_ status: TransitionStatus) {
34 | transition.transitionStatus = status
35 | }
36 |
37 | public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
38 | transition.transitionStatus = .present
39 | return transition
40 | }
41 |
42 | public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
43 | transition.transitionStatus = .dismiss
44 | return transition
45 | }
46 |
47 | public func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
48 | guard let transition = transition as? TransitionInteractiveable else {
49 | return nil
50 | }
51 | return transition.interacting ? transition.percentTransition : nil
52 | }
53 |
54 | public func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
55 | guard let transition = transition as? TransitionInteractiveable else {
56 | return nil
57 | }
58 | return transition.interacting ? transition.percentTransition : nil
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/TransitionTreasury/PresentTransition/UIViewController+TRPresent.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+TRPresent.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/20/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | /**
12 | * Enable Transition for Present.
13 | */
14 | public protocol ViewControllerTransitionable: class, NSObjectProtocol {
15 | /// Retain transition delegate.
16 | var tr_presentTransition: TRViewControllerTransitionDelegate?{get set}
17 | }
18 |
19 | // MARK: - Transition Treasury UIViewController Extension.
20 | public extension ViewControllerTransitionable where Self: UIViewController {
21 | /**
22 | Transition treasury present viewController.
23 | */
24 | func tr_presentViewController(_ viewControllerToPresent: UIViewController, method: TransitionAnimationable, statusBarStyle: TRStatusBarStyle = .default, completion: (() -> Void)? = nil) {
25 | let transitionDelegate = TRViewControllerTransitionDelegate(method: method)
26 |
27 | tr_presentTransition = transitionDelegate
28 |
29 | viewControllerToPresent.transitioningDelegate = transitionDelegate
30 | transitionDelegate.previousStatusBarStyle = TRStatusBarStyle.currentlyTRStatusBarStyle()
31 | let fullCompletion = {
32 | completion?()
33 | statusBarStyle.updateStatusBarStyle()
34 | }
35 | transitionDelegate.transition.completion = fullCompletion
36 | /**
37 | * http://stackoverflow.com/questions/20320591/uitableview-and-presentviewcontroller-takes-2-clicks-to-display
38 | */
39 | /**
40 | * http://stackoverflow.com/questions/21075540/presentviewcontrolleranimatedyes-view-will-not-appear-until-user-taps-again
41 | */
42 | DispatchQueue.main.async {
43 | if transitionDelegate.transition.completion != nil { // Choose who deal completion
44 | self.present(viewControllerToPresent, animated: true, completion: nil)
45 | } else {
46 | self.present(viewControllerToPresent, animated: true, completion: fullCompletion)
47 | }
48 | }
49 | }
50 | /**
51 | Transition treasury dismiss ViewController.
52 | */
53 | func tr_dismissViewController(_ interactive: Bool = false, completion: (() -> Void)? = nil) {
54 | let transitionDelegate = tr_presentTransition
55 | if var interactiveTransition = transitionDelegate?.transition as? TransitionInteractiveable {
56 | interactiveTransition.interacting = interactive
57 | }
58 | presentedViewController?.transitioningDelegate = transitionDelegate
59 | let fullCompletion = {
60 | completion?()
61 | transitionDelegate?.previousStatusBarStyle?.updateStatusBarStyle()
62 | self.tr_presentTransition = nil
63 | }
64 | transitionDelegate?.transition.completion = fullCompletion
65 | if transitionDelegate?.transition.completion != nil {
66 | dismiss(animated: true, completion: nil)
67 | } else {
68 | dismiss(animated: true, completion: fullCompletion)
69 | }
70 | }
71 | }
72 | /// Modal Transition & Delegate.
73 | public typealias ModalTransitionDelegate = ViewControllerTransitionable & ModalViewControllerDelegate
74 |
75 | /**
76 | * Your `MianViewController` should conform this delegate.
77 | */
78 | public protocol ModalViewControllerDelegate: class, NSObjectProtocol {
79 | /**
80 | Dismiss by delegate.
81 |
82 | - parameter data: callback data
83 | */
84 | func modalViewControllerDismiss(_ interactive: Bool, callbackData data:Any?)
85 | func modalViewControllerDismiss(callbackData data:Any?)
86 | }
87 |
88 |
89 | // MARK: - Implement dismiss
90 | public extension ModalViewControllerDelegate where Self: ViewControllerTransitionable, Self: UIViewController {
91 | func modalViewControllerDismiss(_ interactive: Bool = false, callbackData data:Any? = nil) {
92 | if data != nil {
93 | debugPrint("WARNING: You set callbackData, but you forget implement this `modalViewControllerDismiss(_:_:)` to get data.")
94 | }
95 | tr_dismissViewController(interactive, completion: nil)
96 | }
97 |
98 | func modalViewControllerDismiss(callbackData data:Any? = nil) {
99 | if data != nil {
100 | debugPrint("WARNING: You set callbackData, but you forget implement this `modalViewControllerDismiss(_:)` to get data.")
101 | }
102 | tr_dismissViewController(completion: nil)
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/TransitionTreasury/PushTransition/UINavigationController+TRPushPop.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UINavigationController+TRPushPop.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/20/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | // MARK: - Transition Treasury UINavgationController Extension
11 | public extension UINavigationController {
12 | /**
13 | Transition treasury push viewController.
14 | */
15 | func tr_pushViewController(_ viewController: T, method: TransitionAnimationable, statusBarStyle: TRStatusBarStyle = .default, completion: (() -> Void)? = nil) where T: NavgationTransitionable {
16 | let transitionDelegate = TRNavgationTransitionDelegate(method: method, status: .push, gestureFor: viewController)
17 | transitionDelegate.completion = { [weak self] in
18 | completion?()
19 | self?.delegate = nil
20 | }
21 | viewController.tr_pushTransition = transitionDelegate
22 |
23 | delegate = transitionDelegate
24 | transitionDelegate.previousStatusBarStyle = TRStatusBarStyle.currentlyTRStatusBarStyle()
25 | transitionDelegate.currentStatusBarStyle = statusBarStyle
26 | pushViewController(viewController, animated: true)
27 | }
28 | /**
29 | Transition treasury pop viewController.
30 | */
31 | @discardableResult
32 | func tr_popViewController(_ completion: (() -> Void)? = nil) -> UIViewController? {
33 | let transitionDelegate = (topViewController as? NavgationTransitionable)?.tr_pushTransition
34 | transitionDelegate?.completion = { [weak self] in
35 | completion?()
36 | (self?.topViewController as? NavgationTransitionable)?.tr_pushTransition = nil
37 | self?.delegate = nil
38 | }
39 | delegate = transitionDelegate
40 |
41 | return popViewController(animated: true)
42 | }
43 | /**
44 | Transition treasury pop to viewController.
45 | */
46 | func tr_popToViewController(_ viewController: T, completion: (() -> Void)? = nil) -> [UIViewController]? where T: NavgationTransitionable {
47 | guard let index = viewControllers.firstIndex(of: viewController) else {
48 | fatalError("No this viewController for pop!!!")
49 | }
50 | let transitionDelegate = viewController.tr_pushTransition
51 | transitionDelegate?.completion = { [weak self] in
52 | completion?()
53 | self?.delegate = nil
54 | }
55 | transitionDelegate?.transition.popToVCIndex(index)
56 | delegate = transitionDelegate
57 | return {
58 | popToViewController(viewController, animated: true)?.compactMap({ (viewController) -> UIViewController? in
59 | (viewController as? NavgationTransitionable)?.tr_pushTransition = nil
60 | return viewController
61 | })
62 | }()
63 | }
64 | /**
65 | Transition Treasury Pop to Root ViewController.
66 | */
67 | func tr_popToRootViewController(_ completion: (() -> Void)? = nil) -> [UIViewController]? {
68 | guard viewControllers.count > 1 else {
69 | return popToRootViewController(animated: true)
70 | }
71 | let transitionDelegate = (viewControllers[1] as? NavgationTransitionable)?.tr_pushTransition
72 | transitionDelegate?.completion = { [weak self] in
73 | completion?()
74 | self?.delegate = nil
75 | }
76 | transitionDelegate?.transition.popToVCIndex(0)
77 | delegate = transitionDelegate
78 | return {
79 | popToRootViewController(animated: true)?.compactMap({ (viewController) -> UIViewController? in
80 | (viewController as? NavgationTransitionable)?.tr_pushTransition = nil
81 | return viewController
82 | })
83 | }()
84 | }
85 |
86 | }
87 | /// Retain transiton delegate
88 | public protocol NavgationTransitionable: class {
89 | /// Transiton delegate
90 | var tr_pushTransition: TRNavgationTransitionDelegate?{get set}
91 | }
92 |
--------------------------------------------------------------------------------
/TransitionTreasury/TRStatusBarStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TRStatusBarStyle.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 1/11/16.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | /**
11 | TransitionTreasury Status Bar Style.
12 | */
13 | public enum TRStatusBarStyle {
14 | case `default`
15 | @available(iOS 7.0, *)
16 | case lightContent
17 | case hide
18 |
19 | func updateStatusBarStyle(_ animated: Bool = true) {
20 | switch self {
21 | case .default :
22 | UIApplication.shared.setStatusBarHidden(false, with: .fade)
23 | UIApplication.shared.setStatusBarStyle(.default, animated: animated)
24 | case .lightContent :
25 | UIApplication.shared.setStatusBarHidden(false, with: .fade)
26 | UIApplication.shared.setStatusBarStyle(.lightContent, animated: animated)
27 | case .hide :
28 | UIApplication.shared.setStatusBarHidden(true, with: .fade)
29 | }
30 | }
31 |
32 | static func convertTo(statusBarStyle: UIStatusBarStyle, statusBarHidden: Bool = UIApplication.shared.isStatusBarHidden) -> TRStatusBarStyle {
33 | guard statusBarHidden == false else {
34 | return .hide
35 | }
36 | switch statusBarStyle {
37 | case .lightContent :
38 | return .lightContent
39 | case .default :
40 | return .default
41 | default :
42 | fatalError("No support this status bar style")
43 | }
44 | }
45 |
46 | static func currentlyTRStatusBarStyle() -> TRStatusBarStyle {
47 | return convertTo(statusBarStyle: UIApplication.shared.statusBarStyle)
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/TransitionTreasury/TRViewControllerAnimatedTransitioning.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TRViewControllerAnimatedTransitioning.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/20/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | /**
11 | * TransitionTreasury's transition protocol. All transition animation must conform this protocol.
12 | */
13 | public protocol TRViewControllerAnimatedTransitioning: UIViewControllerAnimatedTransitioning {
14 | /// Required implement.
15 | var transitionStatus: TransitionStatus{get set}
16 | /// Rquired implement.
17 | var transitionContext: UIViewControllerContextTransitioning?{get set}
18 | /// Option
19 | var completion: (() -> Void)?{get set}
20 | /**
21 | Option
22 |
23 | - parameter index: index of navgationViewController.viewcontrollers
24 | */
25 | func popToVCIndex(_ index: Int)
26 | }
27 |
28 | public protocol TransitionInteractiveable {
29 | /// Option, if you implement, you must support your animation Push & Present interactive.
30 | var panGestureRecognizer: UIPanGestureRecognizer?{get set}
31 | /// Require
32 | var percentTransition: UIPercentDrivenInteractiveTransition?{get set}
33 | /// Option
34 | var interactivePrecent: CGFloat{get}
35 | /// Require
36 | var interacting: Bool{get set}
37 | /// Require
38 | var cancelPop: Bool{get set}
39 | /// Option
40 | var edgeSlidePop: Bool{get set}
41 |
42 | func finishByCancelled(_ isCancelled:Bool) -> Void
43 | }
44 |
45 | public extension TRViewControllerAnimatedTransitioning {
46 |
47 | var completion: (() -> Void)? {
48 | get {
49 | return nil
50 | }
51 | set {}
52 | }
53 |
54 | func popToVCIndex(_ index: Int) {}
55 |
56 | }
57 |
58 | public extension TransitionInteractiveable {
59 | var panGestureRecognizer: UIPanGestureRecognizer? {
60 | get {
61 | return nil
62 | }
63 | set {}
64 | }
65 |
66 | var interactivePrecent: CGFloat {
67 | get {
68 | return 0.3
69 | }
70 | }
71 |
72 | var edgeSlidePop: Bool {
73 | get {
74 | return true
75 | }
76 | set {}
77 | }
78 |
79 | func finishByCancelled(_ isCancelled:Bool) -> Void {
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/TransitionTreasury/TabBarTransition/TRTabBarControllerDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TRTabBarControllerDelegate.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 16/1/19.
6 | // Copyright © 2016年 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public protocol TRTabBarControllerDelegate: class, NSObjectProtocol {
12 |
13 | func tr_tabBarController(_ tabBarController: UITabBarController, shouldSelectViewController viewController: UIViewController) -> Bool
14 |
15 | func tr_tabBarController(_ tabBarController: UITabBarController, didSelectViewController viewController: UIViewController)
16 |
17 | func tr_tabBarController(_ tabBarController: UITabBarController, willBeginCustomizingViewControllers viewControllers: [UIViewController])
18 |
19 | func tr_tabBarController(_ tabBarController: UITabBarController, willEndCustomizingViewControllers viewControllers: [UIViewController], changed: Bool)
20 |
21 | func tr_tabBarController(_ tabBarController: UITabBarController, didEndCustomizingViewControllers viewControllers: [UIViewController], changed: Bool)
22 |
23 | func tr_tabBarControllerSupportedInterfaceOrientations(_ tabBarController: UITabBarController) -> UIInterfaceOrientationMask
24 |
25 | func tr_tabBarControllerPreferredInterfaceOrientationForPresentation(_ tabBarController: UITabBarController) -> UIInterfaceOrientation
26 |
27 | }
28 |
29 | public extension TRTabBarControllerDelegate {
30 |
31 | func tr_tabBarController(_ tabBarController: UITabBarController, shouldSelectViewController viewController: UIViewController) -> Bool {
32 | return true
33 | }
34 |
35 | func tr_tabBarController(_ tabBarController: UITabBarController, didSelectViewController viewController: UIViewController) {
36 |
37 | }
38 |
39 | func tr_tabBarController(_ tabBarController: UITabBarController, willBeginCustomizingViewControllers viewControllers: [UIViewController]) {
40 |
41 | }
42 |
43 | func tr_tabBarController(_ tabBarController: UITabBarController, willEndCustomizingViewControllers viewControllers: [UIViewController], changed: Bool) {
44 |
45 | }
46 |
47 | func tr_tabBarController(_ tabBarController: UITabBarController, didEndCustomizingViewControllers viewControllers: [UIViewController], changed: Bool) {
48 |
49 | }
50 |
51 | func tr_tabBarControllerSupportedInterfaceOrientations(_ tabBarController: UITabBarController) -> UIInterfaceOrientationMask {
52 | return UIApplication.shared.supportedInterfaceOrientations(for: nil)
53 | }
54 |
55 | func tr_tabBarControllerPreferredInterfaceOrientationForPresentation(_ tabBarController: UITabBarController) -> UIInterfaceOrientation {
56 | return UIInterfaceOrientation.unknown
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/TransitionTreasury/TabBarTransition/TRTabBarTransitionDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TRTabBarTransitionDelegate.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 16/1/19.
6 | // Copyright © 2016年 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class TRTabBarTransitionDelegate: NSObject, UITabBarControllerDelegate {
12 |
13 | public var transitionAnimation: UIViewControllerAnimatedTransitioning
14 |
15 | weak var tr_delegate: TRTabBarControllerDelegate?
16 |
17 | public init(method: TransitionAnimationable) {
18 | transitionAnimation = method.transitionAnimation()
19 | super.init()
20 | }
21 |
22 | public func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
23 | return tr_delegate?.tr_tabBarController(tabBarController, shouldSelectViewController: viewController) ?? true
24 | }
25 |
26 | public func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
27 | tr_delegate?.tr_tabBarController(tabBarController, didSelectViewController: viewController)
28 | }
29 |
30 | public func tabBarController(_ tabBarController: UITabBarController, willBeginCustomizing viewControllers: [UIViewController]) {
31 | tr_delegate?.tr_tabBarController(tabBarController, willBeginCustomizingViewControllers: viewControllers)
32 | }
33 |
34 | public func tabBarController(_ tabBarController: UITabBarController, willEndCustomizing viewControllers: [UIViewController], changed: Bool) {
35 | tr_delegate?.tr_tabBarController(tabBarController, willEndCustomizingViewControllers: viewControllers, changed: changed)
36 | }
37 |
38 | public func tabBarController(_ tabBarController: UITabBarController, didEndCustomizing viewControllers: [UIViewController], changed: Bool) {
39 | tr_delegate?.tr_tabBarController(tabBarController, didEndCustomizingViewControllers: viewControllers, changed: true)
40 | }
41 |
42 | public func tabBarControllerSupportedInterfaceOrientations(_ tabBarController: UITabBarController) -> UIInterfaceOrientationMask {
43 | return tr_delegate?.tr_tabBarControllerSupportedInterfaceOrientations(tabBarController) ?? UIApplication.shared.supportedInterfaceOrientations(for: nil)
44 | }
45 |
46 | public func tabBarControllerPreferredInterfaceOrientationForPresentation(_ tabBarController: UITabBarController) -> UIInterfaceOrientation {
47 | return tr_delegate?.tr_tabBarControllerPreferredInterfaceOrientationForPresentation(tabBarController) ?? UIInterfaceOrientation.unknown
48 | }
49 |
50 | public func tabBarController(_ tabBarController: UITabBarController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
51 | guard let transitionAnimation = transitionAnimation as? TabBarTransitionInteractiveable else {
52 | return nil
53 | }
54 | return transitionAnimation.interacting ? transitionAnimation.percentTransition : nil
55 | }
56 |
57 | public func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
58 | return transitionAnimation
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/TransitionTreasury/TabBarTransition/UITabBarController+TRTransition.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UITabBarController+TRTransition.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 16/1/19.
6 | // Copyright © 2016年 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | private var transition_key: Void?
12 | private var delegate_key: Void?
13 |
14 | public typealias ViewControllerIndex = Int
15 |
16 | public extension UITabBarController {
17 |
18 | var tr_transitionDelegate: TRTabBarTransitionDelegate? {
19 | get {
20 | return objc_getAssociatedObject(self, &transition_key) as? TRTabBarTransitionDelegate
21 | }
22 | set {
23 | self.delegate = newValue
24 | objc_setAssociatedObject(self,
25 | &transition_key, newValue,
26 | .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
27 | }
28 | }
29 |
30 | weak var tr_delegate: TRTabBarControllerDelegate? {
31 | get {
32 | if tr_transitionDelegate == nil {
33 | debugPrint("Warning: You forget set tr_transitionDelegate.")
34 | }
35 | return tr_transitionDelegate?.tr_delegate
36 | }
37 | set {
38 | if tr_transitionDelegate == nil {
39 | debugPrint("Warning: You forget set tr_transitionDelegate.")
40 | }
41 | tr_transitionDelegate?.tr_delegate = newValue
42 | }
43 | }
44 |
45 | func tr_selected(_ index: ViewControllerIndex, gesture: UIGestureRecognizer, completion: (() -> Void)? = nil) {
46 | if let transitionAnimation = tr_transitionDelegate?.transitionAnimation as? TabBarTransitionInteractiveable {
47 | transitionAnimation.gestureRecognizer = gesture
48 | transitionAnimation.interacting = true
49 | transitionAnimation.completion = completion
50 | }
51 | selectedIndex = index
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/TransitionTreasury/TransitionTreasury.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TransitionTreasury.swift
3 | // TransitionTreasury
4 | //
5 | // Created by DianQK on 12/20/15.
6 | // Copyright © 2016 TransitionTreasury. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | /**
11 | ViewController Transition Status
12 |
13 | - Push: ViewController will push
14 | - Pop: ViewController will pop
15 | - Present: ViewController will present
16 | - Dismiss: ViewController will dismiss
17 | */
18 | public enum TransitionStatus {
19 | case push
20 | case pop
21 | case present
22 | case dismiss
23 | case tabBar
24 | }
25 |
26 | public protocol TransitionAnimationable {
27 | func transitionAnimation() -> TRViewControllerAnimatedTransitioning
28 | }
29 |
30 | public enum TabBarTransitionDirection {
31 | case left
32 | case right
33 |
34 | public static func TransitionDirection(_ fromVCindex: ViewControllerIndex, toVCIndex: ViewControllerIndex) -> TabBarTransitionDirection {
35 | if fromVCindex > toVCIndex {
36 | return .left
37 | } else {
38 | return .right
39 | }
40 | }
41 | }
42 |
43 | extension TabBarTransitionDirection : CustomStringConvertible {
44 | public var description: String {
45 | get {
46 | switch self {
47 | case .left :
48 | return "Transition to Left"
49 | case .right :
50 | return "Transition to Right"
51 | }
52 | }
53 | }
54 | }
55 |
56 | public protocol TabBarTransitionInteractiveable : class, NSObjectProtocol{
57 | /// Option, if you implement, you must support your animation Push & Present interactive.
58 | var gestureRecognizer: UIGestureRecognizer?{get set}
59 | /// Require
60 | var percentTransition: UIPercentDrivenInteractiveTransition{get set}
61 | /// Option
62 | var interactivePrecent: CGFloat{get}
63 | /// Require
64 | var interacting: Bool{get set}
65 | /// Option
66 | var completion: (() -> Void)?{get set}
67 | }
68 |
69 | public extension TabBarTransitionInteractiveable {
70 | var completion: (() -> Void)? {
71 | get {
72 | return nil
73 | }
74 | set {}
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/transitiontreasury.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dianqk/TransitionTreasury/74564c264281193446e51e7eed12d28d38bd2df9/transitiontreasury.png
--------------------------------------------------------------------------------