[ ] UICollectionViewCell |
Keynote WWDC 2019 SwiftUI, UI , , . , :
enum Builder {
static func widgets(objects: Objects) -> [Widget] {
let header = [
Spacing(height: 25).widget,
Header(string: " ").widget,
Spacing(height: 10, separator: .bottom).widget
]
let body = objects
.flatMap({ (object: Object) -> [Widgets] in
return [
Title(object: object).widget,
Spacing(height: 1, separator: .bottom).widget
]
})
return header + body
}
}
let objects: [Object] = ...
Builder
.widgets(objects: objects)
.bind(to: collectionView)
:
→https://habr.com/ru/post/455421/?utm_source=habrahabr&utm_medium=rss&utm_campaign=455421