Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
github.com/DholStudio/DSGradientProgressView
DSGradientProgressView
is a simple and customizable animated progress bar written in Swift.
Inspired by GradientProgressView.
The gif looks flickery, but the actual animation on device will not be.
Simply drop a UIView
into your View Controller in the Storyboard. Select your view and, in the Identity Inspector
, change the class to DSGradientProgressView
.
Don't forget to change the module to
DSGradientProgressView
too.
Size the view according to your needs. (A 3px height looks great in most cases).
Import DSGradientProgressView
in your view controller source file.
import DSGradientProgressView
Create an IBOutlet
of the view in your view controller source file.
@IBOutlet weak var progressView: DSGradientProgressView!
You can change the base color of the progress bar. There are two ways to do this:
barColor
property of the view object in your source file.progressView.barColor = UIColor.green
DSGradientProgressView
is designed to keep track of the number of requests waiting for completion. Hence the api's are named after semaphore method names. You call the wait()
method of the DSGradientProgressView
to start animating and signal()
method to stop. It hides and un-hides itself accordingly.
progressView.wait()
// waiting for some resource
progressView.signal()
So, if your View Controller is waiting for more than one network request (or any other resource) and you want the Progress Bar to animate until all the requests are over, you can do that by simply calling wait()
that number of times. Later, call signal()
the same number of times.
progressView.wait()
// waiting for some resource asynchronously
ResourceOne.sharedInstance.fetchData { (data, error) in
self.progressView.signal()
}
progressView.wait()
// waiting for another resource asynchronously
ResourceTwo.sharedInstance.fetchData { (data, error) in
self.progressView.signal()
}
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
CocoaPods 1.1.0+ is required to build DSGradientProgressView 1.0.0+.
To integrate DSGradientProgressView into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'DSGradientProgressView'
end
Then, run the following command:
$ pod install
Copy the DSGradientProgressView.swift
to your Xcode project. That should do it.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.