• This repository has been archived on 13/Feb/2019
  • Stars
    star
    3,800
  • Rank 11,590 (Top 0.3 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A UI framework that enables panels on iOS.

PanelKit for iOS

Build Status Codecov
Swift PodVersion Carthage Compatible Platform: iOS
Twitter Donate via PayPal

PanelKit for iOS
Applications using PanelKit can be seen in the showcase.

About

PanelKit is a UI framework that enables panels on iOS. A panel can be presented in the following ways:

  • Modally
  • As a popover
  • Floating (drag the panel around)
  • Pinned (either left or right)

This framework does all the heavy lifting for dragging panels, pinning them and even moving/resizing them when a keyboard is shown/dismissed.

Implementing

A lot of effort has gone into making the API simple for a basic implementation, yet very customizable if needed. Since PanelKit is protocol based, you don't need to subclass anything in order to use it. There a two basic principles PanelKit entails: panels and a PanelManager.

Panels

A panel is created using the PanelViewController initializer, which expects a UIViewController, PanelContentDelegate and PanelManager.

PanelContentDelegate

PanelContentDelegate is a protocol that defines the appearance of a panel. Typically the PanelContentDelegate protocol is implemented for each panel on its UIViewController.

Example:

class MyPanelContentViewController: UIViewController, PanelContentDelegate {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.title = "Panel title"	
    }
    
    var preferredPanelContentSize: CGSize {
        return CGSize(width: 320, height: 500)
    }	
}

A panel is explicitly (without your action) shown in a UINavigationController, but the top bar can be hidden or styled as with any UINavigationController.

PanelManager

PanelManager is a protocol that in its most basic form expects the following:

// The view in which the panels may be dragged around
var panelContentWrapperView: UIView {
    return contentWrapperView
}

// The content view, which will be moved/resized when panels pin
var panelContentView: UIView {
    return contentView
}

// An array of PanelViewController objects
var panels: [PanelViewController] {
    return []
}

Typically the PanelManager protocol is implemented on a UIViewController.

Advanced features

PanelKit has some advanced opt-in features:

Installation

CocoaPods

To install, add the following line to your Podfile:

pod 'PanelKit', '~> 2.0'

Carthage

To install, add the following line to your Cartfile:

github "louisdh/panelkit" ~> 2.0

Run carthage update to build the framework and drag the built PanelKit.framework into your Xcode project.

Requirements

  • iOS 10.0+
  • Xcode 9.0+

Todo

Long term:

  • Top/down pinning

License

This project is available under the MIT license. See the LICENSE file for more info.

More Repositories

1

openterm

OpenTerm, a sandboxed command line interface for iOS
Swift
1,614
star
2

savannakit

A high-performance, protocol oriented, framework for creating native IDEs for iOS and macOS, written in Swift
Swift
870
star
3

source-editor

A native source editor for iOS and macOS, written in Swift
Swift
740
star
4

textor

A plain text editor for iOS
Swift
587
star
5

cub

The Cub Programming Language
Swift
220
star
6

huekit

A UI framework for iOS that provides components and utilities for building color pickers.
Swift
208
star
7

pointerkit

A proof of concept framework to use a pointing device on iOS
Objective-C
170
star
8

lioness

The Lioness Programming Language
Swift
167
star
9

bezierpath-polygons

Adds a convenience initalizer to UIBezierPath for generating n-sided regular polygon paths – with rounded corners support – in Swift!
Swift
156
star
10

bezierpath-length

A simple API to get the length of a CGPath, UIBezierPath or NSBezierPath, written in Swift.
Swift
85
star
11

savanna

A native iOS & macOS IDE for the Cub programming language
Swift
73
star
12

icns2png

A Swift command line script that converts .icns files to .png files at various sizes
Swift
34
star
13

microcontroller-kit

Value types, operators and functions for tinkering with microcontrollers in software.
Swift
20
star
14

KeyCommandAlertController

UIAlertController wrapper to add keyboard shortcuts easily
Swift
19
star
15

markdown-table-gen

A script that generates a Markdown table from an array of strings for a given number of columns
Swift
17
star
16

java-class-quick-look

Quick Look plugin to display Java class files as bytecode
C
12
star
17

silverfox-gen

Generator for the static content of silverfox.be
Swift
9
star
18

sierpinski-curve-swift

Generates a Sierpiński curve using a turtle mechanism in Swift.
Swift
9
star
19

cmd-almanac

A list of commands I frequently use
6
star
20

panelkit-handle-view

IBDesignables to play around with corner radii of the resize handles in PanelKit.
Swift
5
star
21

openterm-scripts-library

Example scripts for OpenTerm, written in Cub
Swift
4
star
22

cub-guide

A guide for the Cub programming language
HTML
3
star
23

sniper

A basic 2D physics engine written in C#
C#
1
star
24

subnet-manager-java

A subnet manager written in Java (college assignment)
Java
1
star
25

silverfox-site

The HTML, CSS & JavaScript of silverfox.be
JavaScript
1
star
26

silverfox-news

The news items of silverfox.be
1
star