Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DirectionDismiss is not working #82

Open
yongxuean opened this issue Aug 11, 2021 · 0 comments
Open

DirectionDismiss is not working #82

yongxuean opened this issue Aug 11, 2021 · 0 comments

Comments

@yongxuean
Copy link

I want it to disappear from the left, not from the bottom

class BasePresentationController: UIViewController {

static func presentFromLeftToRight<T: BasePresentationController>(on hostViewController: UIViewController, returnType: T.Type) -> T? {
    let nibName = self.className.replacingOccurrences(of: "ViewController", with: "").replacingOccurrences(of: "Controller", with: "")
    if let presentedVC = UIStoryboard(name: nibName, bundle: nil).instantiateInitialViewController() as? BaseNavigationController {
        guard let vc = presentedVC.viewControllers.first as? T else { return nil }
        let uiConfiguration = PresentationUIConfiguration(backgroundStyle: .dimmed(alpha: 0.7), isTapBackgroundToDismissEnabled: true)
        let alignment = PresentationAlignment(vertical: .center, horizontal: .left)
        let size = PresentationSize(width: .custom(value: 243), height: .fullscreen)
        let presentation = CoverPresentation(directionShow: .left, directionDismiss: .left, uiConfiguration: uiConfiguration, size: size, alignment: alignment)
        let animator = Animator(presentation: presentation)
        animator.prepare(presentedViewController: presentedVC)
        hostViewController.present(presentedVC, animated: true, completion: nil)
        return vc
    } else {
        guard let presentedVC = UIStoryboard(name: nibName, bundle: nil).instantiateInitialViewController() as? T else { return nil }
        let uiConfiguration = PresentationUIConfiguration(backgroundStyle: .dimmed(alpha: 0.7), isTapBackgroundToDismissEnabled: true)
        let alignment = PresentationAlignment(vertical: .center, horizontal: .left)
        let size = PresentationSize(width: .custom(value: 243), height: .fullscreen)
        let presentation = CoverPresentation(directionShow: .left, directionDismiss: .left, uiConfiguration: uiConfiguration, size: size, alignment: alignment)
        let animator = Animator(presentation: presentation)
        animator.prepare(presentedViewController: presentedVC)
        hostViewController.present(presentedVC, animated: true, completion: nil)
        return presentedVC
    }
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant