From b4da627720cfb0911044635f2caee83e21cb23c3 Mon Sep 17 00:00:00 2001 From: takasek Date: Sat, 27 Jan 2018 02:52:12 +0900 Subject: [PATCH] :sparkles: Add UIBarButtonItem.init(barButtonSystemIcon:closure:) --- ActionClosurable/Extensions.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ActionClosurable/Extensions.swift b/ActionClosurable/Extensions.swift index 14ffbd3..2d29bd0 100644 --- a/ActionClosurable/Extensions.swift +++ b/ActionClosurable/Extensions.swift @@ -50,6 +50,10 @@ extension ActionClosurable where Self: UIBarButtonItem { self.style = style self.onTap(closure) } + public init(barButtonSystemItem: UIBarButtonSystemItem, closure: @escaping (Self) -> Void) { + self.init(barButtonSystemItem: barButtonSystemItem, target: nil, action: nil) + self.onTap(closure) + } public func onTap(_ closure: @escaping (Self) -> Void) { convert(closure: closure, toConfiguration: { self.target = $0