Skip to content

Commit 725262b

Browse files
committed
Release 1.0
1 parent e693df8 commit 725262b

22 files changed

+1870
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Pod::Spec.new do |s|
2+
3+
s.name = "AnimationSwitchRootViewController"
4+
s.version = "1.0.0"
5+
s.summary = "Extension for UIWindow - animation switch rootViewController in UIWindow"
6+
7+
s.description = <<-DESC
8+
Core written in Objective-C, interface written in Swift.
9+
Support two types animation: CATransition and move shnapshots views.
10+
DESC
11+
12+
s.homepage = "https://github.com/ProVir/AnimationSwitchRootViewController"
13+
s.license = { :type => "MIT", :file => "LICENSE" }
14+
s.author = { "ViR (Vitaliy Korotkiy)" => "[email protected]" }
15+
16+
s.platform = :ios, "8.0"
17+
18+
19+
s.source = { :git => "https://github.com/ProVir/AnimationSwitchRootViewController.git", :tag => "#{s.version}" }
20+
21+
22+
s.source_files = [
23+
'AnimationSwitchRootViewController/*.{h,m,swift}'
24+
]
25+
26+
27+
s.public_header_files = 'AnimationSwitchRootViewController/*.h'
28+
29+
end

AnimationSwitchRootViewController.xcodeproj/project.pbxproj

Lines changed: 653 additions & 0 deletions
Large diffs are not rendered by default.

AnimationSwitchRootViewController.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0900"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "50DE24BB1FA568FB00DFE080"
18+
BuildableName = "AnimationSwitchRootViewController.framework"
19+
BlueprintName = "AnimationSwitchRootViewController"
20+
ReferencedContainer = "container:AnimationSwitchRootViewController.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
30+
shouldUseLaunchSchemeArgsEnv = "YES">
31+
<Testables>
32+
</Testables>
33+
<AdditionalOptions>
34+
</AdditionalOptions>
35+
</TestAction>
36+
<LaunchAction
37+
buildConfiguration = "Debug"
38+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
39+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
40+
language = ""
41+
launchStyle = "0"
42+
useCustomWorkingDirectory = "NO"
43+
ignoresPersistentStateOnLaunch = "NO"
44+
debugDocumentVersioning = "YES"
45+
debugServiceExtension = "internal"
46+
allowLocationSimulation = "YES">
47+
<MacroExpansion>
48+
<BuildableReference
49+
BuildableIdentifier = "primary"
50+
BlueprintIdentifier = "50DE24BB1FA568FB00DFE080"
51+
BuildableName = "AnimationSwitchRootViewController.framework"
52+
BlueprintName = "AnimationSwitchRootViewController"
53+
ReferencedContainer = "container:AnimationSwitchRootViewController.xcodeproj">
54+
</BuildableReference>
55+
</MacroExpansion>
56+
<AdditionalOptions>
57+
</AdditionalOptions>
58+
</LaunchAction>
59+
<ProfileAction
60+
buildConfiguration = "Release"
61+
shouldUseLaunchSchemeArgsEnv = "YES"
62+
savedToolIdentifier = ""
63+
useCustomWorkingDirectory = "NO"
64+
debugDocumentVersioning = "YES">
65+
<MacroExpansion>
66+
<BuildableReference
67+
BuildableIdentifier = "primary"
68+
BlueprintIdentifier = "50DE24BB1FA568FB00DFE080"
69+
BuildableName = "AnimationSwitchRootViewController.framework"
70+
BlueprintName = "AnimationSwitchRootViewController"
71+
ReferencedContainer = "container:AnimationSwitchRootViewController.xcodeproj">
72+
</BuildableReference>
73+
</MacroExpansion>
74+
</ProfileAction>
75+
<AnalyzeAction
76+
buildConfiguration = "Debug">
77+
</AnalyzeAction>
78+
<ArchiveAction
79+
buildConfiguration = "Release"
80+
revealArchiveInOrganizer = "YES">
81+
</ArchiveAction>
82+
</Scheme>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0900"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "50DE249F1FA55E5100DFE080"
18+
BuildableName = "AnimationSwitchRootViewControllerObjC.framework"
19+
BlueprintName = "AnimationSwitchRootViewControllerObjC"
20+
ReferencedContainer = "container:AnimationSwitchRootViewController.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
30+
shouldUseLaunchSchemeArgsEnv = "YES">
31+
<Testables>
32+
</Testables>
33+
<AdditionalOptions>
34+
</AdditionalOptions>
35+
</TestAction>
36+
<LaunchAction
37+
buildConfiguration = "Debug"
38+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
39+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
40+
language = ""
41+
launchStyle = "0"
42+
useCustomWorkingDirectory = "NO"
43+
ignoresPersistentStateOnLaunch = "NO"
44+
debugDocumentVersioning = "YES"
45+
debugServiceExtension = "internal"
46+
allowLocationSimulation = "YES">
47+
<MacroExpansion>
48+
<BuildableReference
49+
BuildableIdentifier = "primary"
50+
BlueprintIdentifier = "50DE249F1FA55E5100DFE080"
51+
BuildableName = "AnimationSwitchRootViewControllerObjC.framework"
52+
BlueprintName = "AnimationSwitchRootViewControllerObjC"
53+
ReferencedContainer = "container:AnimationSwitchRootViewController.xcodeproj">
54+
</BuildableReference>
55+
</MacroExpansion>
56+
<AdditionalOptions>
57+
</AdditionalOptions>
58+
</LaunchAction>
59+
<ProfileAction
60+
buildConfiguration = "Release"
61+
shouldUseLaunchSchemeArgsEnv = "YES"
62+
savedToolIdentifier = ""
63+
useCustomWorkingDirectory = "NO"
64+
debugDocumentVersioning = "YES">
65+
<MacroExpansion>
66+
<BuildableReference
67+
BuildableIdentifier = "primary"
68+
BlueprintIdentifier = "50DE249F1FA55E5100DFE080"
69+
BuildableName = "AnimationSwitchRootViewControllerObjC.framework"
70+
BlueprintName = "AnimationSwitchRootViewControllerObjC"
71+
ReferencedContainer = "container:AnimationSwitchRootViewController.xcodeproj">
72+
</BuildableReference>
73+
</MacroExpansion>
74+
</ProfileAction>
75+
<AnalyzeAction
76+
buildConfiguration = "Debug">
77+
</AnalyzeAction>
78+
<ArchiveAction
79+
buildConfiguration = "Release"
80+
revealArchiveInOrganizer = "YES">
81+
</ArchiveAction>
82+
</Scheme>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// AnimationSwitchRootViewController.h
3+
// AnimationSwitchRootViewController
4+
//
5+
// Created by Короткий Виталий (ViR) on 29.10.17.
6+
// Copyright © 2017 ProVir. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
#import "UIApplication+PVRootWindow.h"
12+
#import "UIWindow+PVAnimationSwitchRootViewController.h"
13+
14+
15+
//! Project version number for AnimationSwitchRootViewController.
16+
FOUNDATION_EXPORT double AnimationSwitchRootViewControllerVersionNumber;
17+
18+
//! Project version string for AnimationSwitchRootViewController.
19+
FOUNDATION_EXPORT const unsigned char AnimationSwitchRootViewControllerVersionString[];
20+
21+
// In this header, you should import all the public headers of your framework using statements like #import <AnimationSwitchRootViewController/PublicHeader.h>
22+
23+
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
//
2+
// AnimationSwitchRootViewController.swift
3+
// AnimationSwitchRootViewController
4+
//
5+
// Created by Короткий Виталий (ViR) on 29.10.17.
6+
// Copyright © 2017 ProVir. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
public extension UIWindow {
12+
13+
///Transition Direction - equal CATransitionSubType.
14+
@objc public enum TransitionDirection: Int {
15+
case fromRight
16+
case fromLeft
17+
case fromTop
18+
case fromBottom
19+
20+
var subType:String {
21+
switch self {
22+
case .fromRight: return kCATransitionFromRight
23+
case .fromLeft: return kCATransitionFromLeft
24+
case .fromTop: return kCATransitionFromTop
25+
case .fromBottom: return kCATransitionFromBottom
26+
}
27+
}
28+
29+
//Bug - kCATransitionFromTop and kCATransitionFromBottom confused in CATransition
30+
var subTypeForCATransition:String {
31+
switch self {
32+
case .fromRight, .fromLeft: return subType
33+
case .fromTop: return kCATransitionFromBottom
34+
case .fromBottom: return kCATransitionFromTop
35+
}
36+
}
37+
}
38+
39+
40+
41+
/**
42+
Core Animation: custom transition and temp background window.
43+
44+
- Parameters:
45+
- rootViewController: ViewController to switch.
46+
- transition: Custom core animation transition.
47+
- backgroundColor: Background color when animation in process. Default is black.
48+
- backgroundView: View for background when animation in process.
49+
*/
50+
@objc public func switchRootViewController(to rootViewController:UIViewController,
51+
withTransition transition:CATransition,
52+
backgroundColor:UIColor? = nil,
53+
backgroundView:UIView? = nil) {
54+
55+
setRootViewController(rootViewController,
56+
with: transition,
57+
backgroundColor: backgroundColor,
58+
andBackgroundView: backgroundView)
59+
}
60+
61+
/**
62+
Core Animation: push transition and temp background window.
63+
64+
- Parameters:
65+
- rootViewController: ViewController to switch.
66+
- direction: Direction animation. Equal CATransitionSubType in CATransition.
67+
- duration: Duration animation. Default = 0.3.
68+
- backgroundColor: Background color when animation in process. Default is black.
69+
- backgroundView: View for background when animation in process.
70+
*/
71+
@objc public func switchRootViewControllerPushTransition(to rootViewController:UIViewController,
72+
direction:TransitionDirection,
73+
duration:CGFloat = 0.3,
74+
backgroundColor:UIColor? = nil,
75+
backgroundView:UIView? = nil) {
76+
77+
setRootViewController(rootViewController,
78+
pushTransactionRoute: direction.subTypeForCATransition,
79+
duration: duration,
80+
backgroundColor: backgroundColor,
81+
andBackgroundView: backgroundView)
82+
}
83+
84+
/**
85+
Core Animation: push transition and temp background window with image as background.
86+
87+
- Parameters:
88+
- rootViewController: ViewController to switch.
89+
- direction: Direction animation. Equal CATransitionSubType in CATransition.
90+
- duration: Duration animation. Default = 0.3.
91+
- backgroundColor: Background color when animation in process. Default is black.
92+
- backgroundImage: Image for background when animation in process.
93+
*/
94+
@objc public func switchRootViewControllerPushTransition(to rootViewController:UIViewController,
95+
direction:TransitionDirection,
96+
duration:CGFloat = 0.3,
97+
backgroundColor:UIColor? = nil,
98+
backgroundImage:UIImage) {
99+
100+
setRootViewController(rootViewController,
101+
pushTransactionRoute: direction.subTypeForCATransition,
102+
duration: duration,
103+
backgroundColor: backgroundColor,
104+
andBackgroundImage: backgroundImage)
105+
}
106+
107+
108+
109+
110+
/**
111+
Manually animation: move snaphots views (old and new).
112+
113+
- Parameters:
114+
- rootViewController: ViewController to switch.
115+
- direction: Direction animation. Equal CATransitionSubType in CATransition.
116+
- inAnimation: Animation position for new ViewController.
117+
- outAnimation: Animation position for old ViewController.
118+
- duration: Duration animation. Default = 0.3.
119+
- options: UIViewAnimationOptions for UIView animations.
120+
*/
121+
@objc public func switchRootViewControllerManuallyMove(to rootViewController:UIViewController,
122+
direction:TransitionDirection,
123+
inAnimation:Bool = true,
124+
outAnimation:Bool = true,
125+
duration:CGFloat = 0.4,
126+
options:UIViewAnimationOptions = []) {
127+
128+
setRootViewController(rootViewController,
129+
withManuallyInAnimation: inAnimation,
130+
outAnimation: outAnimation,
131+
routeType: direction.subType,
132+
duration: duration,
133+
options: options)
134+
}
135+
136+
137+
138+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>FMWK</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>$(CURRENT_PROJECT_VERSION)</string>
21+
<key>NSPrincipalClass</key>
22+
<string></string>
23+
</dict>
24+
</plist>

0 commit comments

Comments
 (0)