Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SimformSolutionsPvtLtd/SSSwiftUISpinnerButton
SSSwiftUISpinnerButton is a collection of various spinning animations for buttons in SwiftUI.
https://github.com/SimformSolutionsPvtLtd/SSSwiftUISpinnerButton
animations button cocoapods custombutton ios loader loading loading-animations loading-indicator loading-spinner loadingbutton spinner-animations swiftui
Last synced: 3 months ago
JSON representation
SSSwiftUISpinnerButton is a collection of various spinning animations for buttons in SwiftUI.
- Host: GitHub
- URL: https://github.com/SimformSolutionsPvtLtd/SSSwiftUISpinnerButton
- Owner: SimformSolutionsPvtLtd
- License: mit
- Created: 2021-02-09T17:26:15.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-02T11:02:08.000Z (over 3 years ago)
- Last Synced: 2024-07-23T22:03:54.232Z (6 months ago)
- Topics: animations, button, cocoapods, custombutton, ios, loader, loading, loading-animations, loading-indicator, loading-spinner, loadingbutton, spinner-animations, swiftui
- Language: Swift
- Homepage: https://github.com/SimformSolutionsPvtLtd/SSSwiftUISpinnerButton
- Size: 667 KB
- Stars: 43
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-SS-Mobile - SSSwiftUISpinnerButton - SSSwiftUISpinnerButton is an open-source library in SwiftUI to add different spinning animation to button. (iOS Guides / SwiftUI)
README
# SSSwiftUISpinnerButton
SSSwiftUISpinnerButton is an open-source library in SwiftUI to add different spinning animation to button.
[![Platform][platform-image]][platform-url]
[![swiftUI](https://img.shields.io/badge/-swiftUI-blue)](https://developer.apple.com/documentation/swiftui)
[![Swift Version][swift-image]][swift-url]
[![License][license-image]][license-url]
[![PRs Welcome][PR-image]][PR-url]![Alt text](https://github.com/mobile-simformsolutions/SSSwiftUISpinnerButton/blob/main/SSSwiftUISpinnerButton.gif?raw=true)
# Features!
- Various spinner animation styles
- Rounded button on spinning animation# Requirements
- iOS 13.0+
- Xcode 11+# Installation
#### CocoaPods
- You can use CocoaPods to install `SSSwiftUISpinnerButton` by adding it to your Podfile:use_frameworks!
pod 'SSSwiftUISpinnerButton'- Import SSSwiftUISpinnerButton in your file:
import SSSwiftUISpinnerButton
**Manually**
- Download and drop **SSSwiftUISpinnerButton/Sources** folder in your project.
- Congratulations!#### Swift Package Manager
- When using Xcode 11 or later, you can install `SSSwiftUISpinnerButton` by going to your Project settings > `Swift Packages` and add the repository by providing the GitHub URL. Alternatively, you can go to `File` > `Swift Packages` > `Add Package Dependencies...`dependencies: [
.package(url: "https://github.com/mobile-simformsolutions/SSSwiftUISpinnerButton.git", from: "1.0.0")
]# Usage Examples
**Add Spinner Button**
- Add state variable to manage spinner button start and stop animation@State var isSpinnerButtonAnimating: Bool = false
- Add Spinner button:
SpinnerButton(buttonAction: {
// Your button action code here
}, isAnimating: $isSpinnerButtonAnimating, builder: {
// Add any view or content in button if required
HStack {
Text("Save")
.foregroundColor(.white)
}
}
)**Start Animation**
- Animation will start as soon as you will tap on the button (`isSpinnerButtonAnimating` state variable will be set true).
**Stop Animation**
- To stop the spinner button animation, simply toggle the state variable `isSpinnerButtonAnimating` value.isSpinnerButtonAnimating.toggle()
**Spinner button animation style**
- You can select from different animation styles
- Every animation style has properties such as count, size, etc which can be modified.SpinnerButton(buttonAction: {
/// Action to perform
}, isAnimating: $isSpinnerButtonAnimating,
animationType: SpinnerButtonAnimationStyle.lineSpinFade(count: 8, width: 0)) {
/// Add content in button
}
**Spinner button customisation**
- You can modify view of the spinner button using `SpinnerButtonViewStyle`
- Initialise variable with type `SpinnerButtonViewStyle` to design button:
private var buttonStyleWithBasicDesign: SpinnerButtonViewStyle = SpinnerButtonViewStyle(
width: 300,
height: 50,
cornerRadius: 5,
backgroundColor: .black,
spinningButtonBackgroundColor: .black,
spinningStrokeColor: .white
)- Assign it to `buttonstyle`:
SpinnerButton(buttonAction: {
/// Action to perform
}, isAnimating: $isSpinnerButtonAnimating,
buttonStyle: buttonStyleWithBasicDesign,
animationType: SpinnerButtonAnimationStyle.lineSpinFade(count: 8, width: 0)) {
/// Add content in button
}# Swift Library:
- Check out our Swift Library for Spinner Button - [SSSpinnerButton](https://github.com/SimformSolutionsPvtLtd/SSSpinnerButton)# Meta
- Distributed under the MIT license. See LICENSE for more information.# Inspired By:
- Spinner animations inspired from [iActivityIndicator](https://github.com/MojtabaHs/iActivityIndicator)[swift-image]:https://img.shields.io/badge/swift-5.0-orange.svg
[swift-url]: https://swift.org/
[license-image]: https://img.shields.io/badge/License-MIT-blue.svg
[license-url]: LICENSE
[platform-image]:https://img.shields.io/cocoapods/p/LFAlertController.svg?style=flat
[platform-url]:https://github.com/mobile-simformsolutions/SSSwiftUISpinnerButton
[PR-image]:https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[PR-url]:http://makeapullrequest.com