Mimicrate To Indicator Which Appears When Silent Mode Turn On / Off

In this post we are going to discuss about Mimicrate To Indicator which helps when silent mode turn On/Off.

SPIndicator

Floating indicator, mimicrate to indicator which appear when silent mode turn on / off. Support large texts.

Installation

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

spm install preview

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 the dependency managers, you can integrate SPIndicator into your project manually. Put Sources/SPIndicator the folder in your Xcode project. Make sure to enable Copy items if needed and Create groups.

error preview

Quick Start

For the best experience, I recommend presenting alerts by calling the class functions SPIndicator. These functions are updated regularly and show the alerts 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)))
message-only-preview

For showing a simple text message:

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

You can provide message optional too.

Duration

For change duration of present time, create alert 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 alert for hide. While alert is dragging, dismiss not work. This can be disabled:

indicatorView.dismissByDrag = false

Haptic

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

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

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

GitHub

https://github.com/ivanvorobei/SPIndicator

Please comment and share this post and wants to improve WhatsApp us .

Default image
Lingaraj Senapati
Hey There! I am Lingaraj Senapati, the Co-founder of lingarajtechhub.com My skills are Freelance, Web Developer & Designer, Corporate Trainer, Digital Marketer & Youtuber.
Articles: 217

Newsletter Updates

Enter your email address below to subscribe to our newsletter

Leave a Reply