2016-12-07 129 views
0

我有一个模型,它看起来像这样:声明迅速类2种依赖泛型类型

  • 比赛 - 表项目

而且还我” - 竞争

  • 比赛名单m会创建很多这样的列表并将它们显示在不同的ViewController中。

    class Competition : ServerConfiguredObject { 
    
        var caption = "" 
    
        override func confirure(_ response: DictionaryWithStringKeys) { 
         caption = response["caption"] as! String 
        } 
    } 
    
    class Competitions : ServerConfiguredObjectsStorage <Competition> { 
    
    } 
    

    我的目标是要申报的viewController像这样:

    typealias CompetitionsViewController = ServerConfiguredObjectsViewController <Competition, Competitions> 
    

    所以我宣布视图控制器,并添加集合类集合项目类为模板。我有一个错误。

    首先efford:

    class ServerConfiguredObjectsViewController 
        <ServerConfiguredObjectsStorageClass: 
         ServerConfiguredObjectsStorage<ServerConfiguredObjectClass:ServerConfiguredObject>> : UIViewController 
    

    编译错误(与类声明的字符串被高亮显示):

    MyClassFullPath.swift:11:141:预期 '>' 完成一般的参数列表

    第二个效果:

    class ServerConfiguredObjectsViewController 
        <ServerConfiguredObjectClass:ServerConfiguredObject, 
        ServerConfiguredObjectsStorageClass: 
         ServerConfiguredObjectsStorage<ServerConfiguredObjectClass>> : UIViewController 
    

    斯威夫特编译器错误(与类声明字符串不高亮显示):

    命令/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc失败退出代码1

    您如何看待。在第二种情况下它是一个快速的BUG吗?(我想迅速至少必须突出声明字符串)。

    PS

    我能够理解为什么这是行不通的。但我的目标是让它工作。我会很感激任何建议。

    无论如何,感谢您的关注。

  • 回答

    1

    问题的第一部分很容易回答:无论你扔什么艺术品,swift编译器都不应该崩溃。用Apple提交错误报告。

    +0

    我发送了错误报告。 – ZevsVU