All Projects β†’ vinhnx β†’ Laden

vinhnx / Laden

Licence: MIT License
SwiftUI loading indicator view

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Laden

SwiftDown
πŸ“¦ A themable markdown editor component for your SwiftUI apps.
Stars: ✭ 203 (+782.61%)
Mutual labels:  swift-package-manager, swiftui
ConsoleUI
Rasterize SwiftUI views to images from macOS terminal
Stars: ✭ 52 (+126.09%)
Mutual labels:  swift-package-manager, swiftui
SwiftCurrent
A library for managing complex workflows in Swift
Stars: ✭ 286 (+1143.48%)
Mutual labels:  swift-package-manager, swiftui
Swiftuix
Extensions and additions to the standard SwiftUI library.
Stars: ✭ 4,087 (+17669.57%)
Mutual labels:  swift-package-manager, swiftui
SwiftUI-Shapes
Commonly Used Shapes and Utilities In SwiftUI
Stars: ✭ 52 (+126.09%)
Mutual labels:  swift-package-manager, swiftui
Skeletonview
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
Stars: ✭ 10,804 (+46873.91%)
Mutual labels:  swift-package-manager, loading
SSSwiftUISpinnerButton
SSSwiftUISpinnerButton is a collection of various spinning animations for buttons in SwiftUI.
Stars: ✭ 37 (+60.87%)
Mutual labels:  loading, swiftui
Skeletonui
☠️ Elegant skeleton loading animation in SwiftUI and Combine
Stars: ✭ 275 (+1095.65%)
Mutual labels:  swift-package-manager, loading
swift-composable-app-example
Example iOS app built with module composition in mind.
Stars: ✭ 79 (+243.48%)
Mutual labels:  swift-package-manager, swiftui
ScrollViewProxy
ScrollViewProxy for SwiftUI on iOS 13 and up
Stars: ✭ 135 (+486.96%)
Mutual labels:  swift-package-manager, swiftui
CurrencyText
Currency text field formatter available for UIKit and SwiftUI πŸ’ΆβœοΈ
Stars: ✭ 124 (+439.13%)
Mutual labels:  swift-package-manager, swiftui
column-text-view-ui
πŸ“„ Column Text View is an adaptive UI component that renders text in columns, horizontally [iOS 12, UIKit, TextKit, SwiftUI].
Stars: ✭ 11 (-52.17%)
Mutual labels:  swift-package-manager, swiftui
ResponderChain
Cross-platform first responder handling without subclassing views or making custom ViewRepresentables in SwiftUI. Similar to FocusState but for iOS 13+
Stars: ✭ 69 (+200%)
Mutual labels:  swift-package-manager, swiftui
SwiftUI-Color-Kit
SwiftUI Color Pickers, Gradient Pickers And All The Utilities Needed To Make Your Own!
Stars: ✭ 120 (+421.74%)
Mutual labels:  swift-package-manager, swiftui
Shift
Light-weight EventKit wrapper.
Stars: ✭ 31 (+34.78%)
Mutual labels:  swift-package-manager, swiftui
tapit-app
App which lets two people share their social media details by simply putting one phone on top of the other ("tapping"). Currently in development by Nikita Mounier.
Stars: ✭ 18 (-21.74%)
Mutual labels:  swift-package-manager, swiftui
redux-global-loader
A Redux middleware for global loader
Stars: ✭ 13 (-43.48%)
Mutual labels:  loading
SwiftUIKit
A collection of missing SwiftUI components
Stars: ✭ 198 (+760.87%)
Mutual labels:  swiftui
RustRobotics
Rust implementation of PythonRobotics such as EKF, DWA, Pure Pursuit, LQR.
Stars: ✭ 40 (+73.91%)
Mutual labels:  control
mini-swift
Minimal Flux architecture written in Swift.
Stars: ✭ 40 (+73.91%)
Mutual labels:  swift-package-manager

Laden

SwiftUI loading indicator view


Installation

This component is built using Swift Package Manager, it is pretty straight forward to use, no command-line needed:

  1. In Xcode (11+), open your project and navigate to File > Swift Packages > Add Package Dependency...
  2. Paste the repository URL:
https://github.com/vinhnx/Laden

and click Next to have Xcode resolve package. 3. For Rules, select Versions, and choose Up to Next Major as 0.1.0, or checkout the Releases tab for upcoming releases. package_options.png 4. Click Finish to integrate package into your Xcode target. 5. Profit! ☺️

Usage

At simplest form:

import SwiftUI
import Laden

struct ContentView: View {
    var body: some View {
        Laden.CircleLoadingView()
    }
}

To show loading view on top on current view, you can embed Laden inside a ZStack, and put it below your current view:

ZStack {
    Text("Some text") // your content view
    Laden.CircleOutlineLoadingView()
}

or simply just use .overlay attribute:

Text("Some text") // your content view
  .overlay(Laden.BarLoadingView())

ZStack

ZStack

A view that overlays its children, aligning them in both axes.


To indicate loading state, have a private loading bool @State and bind it to Laden's isAnimating initialzier, default value is true (or animated by default):

import SwiftUI
import Laden

struct ContentView: View {
    @State private var isLoading = true

    var body: some View {
        VStack {
            Laden.CircleLoadingView(isAnimating: isLoading)
            Button(isLoading ? "Stop loading" : "Start loading") {
                self.isLoading.toggle()
            }
        }
    }
}

To show or hide loading view, have a private show/hide bool @State and modify said loading with .hidden attribute, when toggled:

import SwiftUI
import Laden

struct ContentView: View {
    @State private var shouldLoadingView = true

    var laden: some View {
        Laden.CircleLoadingView(
            color: .white, size: CGSize(width: 30, height: 30), strokeLineWidth: 3
        )
    }
    
    var body: some View {
        VStack {
            if shouldLoadingView {
                laden.hidden()
            } else {
                laden
            }

            Button(shouldCircleView ? "Show" : "Hide") {
                self.shouldLoadingView.toggle()
            }
        }
    }
}

Customization

To customize loading view color, use color initializer:

Laden.CircleOutlineLoadingView(color: .red)

Available customizations:

/// Loading view protocol that define default configurations.
public protocol LoadingAnimatable: View {
    /// Whether this loading view is animating.
    var isAnimating: Bool { get }

    /// Default color for loading view.
    var color: Color { get }

    /// The default size for loading view.
    var size: CGSize { get set }

    /// Default stroke line width for loading bar.
    var strokeLineWidth: CGFloat { get }
}

Apps currently using Laden

  • Clendar - Clendar - universal calendar app. Written in SwiftUI. Available on App Store. MIT License.

(add yours here)


Acknowledgement

idea πŸ’‘


What is Laden, actually?

It's mean "charge", in Norwegian ⚑️


Help, feedback or suggestions?

Feel free to open an issue or contact me on Twitter for discussions, news & announcements & other projects. πŸš€

I hope you like it! :)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].