mirror of
				https://github.com/yattee/yattee.git
				synced 2025-10-31 12:41:57 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			793 B
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			793 B
		
	
	
	
		
			Swift
		
	
	
	
	
	
| import Foundation
 | |
| import SwiftUI
 | |
| 
 | |
| struct ControlBackgroundModifier: ViewModifier {
 | |
|     var enabled = true
 | |
|     var edgesIgnoringSafeArea = Edge.Set()
 | |
| 
 | |
|     func body(content: Content) -> some View {
 | |
|         if enabled {
 | |
|             if #available(iOS 15, macOS 12, *) {
 | |
|                 content
 | |
|                     .background(.thinMaterial)
 | |
|             } else {
 | |
|                 content
 | |
|                 #if os(macOS)
 | |
|                 .background(VisualEffectBlur(material: .hudWindow))
 | |
|                 #elseif os(iOS)
 | |
|                 .background(VisualEffectBlur(blurStyle: .systemThinMaterial).edgesIgnoringSafeArea(edgesIgnoringSafeArea))
 | |
|                 #else
 | |
|                 .background(.thinMaterial)
 | |
|                 #endif
 | |
|             }
 | |
|         } else {
 | |
|             content
 | |
|         }
 | |
|     }
 | |
| }
 | 
