Swiftpack.co -  ivanvorobei/SPIndicator as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
ivanvorobei/SPIndicator
Floating indicator, mimicrate to indicator which appear when silent mode turn on / off. Support large texts.
.package(url: "https://github.com/ivanvorobei/SPIndicator.git", from: "1.3.0")

SPIndicator

About

Mimicrate to indicator which appear when silent mode turn on / off. Availalbe 2 animated presets: done & error. Also support custom images and present from top, center & bottom side.

For get alert like in Apple music, use library SPAlert.

If you like the project, don't forget to put star ★
Check out my other libraries:

Navigate

Installation

Ready for use on iOS 12+, tvOS 12+. Works with Swift 5+. Required Xcode 12.0 and higher.

Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

To integrate SPIndicator into your Xcode project using Xcode 12, specify it in File > Swift Packages > Add Package Dependency...:

https://github.com/ivanvorobei/SPIndicator

CocoaPods:

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate SPIndicator into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'SPIndicator'

Manually

If you prefer not to use any of dependency managers, you can integrate SPIndicator into your project manually. Put Sources/SPIndicator folder in your Xcode project. Make sure to enable Copy items if needed and Create groups.

Quick Start

For best experience, I recommend presenting indicator by calling the class functions SPIndicator. These functions are updated regularly and show the indicator as Apple way:

SPIndicator.present(title: "Error", message: "Try Again", preset: .error)

For using a custom image:

let image = UIImage.init(systemName: "sun.min.fill")!.withTintColor(.systemYellow, renderingMode: .alwaysOriginal)
SPIndicator.present(title: "Custom Image", message: "With tint color", preset: .custom(image)))

For showing a simple text message:

SPIndicator.present(title: "Error", haptic: .error)

You can provide message optional too.

Usage

Duration

For change duration of present time, create indicator view and call present method with custom duration:

let indicatorView = SPIndicatorView(title: "Complete", preset: .done)
indicatorView.present(duration: 3)

Layout

For customise layout and margins, use layout property. You can manage margins for each side, icon size and space between image and titles:

indicatorView.layout.iconSize = .init(width: 24, height: 24)
indicatorView.layout.margins.top = 12

Dismiss by Drag

By default allow drag indicator for hide. While indicator is dragging, dismiss not work. This can be disabled:

indicatorView.dismissByDrag = false

Haptic

For manage haptic, you shoud pass it in present method:

indicatorView.present(duration: 1.5, haptic: .success, completion: nil)

You can remove duration and completion, its have default values.

Present Side

If you need present from special side, use this:

SPIndicator.present(title: "Error", message: "Try Again", preset: .error, from: .bottom)

// or with custom view

indicatorView.presentSide = .bottom

In last cases indicator will appear from bottom and attached to bottom. For manage offset check property offset.

Shared Configuration

Also you can change some default values for alerts. For example you can change default duration for alert with next code:

SPIndicatorConfiguration.duration = 2

It will apply for all alerts. Shoud set configuration before present any alerts. I recomend set it in app delegate.

Other Projects

I love being helpful. Here I have provided a list of libraries that I keep up to date. For see video previews of libraries without install open opensource.ivanvorobei.by website.
I have libraries with native interface and managing permissions. Also available pack of useful extensions for boost your development process.

Russian Community

Веду каналы об iOS разработке. Один с туториалами и новостями, другой с обзором библиотек. Со сложной задачей помогут в чате.

Видео-туториалы выклыдываю на YouTube:

Tutorials on YouTube

GitHub

link
Stars: 141
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Fixed bugs for Xcode 13.3.
1 week ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API