This package contains a bundle of Indicators purely written in SwiftUI.
To get started, add the package dependency via the Swift package manager. Therefore, open your project in Xcode. In the menu select File>Swift Packages>Add Dependency.
Then search for Indicators and choose SwiftUI-Indicators from Connapptivity.
Now choose the version you want to add and the target and click Finish to import the package. Finally you should see it in the project navigator under Swift Pakckage Dependencies.
Alternatively, you can use cocoapods. Just add
pod 'Indicators'
to your podfile.
For using Indicators in your code just add the import Indicators
statement at the top of your swift code file.
This package contains six indicator types and seven different indicators. Available indicators are
Success indicators:
SuccessIndcator()
Failure indicators:
FailureIndcator()
Info indicators:
InfoIndcator()
Waiting Indcators:
CircularWaitingIndcator()
LinearWaitingIndcator()
Progress indcators:
CircularProgressIndcator()
LinearProgressIndcator()
Every indicator can be customized in several ways:
Indicator()
// Set a custom foregroundcolor.
.foregoundColor(Color?)
// Set a custom linewidth.
.lineWidth(Double)
// Set the animation pace of the indicator.
.pace(Double)
// Set if indicator changes should be animated. The default value is true.
.animated(Bool = true)
// Set your custom animation to the indicator
.animation(Animation?)
The waiting and progress indicators can be additionally customized. To check out these options have a look at the documentation below.
You have the possibility to show text with waiting and progress indicators. The text can be declared directly in the initializer:
WaitingIndicator(Double, text: String?)
ProgressIndicator(Double, text: String?)
With circular indicators the text resizes automatically according to the size of the indicator. The indicator always trys to show the whole text and prevent coverage.
With linear indicators the text does not resize automatically. Here you can adjust the font according to your needs.
LinearIndicator()
.font(Font?)
The indicators bottom is aligned to the text base, so the design looks always good.
To give users a intuitive feeling of how much a process is progressed in relation to the whole, progress indicators have a background stroke. You can change the stroke color or set it to clear, if you do not want a background stroke.
ProgressIndicator()
.backgroundColor(Color?)
You can also create your custom Indicator by implementing the Indicator protocol.
struct CustomIndicator: Indicator { ...
This package is public, because everybody who wants to contribute should be able to do so. And we belive nothing is as powerful as community development. So, feel free to fork and add your code to this package.