-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// PopoverMenuManager.swift | ||
// SWDestinyTrades | ||
// | ||
// Created by Diogo Autilio on 23/03/24. | ||
// Copyright © 2024 Diogo Autilio. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import FTPopOverMenu | ||
import UIKit | ||
|
||
protocol PopoverMenuManagerType { | ||
func showPopoverMenu(forEvent event: UIEvent, with menuArray: [String], done: ((NSInteger) -> Void)?, cancel: (() -> Void)?) | ||
} | ||
|
||
final class PopoverMenuManager: PopoverMenuManagerType { | ||
|
||
// Configures the appearance of the popover menu | ||
private func appearance() -> FTConfiguration { | ||
let config = FTConfiguration() | ||
config.backgoundTintColor = ColorPalette.appTheme | ||
config.borderColor = ColorPalette.appTheme | ||
config.menuSeparatorColor = .lightGray | ||
config.textColor = .white | ||
config.textAlignment = .center | ||
return config | ||
} | ||
|
||
// Displays the popover menu for the given event | ||
func showPopoverMenu(forEvent event: UIEvent, | ||
with menuArray: [String], | ||
done: ((NSInteger) -> Void)?, | ||
cancel: (() -> Void)? = nil) { | ||
FTPopOverMenu.showForEvent(event: event, | ||
with: menuArray, | ||
config: appearance(), | ||
done: done, | ||
cancel: cancel) | ||
} | ||
} |