Tags » swift
-
TIL: How to install exiftool in GitHub Actions
-
TIL: How to get a macOS file/folder icon in Swift
Use
NSWorkspace.shared.icon
to get the icon as anNSImage
, then you can save it to disk or do something else with it. -
TIL: How to check the quality of a network connection
Using an
NWPathMonitor
and inspecting the value ofNWPath.status
,NWPath.isExpensive
andNWPath.isConstrained
can tell you what sort of connection you’re running on. -
TIL: Writing a file in Swift, but only if it doesn’t already exist
Adding
.withoutOverwriting
to yourwrite()
call will prevent you from overwriting a file that already exists. -
Finding the biggest items in my Photos Library
A quick script to help move the biggest items out of my main Photos Library.
-
Snippets to manage albums in Photos.app
AppleScript only allows us to add photos to an album; dipping into Swift and PhotoKit lets us both add and remove photos.
-
TIL: How to profile Swift code
-
A script to get Live Text from images
Using Apple’s built-in tools to get OCR text from an image, but without going through a GUI.
-
Changing the macOS accent colour without System Preferences
Updating the accent colour everywhere, with immediate effect, using a script written in Swift.