home.social

#selector — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #selector, aggregated by home.social.

fetched live
  1. @[email protected] @y2mango `UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)` is how to do it. Allowed seemingly on the App Store as I've done it in HomeRun 2 for a few years

  2. @[email protected] @y2mango `UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)` is how to do it. Allowed seemingly on the App Store as I've done it in HomeRun 2 for a few years

  3. @jamesthomson amusingly you can do that on the App Store without issue.

    A lot of apps used to/still do it to close their apps after a widget action.

    UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)

  4. @jamesthomson amusingly you can do that on the App Store without issue.

    A lot of apps used to/still do it to close their apps after a widget action.

    UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)

  5. Again I run into this.

    E.g.

    super.responds(to: #selector(cancelOperation(_:)))

    in an NSCollectionViewItem *subclass* that requires an `override` declaration does return `true`, but actually forwarding

    super.cancelOperation(sender)

    produces a runtime 'warning' about unrecognized selector.

    This happens to me from time to time with AppKit subclasses, and I document "no need to call super because..." usually.

    But I still haven't really grasped the reasons here.

  6. Again I run into this.

    E.g.

    super.responds(to: #selector(cancelOperation(_:)))

    in an NSCollectionViewItem *subclass* that requires an `override` declaration does return `true`, but actually forwarding

    super.cancelOperation(sender)

    produces a runtime 'warning' about unrecognized selector.

    This happens to me from time to time with AppKit subclasses, and I document "no need to call super because..." usually.

    But I still haven't really grasped the reasons here.

  7. Компьютерное зрение в автотестах. Поиск элемента по фото

    В автотестах для web-приложений, мы привыкли искать элементы по селектору. Это обязывает наделять html-элементы уникальными атрибутами, будь то класс или data-атрибут. Но когда проект становится достаточно большим, команда начинает задумываться над сокращением размера index.html, чтобы переходя по ссылке пользователь как можно быстрее получил полезную для него информацию. Тут-то и начинается гонка за каждый байт и каждую миллисекунду и необходимость любого «лишнего» символа в html разметке ставится под сомнение. В такие моменты data-атрибуты для автотестов это первые кандидаты на удаление из конечного html. Уже довольно давно я думал о том как же находить элементы на странице не привязываясь к DOM-дереву, результатом этих поисков является плагин, который я написал для Cypress. О нем, и о подходе, который в нем применяется, пойдет речь в данной статье.

    habr.com/ru/articles/841564/

    #cypress #selector #visualtesting #cypressplugin #elementsearch

  8. @drahardja @todd
    in your principal UIViewController:
    ```
    public override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    let url = URL(string: "myapp://foo")
    self.openURL(url!)
    self.extensionContext?.completeRequest(returningItems: [])
    }

    @objc func openURL(_ url: URL) -> Bool {
    var responder: UIResponder? = self
    while responder != nil {
    if let application = responder as? UIApplication {
    return application.perform(#selector(openURL(_:)), with: url) != nil
    }
    responder = responder?.next
    }
    return false
    }
    ```

  9. Today I will write the first few #css #book pages of the #Selector part.

    My request: please tell me about your cool, non-obvious selector tricks. I'd love to include a few in the book.

  10. Today I will write the first few #css #book pages of the #Selector part.

    My request: please tell me about your cool, non-obvious selector tricks. I'd love to include a few in the book.

  11. All I want for WWDC is to be able to delete this:

    UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)

  12. All I want for WWDC is to be able to delete this:

    UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)

  13. Another #SwiftUI question: how does one respond to standard main menu entries (Commands) like “Select All”?

    developer.apple.com/forums/thr

    I tried `.onCommand(#selector(NSStandardKeyBindingResponding.selectAll)) { .. }`, but that doesn’t get triggered.

  14. Another #SwiftUI question: how does one respond to standard main menu entries (Commands) like “Select All”?

    developer.apple.com/forums/thr

    I tried `.onCommand(#selector(NSStandardKeyBindingResponding.selectAll)) { .. }`, but that doesn’t get triggered.

  15. So hear me out ... Might there be a use case for a #css #selector like this:

    input[checked] ~ input:nth-of-type-from-previous(10)

    Meaning the 10th input that occurs after the checked input.

    Context: dots-and-boxes with only HTML and CSS. It should be possible today, but a selector like that would make it a lot easier. en.wikipedia.org/wiki/Dots_and

  16. So hear me out ... Might there be a use case for a #css #selector like this:

    input[checked] ~ input:nth-of-type-from-previous(10)

    Meaning the 10th input that occurs after the checked input.

    Context: dots-and-boxes with only HTML and CSS. It should be possible today, but a selector like that would make it a lot easier. en.wikipedia.org/wiki/Dots_and

  17. a programmer's poem

    func checkHappiness() -> Void {

    let a = life.thingsGettingBetter().count
    let b = life.thingsGettingWorse().count

    if a > b {

    print("You are delusional")

    } else if a < b {

    print("You are paranoid")

    } else {

    // a == b
    print("That's life")

    }

    Timer.scheduledTimer(withTimeInterval: 3600, target: self, selector: #selector(checkHappiness), userInfo: userInfo, repeats: false)

    }

  18. :where() :is() :has()? New CSS selectors that make your life easier - This post show us how to use the new CSS selector :where() :is() :has() to make our... polypane.app/blog/where-is-has #Front #CSS #Selector by @[email protected]