2
votes

I would like to set the Quick Action share icon found at the link below to a UIButton. Is that possible? This is my code for using a custom button

let addButton = UIButton()
addButton.setImage(UIImage(named: "Share.png"), for: .normal) 

https://developer.apple.com/ios/human-interface-guidelines/graphics/system-icons/

1
You can use QuickLook preview controller to preview your file (it will also add the action button) developer.apple.com/reference/quicklook/qlpreviewcontroller - Leo Dabus

1 Answers

2
votes

iOS 12 and earlier:

We cannot load a system icon like that. However, there are several types of button types we can use to initialise to get some system icons:

  • contactAdd
  • detailDisclosure
  • infoDark
  • infoLight

Unfortunately you need to design the share icon that you need.


iOS 13 and later:

As of iOS 13 and later, SF Symobls can be used to get a ton of system icons (over a 1000) with high quality rendering to be used in your apps.

So, the share icon you wanted can be used like so:

addButton.setImage(UIImage.init(systemName: "square.and.arrow.up"), for: .normal)