Reputation: 10126
In Xcode it automatically replaces:
#imageLiteral(resourceName: "image_name")
with an inline image, which is convenient for visualizing images in code.
But if the image is white (as is quite common in Xcode projects, I assume), and your code window's background is white, you simply cannot see the image and it looks something like this:
cell.imageView?.image =
Which just looks wrong and may confuse a fellow developer.
But the #imageLiteral
is much nicer than the alternative UIImage(named: "image_name")
.
So, is there any way in the Xcode preferences to change it so that the background color of the inline image is not the same as the background color of the code window? (Or some other solution.)
Note, I prefer to use a white code window background, and even if I changed it to some other color, the same problem would occur with an image that was that color (e.g. black on black).
Note: currently on Xcode Version 9.3.1 (9E501)
I have tried looking through the Xcode preferences in "Fonts & Colors" but there doesn't seem to be anything applicable.
One potential solution I have considered is putting parentheses around the "invisible" image so that it's clear there's something there (reminds me of the invisible man wearing clothes so people can see him).
cell.imageView?.image = ( )
It's not ideal, but at least it doesn't look as weird and highlights it for fellow developers.
Upvotes: 2
Views: 201