Add source code
This commit is contained in:
parent
69c08de01c
commit
0416d157d7
14 changed files with 1672 additions and 0 deletions
46
TetheringHider/Views/GlassModifiers.swift
Normal file
46
TetheringHider/Views/GlassModifiers.swift
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import SwiftUI
|
||||
|
||||
struct GlassCardModifier: ViewModifier {
|
||||
let tintColor: Color
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
if #available(macOS 26, *) {
|
||||
content
|
||||
.glassEffect(.regular.tint(tintColor.opacity(0.15)), in: .rect(cornerRadius: 16))
|
||||
} else {
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct GlassButtonModifier: ViewModifier {
|
||||
var isActive: Bool = false
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
if #available(macOS 26, *) {
|
||||
content
|
||||
.buttonStyle(.glassProminent)
|
||||
} else {
|
||||
content
|
||||
.buttonStyle(.borderedProminent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct GlassInteractiveModifier: ViewModifier {
|
||||
var cornerRadius: CGFloat = 20
|
||||
var tintColor: Color = .clear
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
if #available(macOS 26, *) {
|
||||
content
|
||||
.glassEffect(
|
||||
.regular.tint(tintColor.opacity(0.1)).interactive(),
|
||||
in: .rect(cornerRadius: cornerRadius)
|
||||
)
|
||||
} else {
|
||||
content
|
||||
.background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: cornerRadius))
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue