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

ios - Is 'init' forbidden as *part* of a variable name? -

c# - Get the Class name in a class with atribute inside a attribute method -

file - Python: AttributeError: 'str' object has no attribute 'readlines' -