::: ecommerce page app ios for shopee

Creating an iOS e-commerce app like Shopee requires both UI design and backend integration. Below is a structured approach to building a Shopee-style e-commerce page in SwiftUI, suitable for iOS.


🧱 Key Features to Include

FeatureDescription
🏠 Homepage UIBanners, categories, product cards
🛍 Product ListGrid layout with image, price, name
🔎 Search BarFilter/search products
📄 Product Detail PageDescription, price, add to cart
🧺 Cart PageItems, quantity, total price
🔐 Login PagePhone/email login (see previous guides)
📦 Order History / CheckoutOptional (advanced)

✅ Tech Stack (for iOS version)

LayerTechnology
UI FrameworkSwiftUI
State Mgmt@State, @ObservedObject
API LayerURLSession or Alamofire
Backend APIFirebase / Node.js / Django (your choice)
DatabaseFirebase Firestore, Supabase, or custom REST API

🎨 UI Example: Shopee-Style Product Grid (SwiftUI)

swiftCopyEditstruct Product: Identifiable {
    let id: Int
    let name: String
    let price: Double
    let image: String
}

struct ProductGridView: View {
    let products: [Product] = [
        Product(id: 1, name: "Smartphone", price: 8999, image: "phone"),
        Product(id: 2, name: "Shoes", price: 2999, image: "shoes"),
        Product(id: 3, name: "Backpack", price: 1299, image: "bag")
    ]

    let columns = [GridItem(.flexible()), GridItem(.flexible())]

    var body: some View {
        NavigationView {
            ScrollView {
                LazyVGrid(columns: columns, spacing: 16) {
                    ForEach(products) { product in
                        NavigationLink(destination: ProductDetailView(product: product)) {
                            VStack {
                                Image(product.image)
                                    .resizable()
                                    .scaledToFit()
                                    .frame(height: 120)
                                Text(product.name)
                                    .font(.headline)
                                    .lineLimit(1)
                                Text("฿\(String(format: "%.2f", product.price))")
                                    .foregroundColor(.red)
                            }
                            .padding()
                            .background(Color(.systemBackground))
                            .cornerRadius(12)
                            .shadow(radius: 2)
                        }
                    }
                }
                .padding()
            }
            .navigationTitle("Shop")
        }
    }
}

📦 Product Detail Page

swiftCopyEditstruct ProductDetailView: View {
    let product: Product
    @State private var quantity = 1

    var body: some View {
        VStack(spacing: 20) {
            Image(product.image)
                .resizable()
                .scaledToFit()
                .frame(height: 200)

            Text(product.name).font(.title)
            Text("฿\(product.price, specifier: "%.2f")")
                .font(.title2)
                .foregroundColor(.red)

            Stepper("Quantity: \(quantity)", value: $quantity, in: 1...10)

            Button("Add to Cart") {
                // Save to cart state
            }
            .padding()
            .background(Color.orange)
            .foregroundColor(.white)
            .cornerRadius(8)

            Spacer()
        }
        .padding()
    }
}

🔗 Backend Options

You can:

  1. Use Firebase Firestore for quick setup (with Firebase Auth + Storage)
  2. Or connect to a custom REST API (Node.js or Python)

Sample fetch from JSON API:

swiftCopyEditfunc fetchProducts() {
    guard let url = URL(string: "https://your-api.com/products") else { return }
    URLSession.shared.dataTask(with: url) { data, _, _ in
        if let data = data {
            let products = try? JSONDecoder().decode([Product].self, from: data)
            DispatchQueue.main.async {
                self.products = products ?? []
            }
        }
    }.resume()
}

📱 Additions to Make It Like Shopee

FeatureHow to Add in iOS
🔐 LoginFirebase Auth (phone/email)
🛒 Cart PageUse @ObservedObject cart model
💳 CheckoutDisplay summary + mock payment
🔎 Search FilterUse Searchable {} in iOS 15+
🖼 BannersUse TabView with .tabViewStyle(.page)
🌐 API BackendFirebase / Supabase / custom Node.js

✅ Summary

You now have:

  • 🏠 Homepage (grid + banner)
  • 📄 Product detail page
  • 🧺 Cart-ready interaction
  • 🔐 Login with Firebase (optional)
  • 🔁 Fully SwiftUI with ability to connect backend

Would you like:

  • A full GitHub project link with this template?
  • Firebase Firestore integration and real data example?
  • Supabase backend connected version?

Let me know and I’ll generate it for you.