Skip to content

Commit

Permalink
override addAction method from super class and hardcoded the preferre…
Browse files Browse the repository at this point in the history
…dAction argument to be false because its applicable to alerts only
  • Loading branch information
Ahmed Onawale committed Nov 9, 2015
1 parent c25c587 commit d9208f2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Pod/Classes/LKAlertController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,18 @@ public class ActionSheet: LKAlertController {
- parameter style: Style of the button (.Default, .Cancel, .Destructive)
- parameter handler: Closure to call when the button is pressed
*/
public func addAction(title: String, style: UIAlertActionStyle, handler: ((UIAlertAction!) -> Void)?) -> ActionSheet {
return addAction(title, style: style, handler: handler, preferredAction: false)
}

/**
Add a new button to the action sheet.
- parameter title: Title of the button
- parameter style: Style of the button (.Default, .Cancel, .Destructive)
- parameter handler: Closure to call when the button is pressed
- parameter preferredAction: We hardcode this argument as 'false' because the preferred action is relevant for the UIAlertControllerStyleAlert style only; it is not used by action sheets.
*/
public override func addAction(title: String, style: UIAlertActionStyle, handler: ((UIAlertAction!) -> Void)?, preferredAction:Bool) -> ActionSheet {
return super.addAction(title, style: style, handler: handler, preferredAction: false) as! ActionSheet
}
Expand Down

0 comments on commit d9208f2

Please sign in to comment.