99- [ Features] ( #features )
1010- [ Installation] ( #installation )
1111- [ Usage] ( #usage )
12+ - [ Functions] ( #functions )
1213- [ Delegate] ( #delegate )
1314
1415## Features
1516
1617- Highly customizable
1718 - support dark/light theme
1819 - corner radius
19- - blured background
20+ - blurred background
2021 - width (iPad)
2122 - various positions
2223
23- ### Item config
24+ ## ** Cell type's **
2425
25- Item type
26+ #### - ActionCell
27+
28+ ##### Single action
2629 ``` swift
27- - ActionCell
28- - Title
29- - Spacer
30- - InfoCell
31- - TextFieldCell
32- - SwitchCell
33- - SegmentCell
34- - CustomCell
30+ .init (item : .ActionCell (selection : .default (icon : UIImage (systemName : " star" ), title : " Title" )), action : { action in
31+ print (" item Unstar" )
32+ })
33+ ```
34+
35+ ##### Double action
36+ ``` swift
37+ .init (item : .ActionCell (selection : .multi (isSelected : true ,
38+ selectedIcon : UIImage (systemName : " star.slash" ), selectedTitle : " Unstar" ,
39+ defaultIcon : UIImage (systemName : " star" ), defaultTitle : " Star" )),
40+ action : { action in
41+ if action.isSelected ?? false {
42+ print (" item Unstar" )
43+ } else {
44+ print (" item Star" )
45+ }
46+ })
3547 ```
3648
37- Action item color
49+ ##### Action item color
3850 ``` swift
39- - standard
51+ - default
4052 - clear
41- - filled
42- - tinted
43- - custom
53+ - filled parameters : color
54+ - tinted parameters : color
55+ - custom parameters : color, textColor, backColor
4456 ```
45-
46- Action item Layout
57+
58+ ##### Action item Layout
4759 ``` swift
4860 - Icon_Title (Icon left, title right)
4961 - Title_Icon (Title left, Icon right)
5062 ```
5163
52- Action item height
64+ ##### Action item height
5365 ``` swift
5466 - compact
55- - standard
67+ - default
5668 - big
5769 ```
70+
71+ #### - TitleCell
72+ ``` swift
73+ .init (item : .Title (" Title" ))
74+ ```
5875
59- Horizontal Action item height
76+ #### - SpacerCell
6077 ``` swift
61- - compact
62- - standard
78+ .init (item : .Spacer (type : .empty ))
79+ .init (item : .Spacer (type : .line ())) parameters: color, inset
80+ .init (item : .Spacer (type : .dashedLine ())) parameters: color
81+ .init (item : .Spacer (type : .divider ))
82+ ```
83+
84+ #### - InputCell
85+ ``` swift
86+ .init (item : .InputCell (type : .textField (), placeholder : " Login" , identifier : " Login" ))
87+ .init (item : .InputCell (type : .textView (), placeholder : " Description" , identifier : " Description" ))
88+
89+ textField parameters: text, isSecure, content, keyboard
90+ textView parameters: text, content, keyboard
91+ ```
92+
93+ #### - SwitchCell
94+ ``` swift
95+ .init (item : .SwitchCell (icon : UIImage (systemName : " bookmark" )! , title : " Switch 1" , action : #selector (switchAction)))
96+ ```
97+
98+ #### - SegmentCell
99+ ``` swift
100+ .init (item : .SegmentCell (items : [" Item 1" , UIImage (systemName : " bookmark" )! , " Item 3" ], selected : 1 , action : #selector (segmentAction)))
101+ ```
102+
103+ #### - CustomCell
104+ ``` swift
105+ .init (item : .CustomCell (view : CustomViewRow (title : " Custom rows" , subtitle : " View custom rows" , icon : UIImage (systemName : " tablecells" )! )), action : { _ in }
63106 ```
64107
65- Spacer type
108+ Horizontal Action item height
66109 ```swift
67- - empty
68- - line
69- - dashedLine
70- - divider
110+ - compact
111+ - default
71112 ```
72113
73114## Installation
@@ -76,24 +117,7 @@ Put `Sources` folder in your Xcode project. Make sure to enable `Copy items if n
76117## Usage
77118
78119```swift
79- let actions: [UIFloatMenuAction] = [
80- .init (item : .Title (" Title" )),
81- .init (item : .SegmentCell (items : [" Item 1" , UIImage (systemName : " bookmark" )! , " Item 3" ], selected : 1 , action : #selector (segmentAction))),
82- .init (item : .SwitchCell (icon : UIImage (systemName : " bookmark" )! , title : " Switch 1" , action : #selector (switchAction))),
83- .init (item : .InfoCell (icon : UIImage (systemName : " questionmark.square" )! , title : " Data title" , label : .config (fontSize : 15 , fontWeight : .semibold ))),
84- .init (item : .Spacer (type : .divider )),
85- .init (item : .Title (" Title" )),
86- .init (item : .ActionCell (icon : UIImage (systemName : " arrow.down.square.fill" )! , title : " Title" , layout : .Icon_Title ), itemColor : .tinted (.systemBlue ), action : { _ in
87- print (" Action" )
88- }),
89- .init (item : .Spacer (type : .line ())),
90- .init (item : .ActionCell (icon : UIImage (systemName : " arrow.right.square.fill" )! , title : " Title" , subtitle : " Test subtitle" , layout : .Icon_Title ), itemColor : .filled (.systemPurple ), action : { _ in
91- print (" Action" )
92- }),
93- .init (item : .HorizontalCell (items : h_actions, height : .standard )),
94- .init (item : .CustomCell (view : CustomViewRow (title : " Custom rows" , subtitle : " View custom rows" , icon : UIImage (systemName : " tablecells" )! )), action : { _ in
95- })
96- ]
120+ let actions: [UIFloatMenuAction] = []
97121
98122let menu = UIFloatMenu.setup (actions : actions)
99123menu.header .title = " UIFloatMenu title"
@@ -109,6 +133,32 @@ menu.delegate.close = self
109133menu.show (self )
110134```
111135
136+ ## Functions
137+
138+ ** Show next view with animation**
139+ ```swift
140+ let header = UIFloatMenuHeaderConfig (title : " Activity" , showLine : true )
141+ UIFloatMenu.showNext (actions : [], presentation : .center , header : header)
142+ ```
143+
144+ ** Display indicator**
145+ ```swift
146+ UIFloatMenu.displayIndicator (text : " Loading..." , presentation : .rightUp (overNavBar : true ))
147+
148+ // If success show next
149+ UIFloatMenu.showNext (actions : [], presentation : .rightUp (overNavBar : true ), header : header)
150+
151+ // If error stop indicator and show previous view
152+ UIFloatMenu.stopIndicator ()
153+ ```
154+
155+ ** Show alert**
156+ ```swift
157+ let alert = UIAlertController (title : " Delete" , message : " message" , preferredStyle : .alert )
158+ alert.addAction (UIAlertAction (title : " Cancel" , style : .cancel ))
159+ UIFloatMenuHelper.showAlert (alert)
160+ ```
161+
112162## Delegate
113163
114164To `know when menu is closed`, set the delegate with protocol `UIFloatMenuCloseDelegate`:
@@ -123,14 +173,14 @@ func UIFloatMenuDidCloseMenu() {
123173}
124174```
125175
126- To get ` UITextField data ` , set the delegate with protocol ` UIFloatMenuTextFieldDelegate ` :
176+ To get `UITextField` or `UITextView data`, set the delegate with protocol `UIFloatMenuTextFieldDelegate`:
127177
128178```swift
129- menu.delegate .textField = self
179+ menu.delegate .input = self
130180```
131181
132182```swift
133- func UIFloatMenuGetTextFieldData (_ rows : [TextFieldRow ]) {
183+ func UIFloatMenuGetInputData (_ rows: [InputRow ]) {
134184 let login = UIFloatMenuHelper.find (rows, by : " Login" )
135185 let password = UIFloatMenuHelper.find (rows, by : " Password" )
136186
0 commit comments