mamaral / Neon

A powerful Swift programmatic UI layout framework.
MIT License
4.58k stars 389 forks source link

Views array fatal error #40

Closed aliencode closed 7 years ago

aliencode commented 8 years ago
        var views:[UIView] = []
        let view1 = UIView()
        view1.backgroundColor = UIColor.redColor()
        let view2 = UIView()
        view2.backgroundColor = UIColor.greenColor()

        view.addSubview(view1)
        view.addSubview(view2)

        views.append(view1)
        views.append(view2)

        view.groupAndFill(group: .Horizontal, views: views, padding: 10)

fatal error: array cannot be bridged from Objective-C

cbh2000 commented 8 years ago

I'm not sure why, but a workaround is:

view.groupAndFill(group: .Horizontal, views: views.map { $0 }, padding: 10)

I think it's a Swift bug.

mamaral commented 8 years ago

What version of Swift/Xcode are you on?