Being a leading iOS app development company in Ahmedabad, India, iPad/ iPhone app developers at Let’s Nurture are pretty much aware of Project Setup and its importance. In this article, we have tried to explain the format of iOS project structure followed by our iOS development team.

How our iOS Developers setup Project Structure?

The project setup is root of the whole project where in every required libraries and frameworks are added into the project. As in iOS Projects, there always are requirements of third party libraries which takes much time to install and link its frameworks with the project. Apart from that, Objective C/Swift files for maintaining the necessary functions, constants and model classes are setup.

With every project setup, there should be proper format and hierarchy while creating new project. The following is the picture of project setup:

ios project structure setup
ios project structure setup

App Constant

Constants.swift

App constant is the most important part of the project where constant values are mentioned. Functions which are used repeatedly in the project are also can be mentioned in App constant file. To include all values and functions, you have to create Constants.swift under the AppConstant folder.

AppModel + Structure + Enum

AppModel, Structure and Enum files needs to create under AppModel + Structure + Enum folder name.

AppModel.swift

Model class is inherited from the NSObject class, used to convert the webservice response to Models. These models are the easier way to use in the project and it can be written under Models.swift file.
For example:
class UserData : NSObject {
var message = “”
var status = “”
}

Structure.swift

Structures can be written under the Structure.swift where keys and values are mentioned. To create structure, struct keyword is used.
For example:
struct SwitchFilter {
var minPrice = “”
var maxPrice = “”
var status = false
}

Enum.swift

All common messages and alerts can be written in Enum.swift
For example:
enum PopUpMessage : String {
case SomethingWrong = “Something went wrong. Please try again later.”
case EmptyString = “Please fill all the field”
}

AppExtension

App extension folder contains extension file as well as rest api and web services file.

Extension.swift

Extension file contains extensions of UIViewController, UIVIew, String etc. which are repeatedly using in the project. Suppose a developer wants to rotate views with the animation then he/she should create extension under extension.swift file.

For example:
extension UIView {
func rotate(_ toValue: CGFloat, duration: CFTimeInterval = 0.2) {
let animation = CABasicAnimation(keyPath: “transform.rotation”)
animation.toValue = toValue
animation.duration = duration
animation.isRemovedOnCompletion = false
animation.fillMode = kCAFillModeForwards
self.layer.add(animation, forKey: nil)
}
}

RestAPI.swift

GET, POST, DELETE API methods can be written under Rest API file. These methods are common when can be used frequently for calling web services.

WebServices.swift

All web service calls of the project needs to be mentioned in WebServices.swift file. It is mentioned under particular extension of swift class.

AppURL

AppURL folder contains AppUrl.swift file where URLs can be written.

AppUrl.swift

Every URL which are used in web service calling needs to be mentioned in AppURL.swift file.
The common URL can be defined as constant value and rest of the parts can be written with enum of URLs.

AppClass

AppClass folder contains bunch of third party classes which are used in the project. While setting up the project, it is best practice to predefine common third party libraries in the project under app classes folder. When you’re creating project with swift language and using objective c third party libraries, then the class name of those libraries needs to be mentioned in Appname-Bridging-Header.h file.

AppController

Application View Controller’s reference classes are mentioned under this folder. For instance there is Login screen in storyboard then Login.swift file needs to be created under App controller folder.

AppPopupView

Reference classes of all Popups is to be created under AppPopupView folder. UI of PopupView is mentioned under Popup.storyboard file.

AppDelegate

AppDelegate is a root class of the project. When project is build, the method of appdelegate class calls first. Along with that, methods of notification register, receive notifications, application active, foreground and background related methods are written in appdelegate file.

CocoaPods

CocoaPods is the dependency manager for Objective-C / Swift projects. It has thousands of libraries and can help you to scale your projects elegantly. Ultimately, its goal is to improve discoverability of, and engagement in, third party open-source libraries, by creating a more centralized ecosystem.

To install pods, one should create Podfile first then add all required pods name and install them in the project. If Objective-C file doesn’t support in Swift project then classname must be defined in Appname-Bridging-Header.h file.

LaunchScreen.storyboard

Launchscreen storyboard contains splash screen of the project. Splash screen appears when app is opened.

Main.storyboard

Main storyboard contains all UIViewControllers of the project where design of the project is done. The best practice to create UI is with Autolayout constraint which results same output for all devices of iPhone.

Popup.storyboard

The Popup storyboard contains popup views like it appears as an custom alert in an iOS app. Instead of using third party libraries to show alert, it is best practice to create our own pop up so it can be modified as per the requirement in the future.

Assets.xcassets

App icons, splash screen and all images required in the project are added in assets of the project. The proper naming convention must be used to understand easily. To exemplify it, if the image is used for the password then it can be written like ic_password.

Info.plist

The information property list is a file named Info.plist that is included with every iPhone application project created by Xcode. It is a property list whose key-value pairs specify essential runtime-configuration information for the application. The elements of the information property list are organized in a hierarchy in which each node is an entity such as an array, dictionary, string, or other scalar type. If there is requirement of Location, Camera in the application then it is best practice to take permission before proceed for that functionality. Below are some examples of permission:

Location Permission

Key: Privacy – Location Usage Description
Value: App Uses location services in order to show appropriate data based on location to user

Camera Permission

Key: Privacy – Camera Usage Description
Value: App uses camera to capture photos

Projectname.xcdatamodeld

While creating a new project, if “Use Core Data” option is selected then this file will be automatically added to the project. It contains entities, fetch requests and configurations. Entity can be added using Add Entity options as well as attribute can be added using Add Attribute option. The main purpose to create this file is, used for Core Data functionality of the project.

AppName-Bridging-Header.h

Bridging header file is bridge among Objective-C libraries and swift libraries. Whenever objective c files are used in swift projects then bridging file must be required for the interaction between both language libraries. In most of cases, it is created automatically when Objective-C files are added to the project but in case it is not created, then one should create it manually and assign it to Build Settings > Objective-C Bridging Header option.

How Let’s Nurture helps for iOS app development?

Let’s Nurture, a leading IT company known for custom mobile app development in India has got the expertise in providing many solutions based on iPhone application development, also using Multilingual language. Based on Multilingual mobile application development, we at Let’s Nurture can provide solutions for people, knowing only one or native language.

If you want to know more about iOS application development or want to implement this technology in your existing mobile app, get a free consultation from our experts at Let’s Nurture in order to hire iOS app developers at affordable price.

Want to work with us? We're hiring!