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.
		
		
		
		
		
			
		
			
	
	
		
			37 lines
		
	
	
		
			1000 B
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			37 lines
		
	
	
		
			1000 B
		
	
	
	
		
			Swift
		
	
| 
											7 years ago
										 | // | ||
|  | //  Copyright (c) 2019 Open Whisper Systems. All rights reserved. | ||
|  | // | ||
|  | 
 | ||
|  | import Foundation | ||
|  | 
 | ||
|  | extension UIAlertController { | ||
|  |     @objc | ||
|  |     public func applyAccessibilityIdentifiers() { | ||
|  |         for action in actions { | ||
|  |             guard let view = action.value(forKey: "__representer") as? UIView else { | ||
|  |                 owsFailDebug("Missing representer.") | ||
| 
											7 years ago
										 |                 continue | ||
| 
											7 years ago
										 |             } | ||
|  |             view.accessibilityIdentifier = action.accessibilityIdentifier | ||
|  |         } | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | // MARK: - | ||
|  | 
 | ||
|  | extension UIAlertAction { | ||
|  |     private struct AssociatedKeys { | ||
|  |         static var AccessibilityIdentifier = "ows_accessibilityIdentifier" | ||
|  |     } | ||
|  | 
 | ||
|  |     @objc | ||
|  |     public var accessibilityIdentifier: String? { | ||
|  |         get { | ||
|  |             return objc_getAssociatedObject(self, &AssociatedKeys.AccessibilityIdentifier) as? String | ||
|  |         } | ||
|  |         set { | ||
|  |             objc_setAssociatedObject(self, &AssociatedKeys.AccessibilityIdentifier, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) | ||
|  |         } | ||
|  |     } | ||
|  | } |