kawoou / kwdrawercontroller Goto Github PK
View Code? Open in Web Editor NEWDrawer view controller that easy to use!
License: MIT License
Drawer view controller that easy to use!
License: MIT License
Thanks for the library! It would be cool if there was a delegate protocol to preform actions on the drawer state changing rather than having to pass a completion handler in. For example, the following stubs:
func drawerController?(willOpenSide side: DrawerSide)
func drawerController?(willCloseSide side: DrawerSide)
I'd be happy to submit a PR.
Thanks,
Charles
Hi there,
After some tests I realized that preferredStatusBarStyle
and similar where not set from the currently displayed side, it would be nice to forward them and ask the system for a status bar update when opening/closing a side.
Would you like a PR?
Thanks again,
Stan
Hi, I am seeing a random bug that is reproducible only on a device (tested on iPhone 5S and 7)
I am using your example, without any modifications. The issue is that sometimes, when I press the button to open the right drawer (transition is set to Slide), the drawer opens up fine, but sometimes the slide animation stutters and the side viewcontroller is offset to the left of the screen (notice that the main viewcontroller underneath it remains at its initial position)
First of all thanks for the great library.
I am having an issue, when i set Custom Class to "KWDrawerController" via story board there is no build issue only the console show this message "Unknown class KWDrawerController in Interface Builder file."
I have removed the libs via pods and installed many times but still the same issue.
Hoping for quick response.
Thanks.
Hello,
I just discovered this project and find it very interesting, and very well done. However I'd like to implement a custom transition (sliding left side, with fixed center VC masked by shadow + semi-opaque color), which is not currently possible because the base class is not defined as public.
Would it be possible to declare it public? Also if you think there will be an issue with implementing the transition I'm looking for and have a quick fix that would be very appreciated; if you don't have the time I can send a PR your way when I've had the chance to try.
Thanks a lot for your time,
Stan
First off, really good work, it's a really clear project and easy to setup!
I have a suggestion: when using a DrawerSlideTransition
, since no background is visible (like DrawerFloatTransition
for instance), it would be great if the child view controllers were resized to fit the available width.
I have been able to make this by updating a bit DrawerContent.swift
:
internal func updateView() {
let width = CGFloat(drawerWidth)
contentView.frame.size.width = width
drawerOffset = 0.0
guard let superView = contentView.superview else { return }
if drawerSide == .right {
drawerOffset = superView.frame.width - width
}
viewController.view.frame = CGRect(
x: 0,
y: 0,
width: width,
height: superView.frame.height
)
}
This may not be perfect to obtain the needed behaviour, and this affects all other transitions. Would you know a way to achieve this behaviour with a custom transition or a an additional setting?
I also noticed it's not possible de create custom transitions because the methods of DrawerTransition
are not marked open
.
HI, I want to enable only left drawer. How can I do that?
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 installed it with pod ,used it with storyboard, it was not working, it displayed with DrawViewcontroller only.
# Swift 4~ pod 'KWDrawerController', '~> 4.2' pod 'KWDrawerController/RxSwift' # with RxSwift extension
But when I remove 'KWDrawerController' from podfile and drag the DrawerController folder to my project, it working well.
Did i missed sth?
No idea about how to implement KWDrawerController. And it is not working and it produces a black screen
When embedded in navigationController to drawerController , drawerController height is bottom of the navigation bar . Can i know how to overlap for navigation bar for drawercontroller ?
Can you please write storyboards steps and supply the screenshot as it is not available.
In the last release of Xcode and Swift some methods and types were renamed, so KWDrawerController can't be compiled anymore. Please fix these errors.
Is there an example of using the delegates somewhere? I'm having trouble getting any delegate method to fire, and I badly need to be able to respond to drawer state as it changes.
Good morning!
First, thanks for this awesome lib!
Someone can help me?
Is possible add cornerRadius to main view controller when I click or swipe?
Thanks
Hi,
I'm trying to change existing view controller by using setViewController(newController, for: .none)
but it changes the controller without animation while the side menu is opened. Seems abit odd from user experience
Please see attached project. I have initial view controller with button "Go". When I press this button, I initialize DrawerController, set SideMenuController as side menu and InnerContentController as content, and set DrawerController as root window controller. Pressing "Go button" produces console output:
inner content controller will disappear
inner content controller did disappear
inner content controller will appear
side menu controller will appear
inner content controller did appear
side menu controller did appear
But InnerContentController has never disappeared of course. And SideMenuController has never appeared. The console output should be as follows:
inner content controller will appear
inner content controller did appear
So, lifecycles of child controllers are managed by DrawerController incorrectly. I have a much bigger application, and in this application method viewDidAppear of some controller inside DrawerController isn't getting called. Because of that, my important code in this method is not executed. Without DrawerController, all works fine.
Please fix this, it is the critical problem.
How do I remove the gestures for a certain drawer?
I will have a drawer with the main menu on all pages, and a drawer with an module submenu for a certain module...
and I want only the main menu to be triggered by gestures...
If I override preferredStatusBarStyle, it does not work.
How Can I Fix IT??
Hello. Are there any plans to have a Swift Package Manager version of this?
There is example how to open main view from left or right menu.
Is there some way to do that ?
Or this is not options for this repo ?
Thanks
Extension property drawerController of UIViewController returns nil when I'm trying to access it in viewWillDisappear and viewDidDisappear methods of my view controller. Could you please explain this behaviour if it's correct or fix it if there is some bug?
With any gesture or touch after this misplacement, problem will resolve and .right side opens properly.
I tried to debug very hard to contribute the project, yet I could not solve the puzzle.
My guess: there might be an invalide size/frame reading occur before the (.right)view became visible.
Thank you for opensourcing this project I was using it for over a year without any issues, then the specs changed and customer wants a right hand side menu:)
Cheers,
Now default status bar style (black) is used for DrawerController . To change the style, I have to write something like that:
extension DrawerController {
open override var preferredStatusBarStyle: UIStatusBarStyle {
return UIStatusBarStyle.lightContent
}
}
Please add possibility to set status bar style via initializer or property of DrawerController class. And it would be great to get default status bar style (if it hasn't been set explicitly) as status bar style of content controller.
i can't install this framework with below message...
[!] Unable to satisfy the following requirements:
KWDrawerController (~> 3.6.1)
required by Podfile
None of your spec sources contain a spec satisfying the dependency: KWDrawerController (~> 3.6.1)
.
You have either:
pod repo update
.Note: as of CocoaPods 1.0, pod repo update
does not happen on pod install
by default.
so i tried to install with 'pod 'KWDrawerController'' but pod tried install 3.3 version.
When maiViewController (Child of KWDrawer) is rotate when viewDidLoad() of maiViewController is call again?
Now I can set drawer width only in points. Because of that, side menu doesn't adapt to changes of size width. For example, I can't make menu occupying one third of screen without writing custom code that will update menu width when size of screen changes.
It would be useful to specify side menu width as percentage of screen width. Maybe can you suggest some way to use Auto Layout for side menu size determination?
When closing a side panel that has been presented using a DrawerFloatTransition, the main view controller is not always restored properly and is instead drawn offset to the left by approximately 30 pixels. This creates a visual defect in the UI. Subsequent open / close of the side panel will exacerbate the situation, eventually causing the primary view to become unusable.
See images below:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.