Variable binding in a condition requires an initializer: Need help to solve

Hello


Need so help here! None of the examples I've found work:

Here's my code: I have two predicates "2" and "ELA" to open a specific plist file. I have it working with one but need to use both.

When I try the construction below i get error : "Variable binding in a condition requires an initializer"


if case "2", case "ELA" = passedFromA { //Variable binding in a condition requires an initializer
            let filePath = Bundle.main.path(forResource: "Grade2ELA", ofType: "plist")//  passedFromA is optional, need to test for nil
            print("filePath", filePath!)
            figures = Figure.figuresList(filePath!)
                                print("figures count", figures.count)
                                print ("FProcess G")
                    let getdata = "\(String(describing: appDelegate?.nameGrade))"
                    print("Check data : \(getdata)")
}

You will actually need to do it as two independent tests:


if case "2" = passedFromA, case "ELA" = passedFromA


I'm not aware of any shorthand syntax that will test them both at the same time. If you end up needing to do a lot of that, you might trying using a type that conforms to OptionsSet.

Hi:


Thanks for the response.

I'll try separating them.

Hello:

The simple solution I found was this:


if  "2" == passedFromA1 && "ELA" == passedFromA2
Variable binding in a condition requires an initializer: Need help to solve
 
 
Q