我尝试找到如何从另一个我有UISplitViewController的类加载此数据的信息,并且我尝试从1个类的2个不同的类加载Theta里面的很多信息有人可以帮助我吗?

searchController.searchBar.scopeButtonTitles = ["All", "Chocolate", "Hard", "Other"]
tableView.tableHeaderView = searchController.searchBar

candies = [

//I want to load the first2 candy from another Swift class

Candy(category:"go", name:"slow"),
Candy(category:"run", name:"feast"),

//and the least 2 Candy to load from another Swift class

Candy(category:"deanc", name:"good"),
Candy(category:"fly", name:"whery feast"),

最佳答案

对我来说,很难理解您想做什么。但让我试一下:

let candies1 = [Candy(category:"go", name:"slow"),
Candy(category:"run", name:"feast")]

let candies2 =  [Candy(category:"deanc", name:"good"),
Candy(category:"fly", name:"whery feast")]


现在,您可以在所需的任何类和函数中使用candies1和candies2。
让我知道你的想法

10-06 08:45