Get notified when pasteboard did change

How to listen for clipboard changes

Photo by Max Nelson on Unsplash

Today I was thinking about apps like Clippy and other clipboard managers, I thought: “For sure swift provides notification for the copy event”

WRONG! I sadly discovered that on MacOS unlike on iOS you can’t listen for NSClipboard changes.

So I wanted to write a small snippet of code that provides a notification when the clipboard changes.

The Problem

The only solution is “polling” but what does that mean?

You need to check changeCount and if it’s changed send a notification, let’s see how:

Easy right? Then to get notified you can listen as always via the NotificationCenter like shown below:


A simple guide to start with MacOS Development

Photo by Michał Kubalczyk on Unsplash

I’m pretty new to MacOS development, I’m coming from a past mixed between web dev and iOS (My latest app: StockPapers).

Today I want to share with you what I’ve learned day by day in this week trying to create a clone of my nodeJS cli, splash-cli.

We are going to build a status bar clock application with “reminders”, where the user will be able to schedule notifications.

We’ll see how to prevent to open the same window multiple times, notifications and so more!

What do you need?

Pretty obvious:

  • Basic knowledge of the Swift language (or maybe not)
  • A machine running Xcode
  • Xcode…


Photo by Kerde Severin on Unsplash

We find features by accident, right? That’s what happened to me this afternoon.

I’m learning Swift since a quite bunch of time (1/2 months), usually, I like to experiment and try to replicate “big apps/websites” features. That it’s quite easy when you want to replicate something on the web, as a web developer you have the browser dev tools that show you the source code, but what when you want to do the same with an app?

Today I was playing around with GestureRecognizers and I was trying to have the “swipe back gesture” recognized on the half right of…

Federico Vitale

FrontEnd Engineer @ CHILI, I enjoy Java, Go, Swift and obviously React. Sharing what I learn 🇮🇹

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store