@@ -32,44 +32,47 @@ public class SpinnerView: NSObject, Spinner {
3232
3333 /**
3434 To display the indicator centered in a view.
35-
35+
3636 - Parameter view: The view to display the indicator in.
3737 - Parameter style: A constant that specifies the style of the object to be created.
38-
38+ - Parameter color: A UIColor that specifies the tint of the spinner
39+
3940 - Returns: A reference to the Spinner that was created, so that it can be dismissed as needed.
4041 */
41- public static func showSpinnerInView( view: UIView , style: UIActivityIndicatorViewStyle = . White) -> Spinner {
42+ public static func showSpinnerInView( view: UIView , style: UIActivityIndicatorViewStyle = . White, color : UIColor ? = nil ) -> Spinner {
4243 let center = CGPointMake ( view. bounds. size. width/ 2 , view. bounds. size. height/ 2 )
4344 let spinner = UIActivityIndicatorView ( activityIndicatorStyle: style)
44-
45+
46+ spinner. color = color
4547 spinner. center = center
4648 spinner. autoresizingMask = [ . FlexibleTopMargin, . FlexibleLeftMargin, . FlexibleRightMargin, . FlexibleBottomMargin]
47-
49+
4850 spinner. startAnimating ( )
4951 view. addSubview ( spinner)
50-
52+
5153 let view = SpinnerView ( )
5254 view. spinner = spinner
5355 return view
5456 }
55-
57+
5658 /**
5759 To display the indicator centered in a button.
5860 The button's titleLabel colors will be set to clear color while the indicator is shown.
59-
61+
6062 - Parameter button: The button to display the indicator in.
6163 - Parameter style: A constant that specifies the style of the object to be created.
62-
64+ - Parameter color: A UIColor that specifies the tint of the spinner
65+
6366 - Returns: A reference to the Spinner that was created, so that it can be dismissed as needed.
6467 */
65- public static func showSpinnerInButton( button: UIButton , style: UIActivityIndicatorViewStyle = . White) -> Spinner {
66- let view = showSpinnerInView ( button, style: style)
67-
68+ public static func showSpinnerInButton( button: UIButton , style: UIActivityIndicatorViewStyle = . White, color : UIColor ? = nil ) -> Spinner {
69+ let view = showSpinnerInView ( button, style: style, color : color )
70+
6871 if let spinnerView = view as? SpinnerView {
6972 spinnerView. controlTitleColors = button. allTitleColors ( )
7073 button. removeAllTitleColors ( )
7174 }
72-
75+
7376 return view
7477 }
7578
0 commit comments