How to use Image Literal in the latest Xcode version 13?
Use
#imageLiteral(
without the closing parenthesis, In this way you can add images in Xcode 13.
Why does image literals not work in Xcode 11.2.1?
You need to change the following
diceImageView1.image =
to
diceImageView1.imageView?.image = 'image literal'
Displaying SF Symbols as an Image Literal?
TL;DR Xcode does not support combining the two.
If you comment the image literal code, you can see that it's actually inserting the following code:
static let image = #imageLiteral(resourceName: )
Attempting to do either of the following does not work:
#imageLiteral(resourceName: "trash")
#imageLiteral(systemName: "trash")
Therefore, I don't think image literals with SF Symbols are supported as of Xcode 11.3.1.
Literals (Images & Colors) don't work in Xcode
When you type Color Literal
, a white bo
x appears. In order to set the required colour, tap on that white box to select the colour from Color Picker
.
This is what it looks like:
Related Topics
Blue Highlighting/Focus Ring on Catalyst App
Views Compressed by Other Views in Swiftui VStack and List
(Swift) Nstimer Stop When Scrolling
Cannot Use Mutating Member on Immutable Value of Type
Differences Between "Static Var" and "Var" in Swift
How to Continue Ble Activities Onto Next View Controller
How to Convert Any to Int in Swift
What Are the Precedence Levels of the Swift Operators
How to Filter on an Array of Objects in Swift
Multi-Component Picker (Uipickerview) in Swiftui
Filter by Multiple Array Conditions
Can a Swift Property Wrapper Reference the Owner of the Property Its Wrapping
Reading an Inputstream into a Data Object