Home

Awesome

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?

What PartitionKit is not ?

Requirements

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

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.

HPartVPartGridPartNestGridsMixed
HPartVPartGridPartNested GridMixed
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