The trailing closure is beautiful!
Jacob Carlborg
doob at me.com
Fri Dec 11 19:38:51 UTC 2020
On 2020-12-10 17:05, zoujiaqing wrote:
> On Tuesday, 8 December 2020 at 11:07:19 UTC, Jacob Carlborg wrote:
>> On Monday, 7 December 2020 at 19:37:43 UTC, zoujiaqing wrote:
>>> In swift:
>>>
>>> ```
>>> import SwiftUI
>>>
>>> struct ContentView: View {
>>> var body: some View {
>>> Text("Hello World")
>>> }
>>> }
>>> ```
>>
>> I don't think these are trailing closures.
>>
>> --
>> /Jacob Carlborg
>
> Look this:
In your example, the first curly brace is for the body of the struct.
The second curly brace is for the body of the a read only computed
property [1]. Yes, Swift does have trailing closures, but unfortunately
your example didn't include any.
[1] https://docs.swift.org/swift-book/LanguageGuide/Properties.html#ID261
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list