NSPredicate: Filter multiple entity kinds

let predicate = NSCompoundPredicate(orPredicateWithSubpredicates: [

    NSCompoundPredicate(andPredicateWithSubpredicates: [
        NSPredicate(format: "entity = %@", Note.entity()),
        NSPredicate(format: "content CONTAINS[cd] %@", "1")
    ]),
    
    NSCompoundPredicate(andPredicateWithSubpredicates: [
        NSPredicate(format: "entity = %@", Tag.entity()),
        NSPredicate(format: "name CONTAINS[c] %@", "tag")
    ])
])

Now, this yields another problem: there is no API to limit the number of entities to fetch “per group”.

If you do need this feature, you’re probably better of with multiple NSFetchRequest(s).

Fixing Macbook Brightness Keys in Windows 10

Scenario: You’ve installed Bootcamp on your mac (shame on you), AND updated AMD’s graphic cards, to deal with stability issues.

If, for some reason, your MacBook’s special keys (Brightness, Volume, etc) stop working:

  1. Boot into your macOS partition
  2. Open BootCamp Assistant
  3. Click over Action > Download Windows Support Software
  4. Save the package to a flashdrive
  5. Boot back into Windows
  6. Run BootCamp > Drivers > Apple > AppleKeyboardInstaller64
  7. Reboot
  8. Think closely, why, in the name of Satan, you’d need Windows

Embedding NSTokenField inside NSScrollView

In order to get NSTokenField (or NSTextField) play well with a ScrollView, you should:

  1. Pin the fixed edges (in my case: Top / Bottom / Left)
  2. Leave alone the edges that can grow (again, in my case: Right)
  3. Set a placeholder Intrinsic Size, to keep IB happy
  4. Override intrinsicContentSize

Notes:

  • Pinning the TokenField to every single edge simply causes the container view to assume the actual TokenField’s size (and thus, kills the scrolling behavior).
  • Sample code available here!

First Postcard (Ever!!)

In roughly 35 years (wow I’m a bit old!!) I never ever got a postcard. Up until today!!

Thank you Thuy, this is an AMAZING gift. Will live on my desk from now on! ❤️