Giter Club home page Giter Club logo

dsfquickactionbar's Issues

Help Request

Hi
I m trying to develop a similar app, Let me know if its possible to take you in as a consultant, or hire as freelance dev for the project. Or just if you can help me in building this with your inputs. Im a dart developer without swift experience that's why requesting. my email : [email protected] let me know how to contact you.

quickActionBarDidCancel not being called when user clicks outside the bar

Hello, I hope you're well! I'm having an issue whereby after clicking outside the search bar, it stops showing up on subsequent calls, even though isPresenting is logging the correct values.

In other words, quickActionBarDidCancel is called when the user pressed esc but not when clicking outside the bar. Currently being called as so:

self.quickActionBar.present(placeholderText: "Search...", width: self.screenWidth)

Otherwise when presenting the bar with the completion handler, the statement is logged, but the bar stop showing up on subsequent calls to present.

self.quickActionBar.present(placeholderText: "Search...", width: self.screenWidth) {
			Swift.print("Quick action bar closed")
}

Any help would be greatly appreciated!

didActivateItem missing from SwiftUI implementation

I might be missing something obvious, but I can't find how to use didActivateItem, didCancel etc. when following the Swift UI implementation.

How do I tell DSFQuickActionBar what to do when an item is activated?

How do I present a search bar after pressing a status menu bar icon?

I'm trying to recreate a Siri-like app where clicking a system menu bar item shows the quick action bar in the center of the screen but I can't get anything. Would you mind helping me out?

Here's what I have so far:

import Cocoa
import DSFQuickActionBar

class AppDelegate: NSObject, NSApplicationDelegate {
    
    private var statusItem: NSStatusItem!
    
    // Search bar
    lazy var quickActionBar: DSFQuickActionBar = {
        let b = DSFQuickActionBar()
        b.contentSource = self
        b.rowHeight = 48
        return b
    }()

    func applicationDidFinishLaunching(_ aNotification: Notification) {
        // Status item
        statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
        if let button = statusItem.button {
            button.image = NSImage(systemSymbolName: "books.vertical", accessibilityDescription: "books.vertical")
            button.action = #selector(toggleSearch(_:))
        }
    }
    
    @objc func toggleSearch(_ sender: Any?) {
        if quickActionBar.isPresenting {
            // Hide
            quickActionBar.cancel()
        } else {
            // Show
            self.quickActionBar.present(
                parentWindow: nil,
                placeholderText: "Search Filters",
                searchImage: NSImage(systemSymbolName: "books.vertical", accessibilityDescription: "books.vertical"),
                width: min(800, max(500, 200 + 50))
            ) {
                Swift.print("Quick action bar closed")
            }
        }
    }
}

extension AppDelegate: DSFQuickActionBarContentSource {

    func quickActionBar(_: DSFQuickActionBar, itemsForSearchTerm searchTerm: String) -> [AnyHashable] {
        return ["1", "2"]
    }
    
    func quickActionBar(_ quickActionBar: DSFQuickActionBar, didActivateItem item: AnyHashable) {
    }

    func quickActionBar(_: DSFQuickActionBar, viewForItem item: AnyHashable, searchTerm: String) -> NSView? {
        return nil
    }

    func quickActionBar(_ quickActionBar: DSFQuickActionBar, canSelectItem item: AnyHashable) -> Bool {
        return true
    }

    func quickActionBarDidCancel(_: DSFQuickActionBar) {
        
    }

    @objc func performAdvancedSearch(_ sender: Any) {
        quickActionBar.cancel()
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.