Automatically determine the text color according to the background

VisibleText

Automatically determine and apply the text color according to the background. If the background is dark, the text will be light or dark if background is light !

Installation

Import VisibleTextContainer.swift in your project (or use example project)

Usage

Add UIView and set "Custom class" in "Identity inspector" with VisibleTextContainer :

Add UILabel, UITextView or UITextField in VisibleTextContainer :

Change light text color or dark text color :

GitHub