mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			35 lines
		
	
	
		
			852 B
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			35 lines
		
	
	
		
			852 B
		
	
	
	
		
			Swift
		
	
| 
											8 years ago
										 | // | ||
|  | //  Copyright (c) 2018 Open Whisper Systems. All rights reserved. | ||
|  | // | ||
|  | 
 | ||
|  | import Foundation | ||
|  | 
 | ||
| 
											8 years ago
										 | @objc | ||
| 
											8 years ago
										 | public class TappableStackView: UIStackView { | ||
|  |     let actionBlock : (() -> Void) | ||
|  | 
 | ||
|  |     // MARK: - Initializers | ||
|  | 
 | ||
|  |     @available(*, unavailable, message: "use other constructor instead.") | ||
|  |     public required init(coder aDecoder: NSCoder) { | ||
| 
											7 years ago
										 |         notImplemented() | ||
| 
											8 years ago
										 |     } | ||
|  | 
 | ||
|  |     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))) | ||
|  |     } | ||
|  | 
 | ||
| 
											8 years ago
										 |     @objc func wasTapped(sender: UIGestureRecognizer) { | ||
| 
											7 years ago
										 |         Logger.info("") | ||
| 
											8 years ago
										 | 
 | ||
|  |         guard sender.state == .recognized else { | ||
|  |             return | ||
|  |         } | ||
|  |         actionBlock() | ||
|  |     } | ||
|  | } |