::: 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
| Feature | Description |
|---|---|
| 🏠 Homepage UI | Banners, categories, product cards |
| 🛍 Product List | Grid layout with image, price, name |
| 🔎 Search Bar | Filter/search products |
| 📄 Product Detail Page | Description, price, add to cart |
| 🧺 Cart Page | Items, quantity, total price |
| 🔐 Login Page | Phone/email login (see previous guides) |
| 📦 Order History / Checkout | Optional (advanced) |
✅ Tech Stack (for iOS version)
| Layer | Technology |
|---|---|
| UI Framework | SwiftUI |
| State Mgmt | @State, @ObservedObject |
| API Layer | URLSession or Alamofire |
| Backend API | Firebase / Node.js / Django (your choice) |
| Database | Firebase 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:
- Use Firebase Firestore for quick setup (with Firebase Auth + Storage)
- 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
| Feature | How to Add in iOS |
|---|---|
| 🔐 Login | Firebase Auth (phone/email) |
| 🛒 Cart Page | Use @ObservedObject cart model |
| 💳 Checkout | Display summary + mock payment |
| 🔎 Search Filter | Use Searchable {} in iOS 15+ |
| 🖼 Banners | Use TabView with .tabViewStyle(.page) |
| 🌐 API Backend | Firebase / 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.
