wangshengjia / LeeGo

Declarative, configurable & highly reusable UI development as making Lego bricks.
MIT License
966 stars 45 forks source link

Brick.bricks field shares ambiguous name with methods. #71

Closed josephquigley closed 6 years ago

josephquigley commented 6 years ago

In Xcode 9.4.1 (Swift 4.1.2) if you try to get the child bricks for a Brick instance, the compiler complains: Ambiguous reference to member 'bricks(_:layout:)'

Example (using code from DetailsViewController in the Demo App):

let title = "title".build(UILabel.self).style([.numberOfLines(0), .text("Lorem Ipsum is simply dummy text of the printing industry")])
let description = "description".build(UILabel.self).style([.textColor(UIColor.lightGray), .numberOfLines(0), .font(UIFont.systemFont(ofSize: 14)), .text("Lorem Ipsum has been the industry's standard dummy text ever since the 1500s")])
let redBlock = "red".build().style(Style.redBlockStyle)
let greenBlock = "green".build().style(Style.greenBlockStyle)
let blueBlock = "blue".build(UIImageView.self).style(Style.blueBlockStyle + [Appearance.custom(["shadowColor": UIColor.brown, "shadowOpacity": Float(1.0)])])

let blocks = Brick.union("blocks", bricks: [
    redBlock.height(50),
    greenBlock.height(80),
    blueBlock.height(30)],
    axis: .horizontal, align: .top, distribution: .fillEqually, metrics: LayoutMetrics(10, 10, 10, 10, 10, 10)).style(Style.blocksStyle)

Then call add the line:

print(blocks.blocks.count) //Generates compiler error: Ambiguous reference to member 'bricks(_:layout:)'
josephquigley commented 6 years ago

Didn't notice that Brick.bricks is internal.