我有一个UIVIewController,它带有一个集合视图和一个自定义单元格,用于显示来自API端点的一些数据。
此数据是从以下代码中检索的:
private func getItems() {
self.ItemsStartFetch(Text: "Fetching rooms", noItems: noRoomsViewContainer, itemsViewer: collectionContainer)
let roomsController: RoomsController = RoomsController()
roomsController.GetRooms { (status, items) in
// Start Legacy Code
RoomsController.rooms = items
// End Legacy Code
self.items = items
self.ItemsRetrieved(noItemsView: self.noRoomsViewContainer, itemsViewer: self.collectionContainer , showViewer: (items.count > 0))
self.roomCollection.reloadData()
}
}
现在,我需要创建一个完全相同的视图,其中差异将从具有相同estructure的另一个终结点检索数据,但这一次它来自
private func getItems() {
self.ItemsStartFetch(Text: "Fetching designs", noItems: noDesignsViewContainer, itemsViewer: collectionContainer)
let designsController: DesignsController = DesignsController()
designsController.GetDesigns { (status, items) in
// Start Legacy Code
DesignsController.Designs = items
// End Legacy Code
self.items = items
self.ItemsRetrieved(noItemsView: self.noDesignsViewContainer, itemsViewer: self.collectionContainer , showViewer: (items.count > 0))
self.designsCollection.reloadData()
}
}
如何将要使用的控制器注入UIViewConroller?