File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8080 Samples/Basic.swift,
8181 Samples/GlassFlower.swift,
8282 Samples/GlassFlowerRotate.swift,
83+ Samples/Input.swift,
8384 );
8485 target = 3A80CECB2DB4C144006BDD0A /* Watch Watch App */;
8586 };
Original file line number Diff line number Diff line change 1+ //
2+ // Input.swift
3+ // Demo
4+ //
5+ // Created by Ming on 21/4/2025.
6+ //
7+
8+ import SwiftUI
9+ import SwiftGlass
10+
11+ struct Input : View {
12+ @State var content : String = " "
13+ @FocusState var focus : Bool
14+
15+ var body : some View {
16+
17+ TextField ( " Placeholder... " , text: $content)
18+ . focused ( $focus)
19+ . font ( . largeTitle)
20+ . textFieldStyle ( . plain)
21+ . padding ( 25 )
22+ . background (
23+ Color . accentColor
24+ . opacity ( focus ? 0.3 : 0.05 )
25+ )
26+ . glass (
27+ color: focus ? . accentColor : . white,
28+ shadowColor: focus ? . accentColor : . white
29+ )
30+ . padding ( 50 )
31+
32+ . animation ( . default)
33+ }
34+ }
35+
36+ #Preview( " Light " ) {
37+ Input ( )
38+ }
39+
40+ #Preview( " Dark " ) {
41+ Input ( )
42+ . preferredColorScheme ( . dark)
43+ }
You can’t perform that action at this time.
0 commit comments