@@ -89,6 +89,13 @@ public class SpinnerView: NSObject, Spinner {
8989 return view
9090 }
9191
92+ /**
93+ To dismiss the currently displayed indicator.
94+ The views interaction will then be enabled depending on the parameter boolean
95+ If shown in a button the titles text will become visible
96+
97+ - Parameter enablesUserInteraction: A boolean that specifies if the user interaction on the view should be enabled when the spinner is dismissed
98+ */
9299 public func dismiss( enablesUserInteraction: Bool = false ) {
93100 if let button = spinner? . superview as? UIButton {
94101 button. restoreTitleColors ( controlTitleColors)
@@ -203,6 +210,7 @@ extension UIImageView: Spinner {
203210
204211private extension UIButton {
205212
213+ // Extension to return an array of every color for every button state
206214 private func allTitleColors( ) -> [ ControlTitleColor ] {
207215 var colors : [ ControlTitleColor ] = [
208216 ( . Normal, titleColorForState ( . Normal) ) ,
@@ -220,13 +228,21 @@ private extension UIButton {
220228 return colors
221229 }
222230
231+ /**
232+ Function to set the buttons title colors to specific button states passed in the array parameter
233+
234+ - Parameter colors: An array of ControlTitleColor each containing a UIControlState and a UIColor
235+ */
223236 private func restoreTitleColors( colors: [ ControlTitleColor ] ? ) {
224237 guard let colors = colors else { return }
225238 for color in colors {
226239 setTitleColor ( color. 1 , forState: color. 0 )
227240 }
228241 }
229242
243+ /**
244+ Sets all the the buttons title colors to clear
245+ */
230246 private func removeAllTitleColors( ) {
231247 restoreTitleColors ( allTitleColors ( ) . map ( { return ( $0. 0 , UIColor . clearColor ( ) ) } ) )
232248 }
0 commit comments