johncodeos-blog / CustomSideMenuiOSExample

Create a Side Menu in iOS using Swift
46 stars 24 forks source link

Bring up the side menu from the right #2

Open matildemarcelletti opened 2 years ago

matildemarcelletti commented 2 years ago

Moving the button at the top right how can I bring up the side menu from the right?

arbindpd96 commented 1 year ago

func animateSideMenu(targetPosition: CGFloat, completion: @escaping (Bool) -> ()) { UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0, options: .layoutSubviews, animations: { if self.revealSideMenuOnTop { self.sideMenuTrailingConstraint.constant = -targetPosition self.view.layoutIfNeeded() } else { self.view.subviews[1].frame.origin.x = targetPosition } }, completion: completion) }

`        if self.revealSideMenuOnTop {

// self.sideMenuTrailingConstraint = self.sideMenuViewController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: -self.sideMenuRevealWidth - self.paddingForRotation) //use it for left navigation mneu self.sideMenuTrailingConstraint = self.sideMenuViewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: self.sideMenuRevealWidth + self.paddingForRotation)

        self.sideMenuTrailingConstraint.isActive = true
    }`
BilalKhanWDI commented 5 months ago

Has anyone modified this for the pan gesture as well? the same drag as it comes from left. If anyone has mapped just update here.