Archive for August 29, 2024

Thursday, August 29, 2024

EditorConfig Files in Xcode

Pol Piella:

As a developer for Apple platforms, you probably work on multiple projects with different coding styles and conventions and have to find yourself adjusting Xcode’s editor settings every time you switch between projects. This can be a tedious process that you might forget to do or overlook and, if the project does not have a linter that enforces the coding style, you might end up with inconsistent code formatting across the codebase.

Thankfully Xcode 16 adds support for EditorConfig files, which allows you to define Xcode editor settings in a programmatic way on a per-project basis. In this article, you will learn how to set up EditorConfig files in Xcode and what settings are supported at this time.

They also work in BBEdit.

Previously:

Find Any File 2.5

Thomas Tempelmann:

Adds a “Name without Extension” rule.

[…]

Holding the Option key with the search location popup menu open will now also show the System and Data members of bootable volumes. If you choose a “(Data)” volume as the search destination, it’ll skip the original files installed by Apple, making the search faster. If you’re searching only for files you created, this is a useful method to speed things up.

[…]

Can now search on NAS and *nix server much faster by running the “find” command remotely.

[…]

The popup menus for the search location and the rules can now show the hidden (expert) items by holding down the Option key.

Via John Gruber:

Amongst other features, FAF supports regular expressions, and you can save frequently-used searches to easily re-run them.

Thomas Tempelmann:

A nice side effect of using FindAnyFile on your Time Machine volume is that it can alert you about structural errors on your TM volume, which might later prevent you from restoring all your data. FAF has alerted users hundreds of time about this in the past.

You could as well just run Disk Utility’s First Aid check on the TM volume, but many don’t ever think of that.

Previously:

Calling async Code Synchronously in Swift

Wade Tregaskis:

I find my hand is often forced by APIs I don’t control (most often Apple’s APIs). e.g. data source or delegate callbacks that are synchronous and require you to return a value, but in order to obtain that value you have to run async code (perhaps because yet again that’s all you’re given by 3rd parties, or because that code makes sense to be async and is used happily as such in other places and you don’t want to have to duplicate it in perpetuity just to have a sync version).

If that asynchronosity is achieved through e.g. GCD or NSRunLoop or NSProcess or NSTask or NSThread or pthreads, it’s easy. There are numerous ways to synchronously wait on their tasks. In contrast, Swift Concurrency really doesn’t want you to do this. The language and standard library take an adamant idealogical position on this – one which is unfortunately impractical; a spherical chicken in a vacuum.

Nonetheless, despite Swift’s best efforts to prevent me, I believe I’ve come up with a way to do this.

[…]

Do not call this from a thread used by Swift Concurrency (e.g. an actor, including global actors like MainActor) if the closure - or anything it calls transitively via await - might be bound to that same isolation context. Doing so may result in deadlock.

Previously:

Mobile Deployment Pipelines for $0

Jacob Bartlett:

Today, I’ll show you how to set up CI on your side projects. For free!

  • Part I: Fastlane

  • Part II: App Store Connect

  • Part III: GitHub Actions

[…]

Frustratingly, cloud-hosted MacOS runners on GitHub Actions cost 10x as much per minute as Linux runners. While public repos are granted 200 minutes of Mac runner time a month, this can be spenny for private or particularly-active repos.

[…]

You can set up a local machine — even your standard development laptop! — as a self-hosted runner.

Previously: