How can I read "declaration" in Apple Developer Documentation?

Hello all.

I'm a begginer of SwiftUI.Currently learning the grammar of Swift using Apple Developer Documentation,though there was one point I couldn't understand.

example:

var rowHeight: CGFloat { get set }

This is a instance property of UITableView class.In Apple Developer Documentation,it is declared as mentioned above.

But when I look inside UITableView class scope by using "Jump to Definition",this property is declared as following:

var rowheight: CGFloat

I know properties must be defined with { get set }/{set} in protocols,but rowheight property isn't defined in any protocols.

So why { get set } is written in UITableView class scope at Apple Developer Documentation?

Accepted Answer
var rowHeight: CGFloat { get set }

{ get set } are here to simply express that the property may be read (hopefully) but also modified (set).

UITableView class scope by using "Jump to Definition", the property is simply declared:

var rowheight: CGFloat

as a var, it is read/write

If you declared as:

let rowheight: CGFloat

that would be read only.

Thank you for answering.I understand.

var rowHeight: CGFloat { get set }

So this is not related to wheter rowheight property is defined in a protocol,is it?

it's just a specification of Apple Developer Documentation?

when I look inside UITableView class scope by using "Jump to Definition"

As a general rule, learning a language by reading the source of its standard library is a bad idea.

For various reasons, system libraries in most languages often contain unusual constructs that should never appear in "normal" code.

Swift is not the worst in this respect, but I would still advise using "Jump to definition" etc. only for navigating within your own code.

How can I read "declaration" in Apple Developer Documentation?
 
 
Q