App crash. fatal error: array cannot be bridged from Objective-C

Originator:konstantin.koval1
Number:rdar://18878970 Date Originated:05-Nov-2014 12:03 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.1 (6A1052d)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
App crashes. 

Here is my code // 

//
//  ArmaturListViewModel.swift
//  
//
//  Created by Konstantin Koval on 29/10/14.
//
//

import UIKit

class ArmaturListViewModel: RobotViewModel {
   var tableModel = Factory.tableModel()
 }

private extension ArmaturListViewModel {

  private class Factory {
    
    class func tableModel() -> ArrayTableViewModel<ArmaturType> {
      func armaturs() -> [Armatur] {
        return [
          Armatur(name: "Glamox 123", length: 1200, holesDistance: 800),
          Armatur(name: "Glamox 450", length: 1000, holesDistance: 500)]
      }
      return ArrayTableViewModel(items:armaturs()) // crash here!!!

    }
  }
}

// ArrayTableViewModel
protocol TableViewModelType {

  typealias Element
  var sections: Int { get}
  func numberOfRowsInSection(section: Int) -> Int
  subscript (i: NSIndexPath) -> Element { get }
}

class ArrayTableViewModel<T> : TableViewModelType {

  var items: Array<T>
  var sections = 0
  
  init (items: Array<T>) {
    self.items = items
  }

  func numberOfRowsInSection(section: Int) -> Int {
    return items.count
  }
  
  subscript (i: NSIndexPath) -> T {
    return items[i.row]
  }
}

// Model
protocol ArmaturType {
  var name: String {get}

  var length: Int {get}
  var holesDistance: Int {get}
}

class Armatur: ArmaturType {
  let name: String
  let length: Int
  let holesDistance: Int
  
  init(name: String, length: Int, holesDistance: Int) {
    self.name = name
    self.length = length
    self.holesDistance = holesDistance
  }
}



Steps to Reproduce:
Run app, it crash

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!