0
0
iOS Swiftmobile~5 mins

Project structure in iOS Swift

Choose your learning style9 modes available
Introduction

Knowing the project structure helps you find and organize your app files easily.

When starting a new iOS app to understand where to put code and resources.
When adding images or assets to your app.
When you want to find the main app code or user interface files.
When you need to organize your files for teamwork.
When debugging or updating your app later.
Syntax
iOS Swift
MyAppProject/
├── AppDelegate.swift
├── SceneDelegate.swift
├── Assets.xcassets
├── Base.lproj/
│   └── LaunchScreen.storyboard
├── Info.plist
├── ViewController.swift
└── Main.storyboard

AppDelegate.swift manages app life cycle events.

Assets.xcassets holds images and icons.

Examples
Simple project with main app delegate, one screen code, and storyboard UI.
iOS Swift
MyAppProject/
├── AppDelegate.swift
├── ViewController.swift
└── Main.storyboard
Includes assets, app info, launch screen, and extra supporting files.
iOS Swift
MyAppProject/
├── Assets.xcassets
├── Info.plist
├── Base.lproj/
│   └── LaunchScreen.storyboard
└── Supporting Files/
Sample App

This simple app has an AppDelegate that prints a message when the app starts. The ViewController shows a blue screen.

iOS Swift
import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    print("App started")
    return true
  }
}

class ViewController: UIViewController {
  override func viewDidLoad() {
    super.viewDidLoad()
    view.backgroundColor = .systemBlue
  }
}
OutputSuccess
Important Notes

The Info.plist file stores app settings like name and version.

Storyboards define the app screens visually.

Keep your files organized to avoid confusion as your app grows.

Summary

iOS projects have a clear folder and file structure.

AppDelegate and SceneDelegate manage app life cycle.

Assets and storyboards hold images and UI layouts.