louisdh / panelkit Goto Github PK
View Code? Open in Web Editor NEWA UI framework that enables panels on iOS.
License: MIT License
A UI framework that enables panels on iOS.
License: MIT License
I just love this repo, and wanted to share this love with you, and thank you for open sourcing it and seeing the value in open source, despite this being a serious differentiator in your own app!
My "issue" here is that this is not part of UIKit on iPad! Apple introduced the iPad Pro, and we still have silly 5x4 SpringBoard grids with such limited UI.
Hi @louisdh,
First of all I would like to appreciate for creating such a nice, cool library.
I wanted to use this in my Objective-C project, does this library provide wrapper for the same?
#Thanks
Pranav
Interesting component ๐
For iOS and macOS projects it's will be great to make your component Carthage compatible
Take a look at these articles:
On your README.md
add on top and add section for the installation with Carthage.
Is it possible to provide a spacing between the added panels and/or the main view (i.e. panelContentView)?
First Let me say that I have really enjoyed using this! I love the ability to drag around a popover!
I just wanted to add that I am using version 0.8.2, and this is a kind of simple fix to allow the contentViewController to be aware it will be dismissed!
I can add this in for you, no problem! I am using PanelKit in one of my projects that is also using obj-c pods so I had to download the master manually include it in my project so my Cocoapods didn't clash, but overall this is great.
`extension PanelManager where Self: UIViewController {
func close(_ panel: PanelViewController) {
if (panel.contentViewController != nil) {
panel.contentViewController!.viewWillDisappear(true)
}
panel.view.removeFromSuperview()
panel.contentViewController?.didUpdateFloatingState()
if panel.isPinned {
didDragFree(panel)
}
}
}`
I have a view and I want to switch between form sheet or half screen view and on a button tap or on resize handler press I want to present it as Full screen view controller.
Is it possible ?
Hello first of all thanks for this project. I am trying to integrate this into my Objective C project using swift extensions as you mentioned in some other issue. But Panel Delegate is not being called.
here is the method I am calling in my Objective C class
self.webBroserVc.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController * popoverVc = self.webBroserVc.popoverPresentationController;
popoverVc.sourceView = self.browserButton;
popoverVc.sourceRect = CGRectMake(self.browserButton.bounds.size.width/2, self.browserButton.bounds.size.height/2, 0, 0);
//popoverVc.preferredContentSize = CGSizeMake(250, 250);
[self presentViewController:self.webBroserVc animated:YES completion:nil];
Now I am using an extension to call the Panel Kit methods for PanelManager and PanelControlDelegate
extension CanvasViewController : PanelManager{
public var panels: [PanelViewController] {
let mapPanelVC = PanelViewController(with: self.webBroserVc, in: self)
return [mapPanelVC]
}
public var panelContentWrapperView: UIView {
return self.view
}
public var panelContentView: UIView {
return scrollViewContainer
}
}
extension WebBrowserViewController : PanelContentDelegate {
public var preferredPanelContentSize: CGSize {
return CGSize(width: 320, height: 500)
}
public var maximumPanelContentSize: CGSize {
return CGSize(width: 512, height: 600)
}
public var preferredPanelPinnedWidth: CGFloat {
return 500
}
But the PanelContentDelegate is not being called, can you please tell me what I am doing wrong @louisdh
I triggered a crash in OpenTerm while trying to dock a panel to the side.
I believe this is caused by PanelManager+AutoLayout
:updateFrame(for:to:keyboardShown)
dividing by zero. Not sure the circumstances that caused this, or if this is something misconfigured in OpenTerm, but there should be a check to handle this case in PanelKit.
Crash is below:
Assertion failure in -[NSLayoutConstraint _setMultiplier:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1444.12/Layout.subproj/NSLayoutConstraint.m:196
2018-02-06 16:45:07.837694-0800 OpenTerm[38697:2877706] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Multiplier is not finite! That's illegal. multiplier:inf'
The close method on PanelManager isn't public so I can't choose to close an individual panel (for example allowing a user to close a floating or pinned panel by pressing the UI button that displayed it, ie having that button be a toggle for displaying the panel).
Is there any way of executing code when a panel closes? I tried overriding different methods I can see in the open source code, but most are in extensions and so not overridable. I tried overriding viewWillDisappear
, which gets called every time a panel pins/floats/unpins. I also tried adding a custom done button, however that one got removed and replaced with the PanelKit one.
Is there a way to run code when the close button gets pressed, or could you add that functionality?
It would be great if it were possible to have tabs, like in Goodnotes or Safari
They would be created when dragging a panel over a non-floating panel. I guess they'd be in a bar below the Navigation bar, or maybe the Navigation bar could be split if it were only two or so (?). A tab could then be grabbed and pulled back out to a floating panel. Maybe even a panel with multiple tabs could be dragged. Kind of the way that windows behave now on MacOS, when having the native tabs. (TextMate is a great example for that)
When toggling expose while panels are pinned and then pulling panels the app starts to break down. While in expose apps can be pinned to a different side, then however get blurred into the background. when deactivating expose they return to their original location, but the background is laid out for the panels being pinned to the side were during expose.
Using the example provided (Map and TextView): when both panels are floating and expose is activated the both can (sometimes) be "resized", by pulling the bottom of the panels, which shrinks them down weirdly, even until they vanish. After deactivating expose they return to normal.
I've downloaded and run the example in this repo, but the panels show up as the old navigation controller, and I couldn't drag them. Am I missing something obvious for the dragging to work? I've tried to drag the NavigationBar, it does not move.
Is it possible to pin a panel programmatically?
Hi @louisdh,
First of all I would like to appreciate for creating such a nice, cool library.
Do you know any similar library for Android as well? I have searched a lot but not able to find the same.
Thanks
Pranav
Example app does not run as is in Xcode 9
I'm not sure if this is due to how my project is set up, but I can't seem to have restoration work when there is both a pinned and a floating panel.
I'm calling my restorePanelStatesFromDisk() in viewWillAppear because if a panel is pinned I want it to be there as the view is being presented. This doesn't seem to display floating panels, though.
Calling restorePanelStatesFromDisk() in viewDidAppear seems to display floating panels fine, but causes pinned panels to suddenly appear instead of being there from the initial display animation.
I've tried calling restorePanelStatesFromDisk() in both, but this causes pinned panels to be there at the start but then disappear.
Any insights into what I might be doing wrong?
Thanks!
First off, @louisdh, thanks for making PanelKit โ this is really incredible. :)
I am trying to present a panel in the floating state immediately (i.e., without first presenting the panel in a popover). I've tried a number of techniques; the only thing that comes somewhat close is the following:
// MARK: - Popover
@IBAction func showMap(_ sender: UIBarButtonItem) {
showPopover(mapPanelVC, from: sender) {
if self.mapPanelVC.canFloat {
self.toggleFloatStatus(for: self.mapPanelVC)
}
}
}
func showPopover(_ vc: UIViewController, from barButtonItem: UIBarButtonItem, completion: (() -> Void)? = nil) {
vc.modalPresentationStyle = .popover
vc.popoverPresentationController?.barButtonItem = barButtonItem
present(vc, animated: true, completion: completion)
}
(Although the panel is being presented as a popover, albeit for a very short amount of time.)
The reason that this distinction matters is because I'd like to present a "normal" (non-PanelKit) popover that will allow the user to manage panels, including opening new panels, and potentially closing existing panels. If the panels could start in the floating state immediately, that would make this a lot cleaner.
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.