In my project I can't access the "Floor" to be used in for each loop. I need to count floors of a bulding in the loop.
// MARK: - UcmData
struct UcmData: Codable {
let buildings: [Building]
}
// MARK: - Building
struct Building: Codable {
let id: Int
let title, subtitle, info, image: String
let floor: [Floor]
}
// MARK: - Floor
struct Floor: Codable {
let number: Int
let title, subtitle, image: String
}
import SwiftUI
import Foundation
struct NamJHerduView: View {
let ucmData = Bundle.main.decode(UcmData.self, from: "ucm_data.json")
var body: some View {
ScrollView {
VStack {
ForEach(0 ..< ucmData.) //here i need to count floors and use maybe where clause to filter just floors from a special building