Skip to content

Commit 9544ec9

Browse files
committed
Added isLoading, a boolean value indicating whether the button is currently running its activity indicator animation.
1 parent e5d02c8 commit 9544ec9

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

Configs/PMSuperButton.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.1.0</string>
18+
<string>2.1.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

PMSuperButton.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "PMSuperButton"
3-
s.version = "2.1.0"
3+
s.version = "2.1.1"
44
s.summary = "PMSuperButton is a powerful UIButton coming from the countryside, but with super powers!"
55
s.description = <<-DESC
66
A easy way to create custom and complex buttons with custom attributes, directly added to the iOS Interface Builder, very easy to integrate in every project!

PMSuperButtonSample/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.1.0</string>
18+
<string>2.1.1</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
<key>LSRequiresIPhoneOS</key>

PMSuperButtonSample/ViewController.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ class ViewController: UIViewController {
2525
secondButton.touchUpInside {
2626
}
2727

28-
var isLoading = false
29-
thirdButton.touchUpInside {
30-
isLoading = !isLoading
31-
isLoading == true ? self.thirdButton.showLoader() : self.thirdButton.hideLoader()
28+
thirdButton.touchUpInside { [weak self] in
29+
self?.thirdButton.isLoading == false ? self?.thirdButton.showLoader() : self?.thirdButton.hideLoader()
3230
}
3331
}
3432

Sources/PMSuperButton.swift

+5
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ open class PMSuperButton: UIButton {
189189

190190
//MARK: - Loading
191191
let indicator: UIActivityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray)
192+
public var isLoading: Bool{
193+
get{
194+
return indicator.isAnimating
195+
}
196+
}
192197

193198
/**
194199
Show a loader inside the button, and enable or disable user interection while loading

0 commit comments

Comments
 (0)