iosswifticonsuibarbuttonitemhuman-interface

How to use other system icons?


Lately I wanted to include the iOS "star" icon in my NavigationBar. But when I looked at the UIBarButtonItem.SystemItem I noticed that these are limited to 21 icons/images. The "star" and many other icons used in many iOS apps (and even the official Guideline Keynote) are not included.

Is there a way to access them via code?


Solution

  • if you want to use it as assets, There are many icon websites that provide free and paid assets like icons8.

    on another side, if you need those from Xcode there is an only way to make it, use this as UITabBarItem.

    Those are the ones coming from the UITabBarItem init with TabBarSystemItem

    Simple example

    let favoritesItem = UITabBarItem.SystemItem.favorites
    let bar = UITabBar(frame: CGRect(x: 20, y: 20, width: 100, height: 60))
    let barItem = UITabBarItem(tabBarSystemItem: favoritesItem, tag: 0)
    bar.items = [barItem]
    view.addSubview(bar)
    

    See more may you need it here

    You can also extract iOS SDK icons from SDK from here but I prefer to download it.