KWDrawerController icon indicating copy to clipboard operation
KWDrawerController copied to clipboard

I can't trigger to open left or right side by button action.

Open GokmenAkar opened this issue 6 years ago • 7 comments

I followed instructions for storyboard and I set controllers correctly.

class Example: UIViewController, DrawerControllerDelegate {

override func viewDidLoad()  {
        super.viewDidLoad()
        self.drawerController?.delegate = self
        self.drawerController?.options.isAnimation = false
        self.drawerController?.setTransition(DrawerFloatTransition(), for: .left)
}

When I try to trigger open left side with this code block, drawerController throws nil error and crash.

if self.drawerController!.drawerSide == .none {
            self.drawerController?.openSide(.left)
                .subscribe()
                .disposed(by: disposeBag)
        } else {
            self.drawerController?.closeSide()
                .subscribe()
                .disposed(by: disposeBag)
        }

GokmenAkar avatar May 29 '18 18:05 GokmenAkar

What version are you using?

kawoou avatar May 30 '18 05:05 kawoou

@kawoou Xcode Version: Version 9.3.1 Swift Version: 4.1 Pods:

  • RxCocoa (4.1.2):
    • RxSwift (~> 4.0)
  • RxSwift (4.1.2)
  • KWDrawerController (4.1.6):
    • KWDrawerController/Core (= 4.1.6)
  • KWDrawerController/Core (4.1.6)

GokmenAkar avatar May 30 '18 06:05 GokmenAkar

What class is calling the code that calls openSide method?

If this ViewController calling the self.drawerController property does not have a DrawerController in its super, it will be nil.

kawoou avatar Jun 01 '18 12:06 kawoou

I followed instructions for storyboard and I set controllers correctly.

class Example: UIViewController, DrawerControllerDelegate {

override func viewDidLoad()  {
        super.viewDidLoad()
        self.drawerController?.delegate = self
        self.drawerController?.options.isAnimation = false
        self.drawerController?.setTransition(DrawerFloatTransition(), for: .left)
}

When I try to trigger open left side with this code block, drawerController throws nil error and crash.

if self.drawerController!.drawerSide == .none {
            self.drawerController?.openSide(.left)
                .subscribe()
                .disposed(by: disposeBag)
        } else {
            self.drawerController?.closeSide()
                .subscribe()
                .disposed(by: disposeBag)
        }

I have the same problem, could you solve it?

neburzepol avatar Nov 28 '18 23:11 neburzepol

I have the same problem, I follow the readme manual but I have the same crash, the self.drawerController is nil, any suggest?

best regards

neburzepol avatar Nov 29 '18 00:11 neburzepol

Also having issues with self.drawerController?.openDrawer(.left) and self.drawerController?.closeDrawer(). In my case, both the left and centre have UINavigationContoller's embedded in them, each with a single UIViewController embedded as the rootViewController. Each has a left bar button item in the Navigation Bar that calls a private function that just calls the open or close. In both cases, the private function is getting called, but the DrawerController isn't responding. I've logged out the self.drawerController, it's not nil. I've also setup my view controller as the DrawerControllerDelegate, none of the delegate methods are getting called. My DrawerController was setup in storyboard, just in case that's relevant.

BeechMachine avatar Dec 05 '18 21:12 BeechMachine

Just call self.drawerController?.openSide(.left, completion: nil), The completion: nil do the trick.

4bottiglie avatar Apr 08 '19 20:04 4bottiglie