ln-12 / CleanUI

A SwiftUI / iOS framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swift Package Manager

Get this package with the Swift Package Manager

.package(url: "https://github.com/knoggl/CleanUI.git", .upToNextMinor(from: "1.0.0")),

What is CleanUI

CleanUI is a SwiftUI / iOS framework. CleanUI has many things build in to get you started to build your app. CleanUI is ripped out of the Knoggl iOS App to make a reusable framework, which can be worked on without directly changing things inside of the Knoggl iOS App. In other words, CleanUI is the heart of the Knoggl iOS App.

Live Preview

You can download the Knoggl-iOS App on the AppStore to have a very detailed preview with things CleanUI provides you.

What's inside

CleanUI has many default views from simple to complex. CleanUI allows to make huge changes in your app with as little code as possible.

How to use

CleanUI views have a CL prefix. CleanUI helper classes have a CU prefix.

Examples

Programmatic Navigation

NavigationView {
    Button(action: {
      CUNavigation.pushToSwiftUiView(YOUR_VIEW_HERE)
    }){
      Text("Push To SwiftUI view")
    }
    
    Button(action: {
      CUNavigation.pushToSwiftUiView(YOUR_VIEW_HERE, enableBackNavigation: false)
    }){
      Text("Push To SwiftUI view and disbale swipe right to go back gesture")
    }
    
    Button(action: {
      CUNavigation.pop()
    }){
      Text("Pop to previous view")
    }
    
    Button(action: {
      CUNavigation.popToRootView()
    }){
      Text("Pop to the Root View")
    }
    
    Button(action: {
      CUNavigation.pushBottomSheet(YOUR_VIEW_HERE)
    }){
      Text("Push to a Bottom-Sheet")
    }
}

Custom NavigationBar

List {
    Text("Item")
}
.navigationBar("MyTitle")

// With a big title
List {
    Text("Item")
}
.navigationBar("MyTitle", bigTitle: true)

// With a NavigationSearchBar and trailing buttons

@StateObject var navigationSearchField: NavigationBarSearchField = NavigationBarSearchField()

List {
    Text("Item")
}
.navigationBar("MyTitle", bigTitle: true, buttons: AnyView(Group {
    Button(action: {
        // Action
    }, label: {
        CLIcon(systemImage: "plus")
    })
}), searchBar: navigationSearchField)

Alerts, Sheets and AlertMessages

CleanUI lets you create Alerts, Sheets and AlertMessages very easily.

To show a Alert from everywhere in code you can do this.

CUAlert.show(YOUR_VIEW_HERE)

// Clear all Alerts with
CUAlert.clearAll()

To show a Sheet from everywhere in code you can do this.

CUSheet.show(YOUR_VIEW_HERE)

// Clear all Sheets with
CUSheet.clearAll()

To show a AlertMessage from everywhere in code you can do this.

CUAlertMessage.show("HELOOOOO")
CUAlertMessage.show("HELOOOOO", subTitle: "WORLD")

// All styles `CLInfoCard.InfoCardType``
CUAlertMessage.show("HELOOOOO", type: .error)
CUAlertMessage.show("HELOOOOO", subTitle: "WORLD", type: .error)

CUAlertMessage.show("HELOOOOO", type: .success)
CUAlertMessage.show("HELOOOOO", subTitle: "WORLD", type: .success)

CUAlertMessage.show("HELOOOOO", type: .info)
CUAlertMessage.show("HELOOOOO", subTitle: "WORLD", type: .info)

About

A SwiftUI / iOS framework.

License:Apache License 2.0


Languages

Language:Swift 100.0%