Xcode 7 Swift 2 impossible to instantiate UIViewController subclass of generic UITableViewController

前端 未结 2 1019
别那么骄傲
别那么骄傲 2020-12-04 02:23

I have a generic class:

class PaginatedTableViewController
  

        
2条回答
  •  旧巷少年郎
    2020-12-04 02:47

    Unfortunately, generic Swift classes are not visible to Objective-C code and also are not supported in Interface Builder (in storyboards and xibs). I find these two points closely related.

    As a solution I would suggest you to use aggregation: do not make you view controller generic, but extract some logic to another (generic) class and use it inside your view controller.

提交回复
热议问题