Skip to content

Commit

Permalink
updated public stop function to make it easier to understand
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicegginton committed May 26, 2019
1 parent fd577b7 commit 0781094
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions Sources/Spinner/Spinner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,13 @@ public final class Spinner {

/**
Stops the animation for the spinner.

- Parameter finalFrame: The persistant frame that will be dispalyed on the compleed spinner, defult is 'nil' this will keep the current frame the spinner is on
- Parameter text: The persistant text that will be dispalyed on the compleed spinner, defult is 'nil' this will keep the current text the spinner has
- Parameter terminator: The terminator used for ending writing a line to the terminal, defult is '\n' this will return the curser to a new line
*/
public func stop(completionFrame: String, text: String? = nil, terminator: String = "\n") {
if let text = text {
setText(text)
}
let finalPattern: SpinnerPattern = SpinnerPattern(singleFrame: completionFrame)
self.text += Array(repeating: " ", count: self.getPatternPadding(finalPattern))
self.pattern = finalPattern
self.running = false
self.unhideCursor()
self.renderSpinner()
print(terminator: terminator)
public func stop(finalFrame: String? = nil, text: String? = nil, terminator: String = "\n") {
self.stopSpinner(finalFrame: finalFrame, text: text, terminator: terminator)
}

/**
Expand Down

0 comments on commit 0781094

Please sign in to comment.