CocoaPods trunk is moving to be read-only. Read more on the blog, there are 13 months to go.
| TestsTested | ✗ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | May 2017 |
| SwiftSwift Version | 3.1 |
| SPMSupports SPM | ✗ |
Maintained by Matija Kruljac.
SolarTransition is a cocoapod for circular animated transition from UIButton which is a square shape with rounded corners by half of its width or height.
To run the example project, clone the repo, and run pod install from the Example directory first.
SolarTransition is available through CocoaPods. To install it, simply add the following lines to your Podfile:
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod "SolarTransition"
endCode below is used when transition starts from first ViewController (fromViewController) to second ViewController (toViewController) with a tap on rounded UIButton. SolarTransitionAnimator has to be initialized with duration of animation, transition type and with originView. After creating toViewController, originView of toViewController is rounded UIButton which is mentioned earlier and needs to be set. Last thing that is left is just to call present() method of SolarTransitionAnimator with toViewController and navigationController.
let solarTransitionAnimator = SolarTransitionAnimator(
withDuration: TimeInterval(0.3),
forTransitionType: .presenting,
originView: startSolarTransitionButton
)
let toViewController = ToViewController(
nibName: "ToViewController",
navigationService: navigationService
)
toViewController.originView = startSolarTransitionButton
solarTransitionAnimator.present(
viewController: toViewController,
inNavigationController: navigationController
)Before transition can be successful second ViewController (toViewController) needs to implement SolarTransitionOriginProtocol.
public protocol SolarTransitionOriginProtocol {
var originView: UIView? { get set }
}This protocol demands declaration of originView property which is set in first ViewController (fromViewController).
When dissmising second ViewController (toViewController) SolarTransitionAnimator must be initialized with duration of animation, transition type and with originView. For dissmising ViewController dismiss() method of SolarTransitionAnimator is called.
class ToViewController: UIViewController, SolarTransitionOriginProtocol {
// ...
guard let originView = originView else { return }
let solarTransitionAnimator = SolarTransitionAnimator(
withDuration: TimeInterval(0.5),
forTransitionType: .dismissing,
originView: originView
)
solarTransitionAnimator.dismiss(
viewController: self,
inNavigationController: navigationController
)
}Matija Kruljac, [email protected]
SolarTransition is available under the MIT license. See the LICENSE file for more info.