sf-symbols
Change the stroke/fill color of SF Symbol icon in SwiftUI?
You can change the stroke and fill color of a sf symbol icon using foregroundColor(_ color: Color?) The following code: Image(systemName: “flame.fill”).foregroundColor(.red) Image(systemName: “flame”).foregroundColor(.red) Should produce this: Here is the complete SwiftUI View Code struct Icon : View { var body: some View { HStack{ Image(systemName: “flame.fill”) .foregroundColor(.red) Image(systemName: “flame”) .foregroundColor(.red) } .padding() } }
How do I set a weight to SF Symbols for iOS 13?
When using the font modifier, set a weight to the font you’re passing. For example, if you want to use one of the default text styles (which I recommend, since they adapt to the user’s Dynamic Type setting), you can do it like this: Image(systemName: “arrow.right”) .font(Font.title.weight(.ultraLight)) If you want to specify a font size, … Read more
Is it possible to use SF Symbols outside of UIImage?
This works for me: let imageAttachment = NSTextAttachment() imageAttachment.image = UIImage(systemName: “checkmark.circle”) // If you want to enable Color in the SF Symbols. imageAttachment.image = UIImage(systemName: “checkmark.circle”)?.withTintColor(.blue) let fullString = NSMutableAttributedString(string: “Press the “) fullString.append(NSAttributedString(attachment: imageAttachment)) fullString.append(NSAttributedString(string: ” button”)) label.attributedText = fullString Result:
How to change SF Symbol icon color in UIKit?
Use below code for changing SFSymbols icons color let imageIcon = UIImage(systemName: “heart.fill”)?.withTintColor(.red, renderingMode: .alwaysOriginal) imageView.image = imageIcon Before After
Change a SF Symbol size inside a UIButton
You can do it using SymbolConfiguration like in the sample code below: let largeConfig = UIImage.SymbolConfiguration(pointSize: 140, weight: .bold, scale: .large) let largeBoldDoc = UIImage(systemName: “doc.circle.fill”, withConfiguration: largeConfig) button.setImage(largeBoldDoc, for: .normal)
How to use SF Symbols in iOS 12 and below?
You can not use SFSymbols natively in iOS versions older than iOS 13 (see Apple’s Human Interface Guidelines for SF Symbols). However, if you are interested in using the graphics you can use the SF Symbols app to export SVG versions of the icon. Then use some graphics tool to convert them to PNG icons … Read more
How do I set the size of a SF Symbol in SwiftUI?
SF Symbols are similar to fonts, thus: .font(.system(size: 60))
Find all available images for Image(systemName:) in SwiftUI
These icons are called SF Symbols. There are over 3,300 symbols you can use in iOS 13 and later, macOS 11 and later, watchOS 6 and later, and tvOS 13 and later. You can use a symbol everywhere you can use an image. To browse the full set of symbols, download the SF Symbols app. … Read more