Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot use ButtonRow title in condition #40

Closed
ageorgios opened this issue Oct 16, 2015 · 1 comment
Closed

cannot use ButtonRow title in condition #40

ageorgios opened this issue Oct 16, 2015 · 1 comment

Comments

@ageorgios
Copy link

            $0.hidden = .Function(["login"], { form -> Bool in
                let row: ButtonRow! = form.rowByTag("login")
                return row.title == "Register"   <- this returns EXC_BAD_INSTRUCTION
            })

When trying the above code, i resulted in EXC_BAD_INSTRUCTION

@mtnbarreto
Copy link
Member

@ageorgios
Apparently "login" row was not added yet when the hidden condition is first evaluated. This happens right after the row that has a the hidden property is added to its section. At this time form.rowByTag("login") return nil and row.title throws an Exception.

When the dependent row is added, in this case "login" row, the condition is re-evaluated and form.rowByTag("login") returns it.

So you should replace the code by:

 $0.hidden = .Function(["login"], { form -> Bool in
                let: row: ButtonRow? = form.rowByTag("login") 
                return row?.title == "Register"
            })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants