Search code examples
iosswiftuiviewcore-graphicscalayer

Render all UIViews below in grayscale


In my app, I would like to present a transparent UIView (or layer) which acts as a color filter. So, when this view is presented everything below, it is shown in grayscale.

Is this possible, and if yes how would you go about doing this? I know how to render a UIView specifically in grayscale but this is not what I want to achieve.

Thanks!


Solution

  • As I didn't find any acceptable solution I went and created this myself. You can check it out in my Git repository. It cannot only filter in grayscale but also sepia, etc. Check out the project, its pretty straight forward.

    Any contributions to the project are welcome, there is obviously a lot to add and improve!

    enter image description here