File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Projects/DSKit/Sources/Modifiers Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ //
2+ // PokitFloatButtonModifier.swift
3+ // DSKit
4+ //
5+ // Created by 김민호 on 1/16/25.
6+ //
7+ import SwiftUI
8+
9+ private struct PokitFloatButtonModifier : ViewModifier {
10+ let action : ( ) -> Void
11+
12+ func body( content: Content ) -> some View {
13+ content
14+ . overlay ( alignment: . bottomTrailing) {
15+ Button ( action: action) {
16+ Image ( . icon( . plus) )
17+ . resizable ( )
18+ . frame ( width: 36 , height: 36 )
19+ . padding ( 12 )
20+ . foregroundStyle ( . pokit( . icon( . inverseWh) ) )
21+ . background {
22+ RoundedRectangle ( cornerRadius: 9999 , style: . continuous)
23+ . fill ( . pokit( . bg( . brand) ) )
24+ }
25+ . frame ( width: 60 , height: 60 )
26+ }
27+ . padding ( . trailing, 20 )
28+ . padding ( . bottom, 39 )
29+ }
30+ }
31+ }
32+
33+ public extension View {
34+ func pokitFloatButton( action: @escaping ( ) -> Void ) -> some View {
35+ return self . modifier ( PokitFloatButtonModifier ( action: action) )
36+ }
37+ }
38+
39+ #Preview {
40+ ZStack {
41+ Color . black. ignoresSafeArea ( )
42+ . pokitFloatButton ( action: { } )
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments