Questions tagged [image-literals]
10 questions
109
votes
12 answers
Xcode 10 - image literals no longer available
Xcode 10 Release Notes: "Code Completion for Swift image literals has been removed in Xcode 10"
So it's not a bug that I couldn't add images in the code (and run older projects). How do we then add images from now on in the code as just typing…

Pawel Cichonski
- 1,099
- 2
- 7
- 3
12
votes
1 answer
Disable #imageLiteral(resourceName: <..>) preview in Xcode?
I found image literals to be rather distracting than useful.
Is there any way to disable this Xcode feature?

Krypt
- 434
- 4
- 12
3
votes
2 answers
Also see filename when using an Xcode #imageLiteral
The fairly recent #imageLiteral in Xcode is neat. I especially like the safety it provides: the code won't compile if you're using an image that doesn't exist so the return type is a non optional image that you know will be available.
However, I…

Benjohn
- 13,228
- 9
- 65
- 127
2
votes
0 answers
fetch binary data to tell how many attributes are saved
My swift code below takes 2 image litterals and then saves then into core data. All I want to is in a func fetch is print in the dubgg area how many attributes are saved into core data. So in the debugg section it should say there are 2 items saved…
user12655184
2
votes
0 answers
Any way to change the background color of a #imageLiteral in Xcode?
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…

shim
- 9,289
- 12
- 69
- 108
1
vote
1 answer
swift 4 add a image literal to a string
I want to be able to add an image to a string with some text. There was an example video on headerViews and he included the data that had the images embedded in the string.
I am not sure how he did it.
Here is the data
Section(genre: "…

steller
- 245
- 3
- 14
1
vote
2 answers
Images in Assets catalog not available in Xcode 10 anymore
Before I could just type the name of the image, and it would show up as a small icon. After I upgraded to Swift 4.2 and Xcode 10, this seems not to work anymore. Now I have to use the UIImage(named: "imageName") to get the image. Or am I doing…

Lars Christoffersen
- 1,719
- 13
- 24
1
vote
0 answers
Make Xcode warn when image literals don't point to images
Is it possible to have a warning if image literals are used but the associated images no longer exist?
i.e. if the image has been removed or renamed etc...

Fogmeister
- 76,236
- 42
- 207
- 306
0
votes
1 answer
Displaying SF Symbols as an Image Literal?
Xcode will allow me to introduce image literals in code when I start typing image literal and use autocomplete:
With iOS 13, they released SF Symbols that can be introduced into the code like so:
let image = UIImage(systemName:…

Senseful
- 86,719
- 67
- 308
- 465
-1
votes
1 answer
iOS App crash without any exception when set UIImage to UIImageView
I am facing a problem that is quite strange. I just want to set an ImageLiteral to the UIImageView and it crashes the app without popping up any error or exception. It tried it in simulator and everything is ok. But when I install my app on iPad…

RedSIght
- 538
- 5
- 13