robb / Cartography

A declarative Auto Layout DSL for Swift :iphone::triangular_ruler:
Other
7.35k stars 525 forks source link

error: cannot invoke 'constrain' with an argument list of type #243

Closed samkhawase closed 7 years ago

samkhawase commented 7 years ago

I'm using Cartography 0.7 and Swift 2.3/XCode7.3 with Carthage and I get the following error when I use the constrain method on two views

MyViewController.swift:44:9: error: cannot invoke 'constrain' with an argument list of type '(UITableView!, UITabBarItem!, (_, _) -> _)'
        constrain(tracksTableView, tabBarItem) { (view1, view2) in
        ^
MyViewController.swift:44:9: note: expected an argument list of type '(View, View, replace: ConstraintGroup, block: @noescape (LayoutProxy, LayoutProxy) -> ())'
        constrain(tracksTableView, tabBarItem) { (view1, view2) in

constrain works fine if used only on 1 view like

constrain(tableView) { view in 
    view.top == view.superview.top
}

Does anyone know why it's trying to look for (View, View, replace: ConstraintGroup, block: @noescape (LayoutProxy, LayoutProxy) -> ())?

vfn commented 7 years ago

@samkhawse UITabBarItem is not a subclass of UIView.

https://developer.apple.com/reference/uikit/uitabbaritem