_I recommend reviewing this with whitespace changes disabled._ Most of these were `@objc` being on the same line, which I fixed with [a silly script][1]—probably could've used `sed` if I were wiser. The rest were manual fixes. See [the SwiftLint documentation for this rule][0]. [0]: https://realm.github.io/SwiftLint/attributes.html [1]: https://gist.github.com/EvanHahn-Signal/d353c93fa269c82b96baca0a1086521f
36 lines
891 B
Swift
36 lines
891 B
Swift
//
|
|
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
@objc
|
|
public class TappableStackView: UIStackView {
|
|
let actionBlock : (() -> Void)
|
|
|
|
// MARK: - Initializers
|
|
|
|
@available(*, unavailable, message: "use other constructor instead.")
|
|
public required init(coder aDecoder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
|
|
public required init(actionBlock : @escaping () -> Void) {
|
|
self.actionBlock = actionBlock
|
|
super.init(frame: CGRect.zero)
|
|
|
|
self.isUserInteractionEnabled = true
|
|
self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(wasTapped)))
|
|
}
|
|
|
|
@objc
|
|
func wasTapped(sender: UIGestureRecognizer) {
|
|
Logger.info("")
|
|
|
|
guard sender.state == .recognized else {
|
|
return
|
|
}
|
|
actionBlock()
|
|
}
|
|
}
|