Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Created June 23, 2020 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupamchugh/dcbbd53c7b0b6248777a066b671beb0a to your computer and use it in GitHub Desktop.
Save anupamchugh/dcbbd53c7b0b6248777a066b671beb0a to your computer and use it in GitHub Desktop.
public class DataFetcher: ObservableObject {
@Published var dataModel = [DataModel]()
init() {
var nestedMenu : [DataModel] = []
for i in 0...5 {
nestedMenu.append(DataModel(name: "Sub Item \(i)", icon: "calendar"))
}
self.dataModel = [
DataModel(name: "Item 1", icon: "book.circle", children: [DataModel(name: "Sub Item 1", icon: "tv.fill", children: [DataModel(name: "Double Sub Item 1", icon: "headphones")])]),
DataModel(name: "Item 2", icon: "printer"),
DataModel(name: "Item 3", icon: "wifi"),
DataModel(name: "Item 4", icon: "person.circle", children: nestedMenu),
DataModel(name: "Item 5", icon: "hand.raised", children: nestedMenu),
DataModel(name: "Item 6", icon: "zzz", children: nestedMenu)
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment