mirror of
				https://github.com/maxgoedjen/secretive.git
				synced 2025-10-31 23:40:57 +00:00 
			
		
		
		
	* Integrations to window * Cleanup of presenting. * Older name for copy * For copyable view too
		
			
				
	
	
		
			33 lines
		
	
	
		
			637 B
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			637 B
		
	
	
	
		
			Swift
		
	
	
	
	
	
| import SwiftUI
 | |
| 
 | |
| struct BoxBackgroundModifier: ViewModifier {
 | |
| 
 | |
|     let color: Color
 | |
| 
 | |
|     func body(content: Content) -> some View {
 | |
|         content
 | |
|             .background {
 | |
|                 RoundedRectangle(cornerRadius: 5)
 | |
|                     .fill(color.opacity(0.3))
 | |
|                     .stroke(color, lineWidth: 1)
 | |
|             }
 | |
|     }
 | |
| }
 | |
| 
 | |
| extension View {
 | |
| 
 | |
|     func boxBackground(color: Color) -> some View {
 | |
|         modifier(BoxBackgroundModifier(color: color))
 | |
|     }
 | |
| 
 | |
| }
 | |
| 
 | |
| #Preview {
 | |
|     Text("Hello")
 | |
|         .boxBackground(color: .red)
 | |
|         .padding()
 | |
|     Text("Hello")
 | |
|         .boxBackground(color: .orange)
 | |
|         .padding()
 | |
| }
 |