From 07810945450c4a267700f179fad8daec9ac88323 Mon Sep 17 00:00:00 2001 From: Dominic Egginton Date: Sun, 26 May 2019 01:52:00 +0100 Subject: [PATCH] updated public stop function to make it easier to understand --- Sources/Spinner/Spinner.swift | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Sources/Spinner/Spinner.swift b/Sources/Spinner/Spinner.swift index d3642a1..562df91 100644 --- a/Sources/Spinner/Spinner.swift +++ b/Sources/Spinner/Spinner.swift @@ -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) } /**