i follow tutorial and find this code:
self.imageView.frame = (CGRect){.origin = CGPointMake(0.0f, 0.0f), .size = image.size};
Its pretty clear What it does, but I'm not understand syntax of this line of code. First time i see something like this: .size = image.size
. In dot syntax i expect to see something in front of dot, like self.view
, but what is meaning of .size
?
Second question is - why there is round brackets and after them curly brackets? I never seen structure like that (){};
before.
My question may sound silly, but now I'm a bit confused, can someone provide explanation? Thank you.
syntax, the arrangement of words in sentences, clauses, and phrases, and the study of the formation of sentences and the relationship of their component parts.
"Syntax skills help us understand how sentences work—the meanings behind word order, structure, and punctuation. By providing support for developing syntax skills, we can help readers understand increasingly complex texts" (Learner Variability Project).
Four common syntax errors For example: Incorrect: “She enjoys cooking her family and her dog.” Correct: “She enjoys cooking, her family, and her dog.” Using sentence fragments instead of complete sentences is sometimes okay when writing is meant to be conversational.
This is the Designated Initializer syntax of C structs. The parentheses ()
are used to cast the struct to a CGRect
. As Martin R points out, the cast is not necessary unless you use compound literal syntax, where you don’t name the parameters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With