Skip to content

Commit e1cf580

Browse files
committed
Updated
1 parent 2948cfa commit e1cf580

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
- Highly customizable
1818
- support dark/light theme
1919
- corner radius
20-
- blurred background
21-
- width (iPad)
20+
- blurred background (with blur styles)
2221
- various positions
2322

2423
## **Cell type's**
@@ -118,16 +117,18 @@ Put `Sources` folder in your Xcode project. Make sure to enable `Copy items if n
118117

119118
```swift
120119
let actions: [UIFloatMenuAction] = []
121-
122-
let menu = UIFloatMenu.setup(actions: actions)
120+
121+
//let custom_menu = UIFloatMenu.setup(type: .custom(view: CustomView))
122+
let menu = UIFloatMenu.setup(type: .actions(actions))
123123
menu.header.title = "UIFloatMenu title"
124124
menu.header.subtitle = "UIFloatMenu subtitle"
125+
menu.header.showButton = true
125126
menu.header.showHeader = true
126127
menu.header.showLine = true
127128
menu.header.lineInset = 15
128129
menu.config.cornerRadius = 12
129130
menu.config.blurBackground = true
130-
menu.config.viewWidth_iPad = 350
131+
menu.config.blurStyle = .systemMaterial
131132
menu.config.presentation = .default
132133
menu.delegate.close = self
133134
menu.show(self)
@@ -138,17 +139,18 @@ menu.show(self)
138139
**Show next view with animation**
139140
```swift
140141
let header = UIFloatMenuHeaderConfig(title: "Activity", showLine: true)
141-
UIFloatMenu.showNext(actions: [], presentation: .center, header: header)
142+
UIFloatMenu.showNext(type: .custom(view: CustomView), header: header, presentation: .center) // custom view
143+
UIFloatMenu.showNext(type: .actions([]), header: header, presentation: .center) // items
142144
```
143145

144146
**Display indicator**
145147
```swift
146148
UIFloatMenu.displayIndicator(text: "Loading...", presentation: .rightUp(overNavBar: true))
147149

148-
//If success show next
150+
//If success, show next
149151
UIFloatMenu.showNext(actions: [], presentation: .rightUp(overNavBar: true), header: header)
150152

151-
//If error stop indicator and show previous view
153+
//If error, stop indicator and show previous view
152154
UIFloatMenu.stopIndicator()
153155
```
154156

Sources/UIFloatMenu.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class UIFloatMenu {
1515

1616
let shared = UIFloatMenu()
1717

18+
//MARK: - setup
1819
static public func setup(type: UIFloatMenu_viewType) -> UIFloatMenuController {
1920
let vc = UIFloatMenuController()
2021
switch type {
@@ -46,6 +47,7 @@ class UIFloatMenu {
4647
// Animation duration
4748
static private var animationDuration: TimeInterval = 0.4
4849

50+
// Display ActivityIndicator
4951
static public var displayActivityIndicator: Bool = false
5052

5153
// Queue

Sources/UIFloatMenuConfig.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ public struct UIFloatMenuConfig {
7575
*/
7676
public var blurBackground: Bool
7777

78+
/**
79+
UIFloatMenu: Blur effect style
80+
81+
> Default: **prominent**.
82+
*/
7883
public var blurStyle: UIBlurEffect.Style
7984

8085
/**

Sources/UIFloatMenuHelper.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class UIFloatMenuHelper {
143143
}
144144
}
145145

146+
// MARK: - getTopVC
146147
static func getTopVC() -> UIViewController {
147148
var topController: UIViewController {
148149
let keyWindow = UIApplication.shared.windows.filter( {$0.isKeyWindow} ).first
@@ -157,6 +158,7 @@ class UIFloatMenuHelper {
157158
return topController
158159
}
159160

161+
// MARK: - showAlert
160162
static func showAlert(_ alert: UIAlertController) {
161163
var topController: UIViewController {
162164
let keyWindow = UIApplication.shared.windows.filter( {$0.isKeyWindow} ).first
@@ -172,7 +174,8 @@ class UIFloatMenuHelper {
172174
topController.present(alert, animated: true, completion: nil)
173175
}
174176

175-
static func find(_ rows: [TextFieldRow], by identifier: String) -> String {
177+
// MARK: - find
178+
static func find(_ rows: [InputRow], by identifier: String) -> String {
176179
if let index = rows.firstIndex(where: { $0.identifier == identifier}) {
177180
return rows[index].text
178181
}
@@ -294,6 +297,7 @@ final class KeyboardHelper {
294297

295298
extension UIView {
296299

300+
// MARK: - gestureIsEnable
297301
func gestureIsEnable(_ bool: Bool) {
298302
for gesture in self.gestureRecognizers ?? [] {
299303
gesture.isEnabled = bool

Sources/UIFloatMenuView/UIFloatMenuView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ class UIFloatMenuView: UIView, UITableViewDelegate, UITableViewDataSource, UIGes
123123
return config.viewWidth
124124
}
125125
} else {
126-
return appRect.width-30
126+
return setMaxWidth(customView.bounds.width)
127127
}
128128

129-
return appRect.width-30
129+
return setMaxWidth(customView.bounds.width)
130130
}
131131

132132
if headerConfig.showHeader {
@@ -215,10 +215,10 @@ class UIFloatMenuView: UIView, UITableViewDelegate, UITableViewDataSource, UIGes
215215
return config.viewWidth
216216
}
217217
} else {
218-
return setMaxWidth(tableView.bounds.width)
218+
return setMaxWidth(customView.bounds.width)
219219
}
220220

221-
return setMaxWidth(tableView.bounds.width)
221+
return setMaxWidth(customView.bounds.width)
222222
}
223223

224224
if headerConfig.showHeader {

0 commit comments

Comments
 (0)