- SwiftUI + async/await architecture - Barcode scanning with AVFoundation - Product display with score ring, NOVA badge, nutrition - Alternatives with sort/filter - Auth (login/register) - Favorites & history - Account management - Dark theme - Connected to food.payfrit.com API (Open Food Facts proxy) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
1.2 KiB
Swift
40 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
struct IngredientsSection: View {
|
|
let ingredients: String
|
|
@State private var isExpanded = false
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 12) {
|
|
Button {
|
|
withAnimation {
|
|
isExpanded.toggle()
|
|
}
|
|
} label: {
|
|
HStack {
|
|
Image(systemName: "list.bullet")
|
|
.foregroundColor(.green)
|
|
Text("Ingredients")
|
|
.font(.headline)
|
|
.foregroundColor(.primary)
|
|
Spacer()
|
|
Image(systemName: isExpanded ? "chevron.up" : "chevron.down")
|
|
.foregroundColor(.secondary)
|
|
}
|
|
}
|
|
|
|
if isExpanded {
|
|
Text(ingredients)
|
|
.font(.subheadline)
|
|
.foregroundColor(.secondary)
|
|
.padding()
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.background(Color(.systemGray6))
|
|
.cornerRadius(12)
|
|
}
|
|
}
|
|
.padding()
|
|
.background(Color(.secondarySystemBackground))
|
|
.cornerRadius(16)
|
|
}
|
|
}
|