Вот мой массив
var contacts = [
ExpandableNames(isExpanded: true, names: ["Hong Kong", "Bangkok, Thailand", "London, UK", "Singapore", "Bali, Indonesia", "Dubai, United Arab Emirates", "Paris, France", "New York City, US", "Milan, Italy", "Vienna, Austria", "Shenzhen, China", "Kuala Lumpur, Malaysia", "Phuket, Thailand", "Rome, Italy", "Tokyo, Japan", "Lisbon, Portugal", "Istanbul, Turkey", "Seoul, South Korea", "Amsterdam, Netherlands", "Guangzhou, China", "Prague, Czech Republic", "Mecca, Saudi Arabia", "Rio De Janeiro, Brazil", "Mumbai, India", "Barcelona, Spain", "Pattaya, Thailand", "Shanghai, China", "Antalya, Turkey", "Las Vegas, US"].map{ Contact(name: $0, hasFavorited: false) }),
]
Вот мои структурные переменные в другом файле swift
import Foundation
struct ExpandableNames {
var isExpanded: Bool
var names: [Contact]
//let names: String
}
struct Contact {
let name: String
var hasFavorited: Bool
}