iOS App Icons

Here we will learn iOS app icons in swift with example and how to set or add an app icon to iOS swift application in Xcode with example.

iOS App Icons

In iOS, if we create any app its necessary to set a beautiful image as an app icon because the same icon will appear in iOS devices home screen whenever our iOS app has been installed by users. Following is the sample image which showing different iOS apps with icons.

 

iOS Apps with Icons Sample Example

 

If we set an icon for ios apps that will help users to identify apps easily.

App Icon Sizes

For any app, we need to set both small and large app icons because the small icon will appear on the device's home screen and throughout the system once our app is installed and the large icon is used by the App Store.

 

DeviceSmall Icon SizeLarge Icon Size
iPhone 6s Plus, iPhone 6 Plus 120px x 120px 87px x 87px
iPhone 6s, iPhone 6, iPhone SE 80px x 80px 58px x 58px
iPad Pro, iPad, iPad mini 80px x 80px 58px x 58px

Now we will see how to add or set iOS app icon for swift applications in xcode with example.

Create iOS New App in Xcode

To create a new project in iOS open Xcode from /Applications folder directory. Once we open Xcode the welcome window will open like as shown below. In the welcome window click on the second option “Create a new Xcode Project” or choose File à New à Project.

 

Xcode application to create ios project

 

After selecting “Create a new Xcode project” a new window will open in that we need to choose a template.

 

The new Xcode window will contain several built-in app templates to implement the common types of iOS apps like page-based apps, tab-based apps, games, table-view apps, etc. These templates are having a pre-configured interface and source code files. 

 

For this iOS App Icon example, we will use the most basic template “Single View Application”. To select this one, Go to the iOS section on the left side à select Application à In the main area of dialog select “Single View Application” and then click on next button like as shown below.

 

Select single view application from ios xcode templates

 

After click Next we will get a window like as shown below. In this, we need to mention the project name and other details for our application.

 

Product Name: “App Icon in iOS”

 

The name whatever we enter in the Product Name section will be used for the project and app.

 

Organization Name: “Tutlane”

 

You can enter the name of your organization or your own name or you can leave it as blank.

 

Organization Identifier: “com.developersociety”

 

Enter your organization identifier in case if you don't have any organization identifier enter com.example.

 

Bundle Identifier: This value will generate automatically based on the values we entered in the Product Name and Organization Identifier.

 

Language: “Swift”

 

Select language type as “Swift” because we are going to develop applications using swift.

 

Devices: “Universal”

 

Choose Devices options as Universal it means that one application is for all Apple devices in case if you have any specific requirement to run an app only for iPad then you can choose the iPad option to make your application restricted to run only on iPad devices.

 

Use Core Data: Unselected

 

This option is used for database operations. In case if you have any database related operations in your application select this option otherwise unselect the option.

 

Include Unit Tests: Unselected

 

In case if you need unit tests for your application then select this option otherwise unselect it.

 

Include UI Tests: Unselected

 

In case if you need UI tests for your application then select this option otherwise unselect it.

 

Once you finished entering all the options then click on the Next button like as shown below.

 

ios app icon create new app in xcode editor

 

Once we click on the Next button new dialog will open in that we need to select the location to save our project. Once you select the location to save the project then click on Create button like as shown below.

 

Give path to save new ios application in xcode

 

After clicking on the Create button, the Xcode will create and open a new project. In our project, Main.storyboard and ViewController.swift are the main files that we used to design the app user interface and to maintain source code. 

 

Main.storyboard - Its visual interface editor and we will use this file to design our app user interface 

 

ViewController.swift - It contains the source code of our application and we use this file to write any code related to our app.

 

Now in project select Main.storyboard file, the Xcode will open visual interface editor like as shown below.

 

ios app icon storyboard file in xcode

 

Now select ViewController.swift file in your project that view will be like as shown below.

 

ios app icon viewcontroller.swift file in xcode editor

Add Icon for iOS App in Xcode

To add an icon for the application, click on Assets.xcassets in your project navigator à then Click on AppIcon à then It will show an empty app icon set like as shown below. Now drag the right sized image (.png) from Finder and drop into every blank in the Spotlight boxes.

 

Add images to set iOS app icon in xcode editor

 

If we drag and drop app icon in the spotlight that will be like as shown below

 

After adding icon to ios app in xcode editor

 

Now we will run and check the output of the application. To run the application, select the required simulator (Here we selected iPhone 6s Plus) and click on the Play button, located at the top-left corner of the Xcode toolbar like as shown below.

 

ios run application using simulator in xcode

Output of iOS App Icons Example in Swift

Following is the result of the iOS app icons example in swift. If you observe below result app icon is set for the application which we created in swift.  If you want to see the app icon press Ctrl+Shift+H button while running the app.

 

ios application example result after setting app icon

 

This is how we can set the icon for iOS applications in Xcode editor based on our requirements.