Skip to content

Commit

Permalink
Added isLoading, a boolean value indicating whether the button is cur…
Browse files Browse the repository at this point in the history
…rently running its activity indicator animation.
  • Loading branch information
pmusolino committed Jun 5, 2018
1 parent e5d02c8 commit 9544ec9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Configs/PMSuperButton.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.1.0</string>
<string>2.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion PMSuperButton.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "PMSuperButton"
s.version = "2.1.0"
s.version = "2.1.1"
s.summary = "PMSuperButton is a powerful UIButton coming from the countryside, but with super powers!"
s.description = <<-DESC
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!
Expand Down
2 changes: 1 addition & 1 deletion PMSuperButtonSample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1.0</string>
<string>2.1.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
6 changes: 2 additions & 4 deletions PMSuperButtonSample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ class ViewController: UIViewController {
secondButton.touchUpInside {
}

var isLoading = false
thirdButton.touchUpInside {
isLoading = !isLoading
isLoading == true ? self.thirdButton.showLoader() : self.thirdButton.hideLoader()
thirdButton.touchUpInside { [weak self] in
self?.thirdButton.isLoading == false ? self?.thirdButton.showLoader() : self?.thirdButton.hideLoader()
}
}

Expand Down
5 changes: 5 additions & 0 deletions Sources/PMSuperButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ open class PMSuperButton: UIButton {

//MARK: - Loading
let indicator: UIActivityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray)
public var isLoading: Bool{
get{
return indicator.isAnimating
}
}

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

0 comments on commit 9544ec9

Please sign in to comment.