-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from mobile-simformsolutions/feature/Add_gif_an…
…d_readme_file Add gif and readme file
- Loading branch information
Showing
9 changed files
with
272 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Simform Solutions | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,119 @@ | ||
# SSSwiftUISpinnerButton | ||
<a href="https://www.simform.com/"><img src="https://github.com/mobile-simformsolutions/SSSwiftUISpinnerButton/blob/master/simformBanner.png"></a> | ||
|
||
# SSSwiftUISpinnerButton | ||
|
||
|
||
SSSwiftUISpinnerButton is a 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/simformsolutions/SSSwiftUISpinnerButton/blob/master/SSSwiftUISpinnerButton.gif?raw=true) | ||
|
||
# Features! | ||
- Various spinner animation styles | ||
- Rounded button on spinning animation | ||
- CocoaPods | ||
|
||
# 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/SpinnerButton** folder in your project. | ||
- Congratulations! | ||
|
||
# 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, simple toggle the state variable `isSpinnerButtonAnimating` value. | ||
|
||
isSpinnerButtonAnimating.toggle() | ||
|
||
**Spinner button animation style** | ||
- You can select from different animation styles | ||
- Every animation style have properties such as count, size 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 | ||
- 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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ Pod::Spec.new do |spec| | |
spec.summary = "Button with different spinner animation styles." | ||
spec.description = "SpinnerButton is a custom button with different spinner animation styles." | ||
spec.homepage = "https://github.com/mobile-simformsolutions/SSSwiftUISpinnerButton" | ||
#spec.license = { :type => "MIT", :file => "LICENSE" } | ||
spec.license = { :type => "MIT", :file => "LICENSE" } | ||
spec.author = { "Chaitali Lad" => "[email protected]" } | ||
spec.platform = :ios | ||
spec.ios.deployment_target = "13.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.