How to display printer icon

Viewed 42

I am trying to display a printer icon next to the share button but It doesn't show. How do I fix this ? It's built using code no storyboards. enter image description here

 let shareButton = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(share(sender:)))
            let printButton = UIBarButtonItem(image:  UIImage(named: "printer"), style: .plain, target: self, action:  #selector(print(sender:)))
            navigationItem.rightBarButtonItems = [shareButton, printButton]
1 Answers

Since iOS 13, you can use SF Symbols.

Usage is like this: UIImage(systemName: "printer")

If you support lower versions, then you have to add an image to your Asset catalog so you can use it.

Related