表达式类型''在没有更多上下文的情况下是模糊的

时间:2017-04-30 20:38:24

标签: swift tuples

这是我的测试脚本代码段。我在尝试将元组分配给常量的行上遇到编译错误。

class Test: UIView {
    struct Properties {
        var properties:  (coordinatesXY: CGPoint, radius: CGFloat, group: String, fillingColor: UIColor)

    }

    var circleCollection: [Properties] = []

    private func getProperties() -> [Properties] {
        return circleCollection

    }

    private func getShape(circleProperties properties: Properties) {
        let (coordinatesXY, radius, group, fillingColor) = properties
        //Error: Expression type 'Test.Properties' is ambiguous without more context
    }

    private func drawTheme(circleProperties properties: Properties) {
        getShape(circleProperties: properties)

    }

    private func drawMainTheme () {
        let properties = getProperties()

        for record in 0...properties.count {

            drawTheme(circleProperties: properties[record])

        }
    }

}

非常感谢这里的任何帮助,非常感谢提前!

0 个答案:

没有答案