Skip to content

Commit

Permalink
Merge pull request #28 from dominicegginton:release/1.1.4
Browse files Browse the repository at this point in the history
release/1.1.4
  • Loading branch information
dominicegginton authored Feb 29, 2020
2 parents df52a63 + dc5b85b commit 8d1e008
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tesing.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Testing
name: Unit Testing

on: [push, pull_request]
on: [push]

jobs:
test:
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</p>

## Key Features
- Over ****60**** built in animations 🤩
- Built in completion functions (Success, Failure, Warning, Information) ✔
- Over ****60**** built-in animations 🤩
- Built-in completion functions (Success, Failure, Warning, Information) ✔
- Easily create your own custom Spinner animations
- Use color to make your Spinners stand out 🎨
- Supports custom formats to make your the spinners truly work for your project 📐
Expand All @@ -24,7 +24,7 @@
To install within your Swift project add the GitHub url to your `Package.swift` file as a dependency.
[**Swift Package Manger**](https://swift.org/package-manager/) will sort everything out for you when you run `swift build` 💪
``` swift
.package(url: "https://github.com/dominicegginton/Spinner", from: "1.1.3")
.package(url: "https://github.com/dominicegginton/Spinner", from: "1.1.4")
```

## Getting Started
Expand All @@ -42,14 +42,18 @@ Updating the user with a completion type can be useful for example:
``` swift
mySpinner.succeed("Task Completed")
```

## Example Project
Take a look at the [example project](https://github.com/dominicegginton/Spinner/tree/master/example) included 👀

## Documentation 📚

#### Creating a Spinner
To create a spinner, initialize and instance of the `Spinner` class. The initializer takes the following arguments:
To create a spinner, initialize an instance of the `Spinner` class. The initializer takes the following arguments:
- `pattern: SpinnerPattern` The pattern that the spinner will display
- `text: String` The text that will displayed next to the spinner
- `text: String` The text that will be displayed next to the spinner
- `speed: Double` The speed the animation
- `color: Color` The color of the spinner - default is
- `color: Color` The color of the spinner
- `format: String` The format of the spinner

``` swift
Expand All @@ -68,7 +72,7 @@ While the spinner is still going you may want to update its properties. to do th
- `.updateColor(Color)` Updates the colors of the animated pattern
- `.updateFormat(String)` Updates the format of the spinner
#### Stopping the Spinner
To stop a spinner from animating call the `.stop()` function on its instance, this will stop the animation on the current frame, return to a new line along with re enabling the curser. The `.stop()` function also takes arguments to allow for a final update of the spinner, this can be extremely usefully:
To stop a spinner from animating call the `.stop()` function on its instance, this will stop the animation on the current frame, return to a new line along with re-enabling the curser. The `.stop()` function also takes arguments to allow for a final update of the spinner, this can be extremely usefully:
- `finalFrame: String` The final frame the Spinner will display
- `text: String` The text displayed by the Spinner once stopped
- `color: Color` The color the Spinner will display the pattern in
Expand Down
2 changes: 1 addition & 1 deletion Sources/Spinner/Spinner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class Spinner {
- Parameter color: Color - The color the animated pattern will render as - default is white
- Parameter: format: String - The format of the spinner - default is "{S} {T}"
*/
public init(_ pattern: SpinnerPattern, _ text: String = "", speed: Double? = nil, color: Color = .white, format: String = "{S} {T}") {
public init(_ pattern: SpinnerPattern, _ text: String = "", speed: Double? = nil, color: Color = .default, format: String = "{S} {T}") {
self.pattern = pattern
self.text = text
self.speed = speed ?? pattern.defaultSpeed
Expand Down
20 changes: 20 additions & 0 deletions example/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "example",
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "../", from: "1.1.4")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "example",
dependencies: ["Spinner"])
]
)
18 changes: 18 additions & 0 deletions example/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Swift CLI Spinners - Example Project

> A simple example project for the [Swift CLI Spinner](https://github.com/dominicegginton/spinner) project
## Getting Started
Install by cloning the [Swift CLI Spinners Repo](https://github.com/dominicegginton/spinner):
``` shell
git clone https://github.com/dominicegginton/Spinner.git
```
Next navigate to the example directory
``` shell
cd Spinner/example
```
Feel free to take a look at [main.swift](https://github.com/dominicegginton/Spinner/blob/master/example/Sources/example.main.swift) 👀, to run build and run the example simply:
``` shell
swift build
swift run
```
8 changes: 8 additions & 0 deletions example/Sources/example/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Foundation
import Spinner
import Rainbow

let mySpinner = Spinner(.dots, "My Spinner", color: .blue)
mySpinner.start()
sleep(2)
mySpinner.stop()

0 comments on commit 8d1e008

Please sign in to comment.