syntax - Swift variable declaration trouble -


i'm following guide use syntax declare variable:

let fromview = presenting ? toview : transitioncontext.view(forkey: uitransitioncontextfromviewkey) 

but don't understand syntax: specially question mark , colon (presenting boolean variable).

this allows declare variables based on boolean expressions. saves time don't have write out various if else statements. above expression in question declaring variable based on boolean presenting. if presenting true fromview gets set toview (on left side of colon). if presenting false, fromview gets set transitioncontext.view(forkey: uitransitioncontextfromviewkey) or right side of colon


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -