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
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			37 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Swift
		
	
| 
											5 years ago
										 | import SessionUIKit | ||
| 
											5 years ago
										 | 
 | ||
|  | @objc(LKViewControllerUtilities) | ||
|  | public final class ViewControllerUtilities : NSObject { | ||
|  | 
 | ||
|  |     private override init() { } | ||
|  | 
 | ||
| 
											5 years ago
										 |     @objc(setUpDefaultSessionStyleForVC:withTitle:customBackButton:) | ||
| 
											5 years ago
										 |     public static func setUpDefaultSessionStyle(for vc: UIViewController, title: String?, hasCustomBackButton: Bool) { | ||
| 
											5 years ago
										 |         // Set gradient background | ||
|  |         vc.view.backgroundColor = .clear | ||
|  |         let gradient = Gradients.defaultLokiBackground | ||
|  |         vc.view.setGradient(gradient) | ||
|  |         // Set navigation bar background color | ||
|  |         if let navigationBar = vc.navigationController?.navigationBar { | ||
|  |             navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default) | ||
|  |             navigationBar.shadowImage = UIImage() | ||
|  |             navigationBar.isTranslucent = false | ||
|  |             navigationBar.barTintColor = Colors.navigationBarBackground | ||
|  |         } | ||
|  |         // Customize title | ||
| 
											5 years ago
										 |         if let title = title { | ||
|  |             let titleLabel = UILabel() | ||
|  |             titleLabel.text = title | ||
|  |             titleLabel.textColor = Colors.text | ||
|  |             titleLabel.font = .boldSystemFont(ofSize: Values.veryLargeFontSize) | ||
|  |             vc.navigationItem.titleView = titleLabel | ||
|  |         } | ||
| 
											5 years ago
										 |         // Set up back button | ||
| 
											5 years ago
										 |         if hasCustomBackButton { | ||
|  |             let backButton = UIBarButtonItem(title: "Back", style: .plain, target: nil, action: nil) | ||
|  |             backButton.tintColor = Colors.text | ||
|  |             vc.navigationItem.backBarButtonItem = backButton | ||
|  |         } | ||
| 
											5 years ago
										 |     } | ||
|  | } |