• Stars
    star
    239
  • Rank 168,763 (Top 4 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 5 years ago
  • Updated almost 4 years ago

Reviews

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

Repository Details

A SwiftUI Library for creating resizable partitions for View Content.

Partition Kit

partition kit logo

Recently Featured In Top 10 Trending Android and iOS Libraries in October and in 5 iOS libraries to enhance your app!

grid

What is PartitionKit?

  • It is the solution to the need for composable and dynamically sized user interface content in SwiftUI.
  • also the first piece of software I have ever made into a library so please be gentle(both with use cases and with my heart).

What PartitionKit is not ?

  • PartitionKit is not a means to work with an form of stored data, this is not for partitioning hard drives or any other type of formattable data drive.

Requirements

PartitionKit as a default requires the SwiftUI Framework to be operational, as such only these platforms are supported:

  • macOS 10.15 or Greater
  • iOS 13 or Greater
  • tvOS 13 or Greater
  • watchOS 6 or Greater

How To Add To Your Project

  1. Snag that URL from the github repo
  2. In Xcode -> File -> Swift Packages -> Add Package Dependencies
  3. Paste the URL Into the box
  4. Specify the minimum version number (This is new so 1.0.0 and greater will work).

Less Than 2 Minute Tutorial Video

Tutorial Video: How To Use PartitionKit

How To Use

Vertical Partition

  1. Decide on what view you would like to have on Top, which you would like to have on the Bottom and optionally a Handle to be used to drag the partitions to different sizes.
  2. Do This
VPart(top: {
    MyTopView()
    }, bottom: {
    MyBottomView()
    }) {
    MyHandle()
}

Horizontal Partition

  1. Decide on what view you would like to have on Left, which you would like to have on the Right and optionally a Handle to be used to drag the partitions to different sizes.
  2. Do This
HPart(left: {
    MyLeftView()
    }, right: {
    MyRightView()
    }) {
    MyHandle()
}

GridPartition

  1. Decide on what Views will go in each corner TopLeft, TopRight, BottomLeft, BottomRight and optionally a Handle for the user to drag and resize the views with.
  2. Do this
    GridPart(topLeft: {
        MyTopLeftView()
        }, topRight: {
        MyTopRightView()
        }, bottomLeft: {
        MyBottomLeftView()
        }, bottomRight: {
        MyBottomRightView()
        }) {
        MyHandle()
}

Examples

Copy and Paste this I have added Named pictures for how the views should look, Im using dark mode so light mode colors may look different.

HPart VPart GridPart NestGrids Mixed
HPart VPart GridPart Nested Grid Mixed
import SwiftUI
import PartitionKit



struct ContentView: View {
    var vExample: some View {
        VPart(top: {
            RoundedRectangle(cornerRadius: 25).foregroundColor(.purple)
        }) {
            Circle().foregroundColor(.yellow)
        }
    }
    
    var hExample: some View {
        HPart(left: {
            RoundedRectangle(cornerRadius: 10).foregroundColor(.blue)
        }) {
            Circle().foregroundColor(.orange)
        }
    }
    
    var nestedExample: some View {
        VPart(top: {
            hExample
        }) {
            vExample
        }
    }
    
    var gridExample: some View {
        GridPart(topLeft: {
            RoundedRectangle(cornerRadius: 25).foregroundColor(.purple)
        }, topRight: {
            Circle().foregroundColor(.yellow)
        }, bottomLeft: {
            Circle().foregroundColor(.green)
        }) {
            RoundedRectangle(cornerRadius: 25).foregroundColor(.blue)
        }
    }
    
    var nestedGridsExample: some View {
        GridPart(topLeft: {
            gridExample
        }, topRight: {
            gridExample
        }, bottomLeft: {
            gridExample
        }) {
            gridExample
        }
    }
    
    var body: some View {
        nestedExample
        
    }
}


struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Todo

  • Add in constraints so that partitions will not cause negative frame values that invert the views when the handle is dragged beyond the frame of the container
  • Add more customizability to initial layouts
  • Add a List Style grid collection layout that can be initiated with a list of Identifiable data elements.
  • General cleanup, some stuff was not meant to be left in, i will find it at some point.

More Repositories

1

Sliders-SwiftUI

Collection of unique fully customizable SwiftUI sliders, joysticks, trackpads and more!
Swift
409
star
2

SwiftUI-Color-Kit

SwiftUI Color Pickers, Gradient Pickers And All The Utilities Needed To Make Your Own!
Swift
203
star
3

SwiftUI-bez

Utilities for working with bezier curves in SwiftUI
Swift
95
star
4

SwiftUI-Shapes

Commonly Used Shapes and Utilities In SwiftUI
Swift
88
star
5

Drawing-Tools

Shapes and views used to make visual representation of drawing tools
Swift
28
star
6

Wordle-Guesser

SwiftUI example app for guessing in Wordle
Swift
24
star
7

SegmentedPicker

SwiftUI Segmented Picker. Create vertical and horizontal pickers and style them to your liking
Swift
18
star
8

CGExtender

Frequently reused helpers and functions for coregraphics types
Swift
17
star
9

SlidersExamples

A companion project to explore the Sliders SwiftUI Library
Swift
15
star
10

Swift_Programming_Notes_And_Cheatsheets

A bunch of different sets of notes, tables, and cheatsheets for things related to Swift development
8
star
11

Color-Kit-Examples

Companion project for exploring all the awesome color pickers and gradient pickers from the Color Kit SwiftUI library
Swift
7
star
12

Shapes-Examples

Examples from the Shapes SwiftUI Library.
Swift
7
star
13

PickMe

SwiftUI Library for styling resuable selection effects for views
Swift
6
star
14

CollisionDetectionExamples

SwiftUI Collision Detection Example Project
Swift
5
star
15

CSVToSwift

Convert a CSV File into swift object code
Swift
3
star
16

MySchema

A small tool I made while learning GraphQL. You can design objects and simple schemas in an easy visual way
Swift
2
star
17

PolygonIOAPI

An unofficial Swift API for polygon.io
Swift
1
star
18

EventGen

Commandline tool for generating swift Event objects from a csv file
Swift
1
star
19

PathTamer

Find the arclength, and bounds of a stroked SVG path element
Swift
1
star