Skip to content

Commit

Permalink
Merge pull request #131 from zidaneno5/master
Browse files Browse the repository at this point in the history
- Resolve retain cycle in setActionTappedHandler
- Fix a bug when adding an action with "enabled = false" - the titleLabel is still enabled
  • Loading branch information
sberrevoets committed Dec 15, 2015
2 parents 7737828 + 6f7e591 commit 98b1dde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Source/Actions/AlertAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,7 @@ public class AlertAction: NSObject {
didSet { self.actionView?.enabled = self.enabled }
}

var actionView: ActionCell?
var actionView: ActionCell? {
didSet { self.actionView?.enabled = self.enabled }
}
}
6 changes: 3 additions & 3 deletions Source/AlertController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ public class AlertController: UIViewController {

self.alertView.prepareLayout()

self.alertView.setActionTappedHandler { action in
guard self.shouldDismissHandler?(action) != false else { return }
self.presentingViewController?.dismissViewControllerAnimated(true) {
self.alertView.setActionTappedHandler { [weak self] action in
guard self?.shouldDismissHandler?(action) != false else { return }
self?.presentingViewController?.dismissViewControllerAnimated(true) {
action.handler?(action)
}
}
Expand Down

0 comments on commit 98b1dde

Please sign in to comment.