Skip to content

Commit

Permalink
Merge pull request #6 from mobile-simformsolutions/feature/Add_gif_an…
Browse files Browse the repository at this point in the history
…d_readme_file

Add gif and readme file
  • Loading branch information
bhargavbajani-simformsolutions authored Jul 1, 2021
2 parents 64dc3d2 + c7c8f35 commit 2db9f5a
Show file tree
Hide file tree
Showing 9 changed files with 272 additions and 61 deletions.
21 changes: 21 additions & 0 deletions LICENSE
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.
120 changes: 119 additions & 1 deletion README.md
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
Binary file added SSSwiftUISpinnerButton.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion SSSwiftUISpinnerButton.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 16 additions & 0 deletions SSSwiftUISpinnerButton.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
AA2A4948268CC92B00189154 /* Color+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2A4947268CC92A00189154 /* Color+Extension.swift */; };
AA2A494A268CC97400189154 /* Enumerations.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2A4949268CC97400189154 /* Enumerations.swift */; };
AA851B1526368C2900BF3B11 /* SSSwiftUISpinnerButtonApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA851B1426368C2900BF3B11 /* SSSwiftUISpinnerButtonApp.swift */; };
AABAAF93268B510F009D2275 /* SpinnerButtonAnimationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AABAAF8B268B510F009D2275 /* SpinnerButtonAnimationView.swift */; };
AABAAF94268B510F009D2275 /* SpinnerButtonViewStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = AABAAF8C268B510F009D2275 /* SpinnerButtonViewStyle.swift */; };
Expand Down Expand Up @@ -34,6 +36,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
AA2A4947268CC92A00189154 /* Color+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Extension.swift"; sourceTree = "<group>"; };
AA2A4949268CC97400189154 /* Enumerations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Enumerations.swift; sourceTree = "<group>"; };
AA851B1426368C2900BF3B11 /* SSSwiftUISpinnerButtonApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SSSwiftUISpinnerButtonApp.swift; path = SSSwiftUISpinnerButton/SSSwiftUISpinnerButtonApp.swift; sourceTree = SOURCE_ROOT; };
AABAAF8B268B510F009D2275 /* SpinnerButtonAnimationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpinnerButtonAnimationView.swift; sourceTree = "<group>"; };
AABAAF8C268B510F009D2275 /* SpinnerButtonViewStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpinnerButtonViewStyle.swift; sourceTree = "<group>"; };
Expand All @@ -60,6 +64,15 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
AA2A494B268CC97C00189154 /* HelperClass */ = {
isa = PBXGroup;
children = (
AA2A4947268CC92A00189154 /* Color+Extension.swift */,
AA2A4949268CC97400189154 /* Enumerations.swift */,
);
path = HelperClass;
sourceTree = "<group>";
};
AABAAF8A268B510F009D2275 /* SpinnerButton */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -102,6 +115,7 @@
C2FE74B725D6DABF005B5998 /* SSSwiftUISpinnerButton */ = {
isa = PBXGroup;
children = (
AA2A494B268CC97C00189154 /* HelperClass */,
C2FE74BA25D6DABF005B5998 /* ContentView.swift */,
AA851B1426368C2900BF3B11 /* SSSwiftUISpinnerButtonApp.swift */,
C2FE74BC25D6DAC0005B5998 /* Assets.xcassets */,
Expand Down Expand Up @@ -190,6 +204,7 @@
buildActionMask = 2147483647;
files = (
AABAAF98268B510F009D2275 /* LineSpinFadeAnimation.swift in Sources */,
AA2A4948268CC92B00189154 /* Color+Extension.swift in Sources */,
C2FE74BB25D6DABF005B5998 /* ContentView.swift in Sources */,
AABAAF99268B510F009D2275 /* SpinnerButton.swift in Sources */,
AA851B1526368C2900BF3B11 /* SSSwiftUISpinnerButtonApp.swift in Sources */,
Expand All @@ -198,6 +213,7 @@
AABAAF97268B510F009D2275 /* BallSpinChaseAnimation.swift in Sources */,
AABAAF95268B510F009D2275 /* BallRotateFadeAnimation.swift in Sources */,
AABAAF93268B510F009D2275 /* SpinnerButtonAnimationView.swift in Sources */,
AA2A494A268CC97400189154 /* Enumerations.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading

0 comments on commit 2db9f5a

Please sign in to comment.