0
0
iOS Swiftmobile~15 mins

Project structure in iOS Swift - Mini App: Build & Ship

Choose your learning style9 modes available
Build: Simple Project Structure Overview
This screen shows a basic iOS app project structure with folders and files listed. It helps beginners understand where code and resources go.
Target UI
Project Structure

- MyApp
  - AppDelegate.swift
  - SceneDelegate.swift
  - ViewController.swift
  - Assets.xcassets
  - Info.plist
  - Base.lproj
    - LaunchScreen.storyboard
Display a list showing main project folders and files
Use indentation to show folder hierarchy
Use simple text labels for files and folders
Screen title should be 'Project Structure'
Starter Code
iOS Swift
import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack(alignment: .leading) {
            Text("// TODO: Add project structure list here")
                .padding()
        }
        .navigationTitle("Project Structure")
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
Task 1
Task 2
Task 3
Solution
iOS Swift
import SwiftUI

struct ContentView: View {
    var body: some View {
        ScrollView {
            VStack(alignment: .leading, spacing: 6) {
                Text("MyApp")
                    .font(.headline)
                    .padding(.bottom, 4)
                Group {
                    Text("AppDelegate.swift")
                        .padding(.leading, 20)
                    Text("SceneDelegate.swift")
                        .padding(.leading, 20)
                    Text("ViewController.swift")
                        .padding(.leading, 20)
                    Text("Assets.xcassets")
                        .padding(.leading, 20)
                    Text("Info.plist")
                        .padding(.leading, 20)
                }
                Text("Base.lproj")
                    .font(.headline)
                    .padding(.top, 8)
                Text("LaunchScreen.storyboard")
                    .padding(.leading, 20)
            }
            .padding()
        }
        .navigationTitle("Project Structure")
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        NavigationView {
            ContentView()
        }
    }
}

This SwiftUI view uses a vertical stack to list the main folders and files of a simple iOS project. Indentation is done by adding padding to the left for files inside folders. The ScrollView ensures the content can scroll if the screen is small. The navigation title clearly shows the screen purpose. This structure helps beginners visualize where code and resources are placed in an iOS app project.

Final Result
Completed Screen
Project Structure

MyApp
  AppDelegate.swift
  SceneDelegate.swift
  ViewController.swift
  Assets.xcassets
  Info.plist
Base.lproj
  LaunchScreen.storyboard
User can scroll vertically if content is too long
Screen title 'Project Structure' is visible at top
Stretch Goal
Add icons next to folders and files to visually distinguish them
💡 Hint
Use SF Symbols with Image(systemName:) for folder and file icons and place them before the text labels