Monday, February 24, 2025

CIFilterBuiltins

Matthias Gansrigler:

Browsing the Core Image headers, I did find functions for these filters where you could just call let filter = CIFilter.colorPosterize()

Yet every time I tried, it never worked and would give me an error that CIFilter has no member 'colorPosterize'. Well, “Crap!”, I thought, this must be something that will become available eventually.

How wrong I was. This has been available for a while, you just need to know how to do it! The “trick” is to not only import CoreImage, but also (why!?) import CoreImage.CIFilterBuiltins.

Apple:

The type-safe approach returns a non-optional filter. Because the returned filter conforms to the relevant protocol—for example, CIFalseColor in the case of falseColor()—the parameters are available as properties.

Comments RSS · Twitter · Mastodon

Leave a Comment