Skip to main content
Version: Next

OCSpinner - Custom SwiftUI Spinner component

OCSpinner is a custom SwiftUI spinner component that enables you to create simple spinner to show while performing async task or loading. This README will guide you through using and integrating the OCSpinner component into your SwiftUI projects.

Features

  • Create a spinner with custom tint color and different sizes
  • The spinner has an optional label to show a message while spinner is animating.
  • The spinner comes in different sizes namely small, mini, regular and large.

Installation

  1. Copy the OCSpinner struct code from [OCSpinner.swift] and add associated Utils files to your project.

Usage

You can create an instance of OCSpinner by initializing it with the below parameters. Also create an instance of OCSpinnerStyle to make customization to the Spinner. Here's an example of how to create a spinner with a text message and of size large.

    let spinnerConfig = OCSpinnerStyle(spinnerTintColor: .progressSpinner, spinnerStyle: .small)
OCSpinner("Please wait, your content is being loaded...", spinnerStyle: spinnerConfig)