-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathDynamicViewContent.swift
40 lines (32 loc) · 1.11 KB
/
DynamicViewContent.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
// DynamicViewContent.swift
// OpenSwiftUICore
//
// Audited for iOS 18.0
// Status: Complete
/// A type of view that generates views from an underlying collection of data.
public protocol DynamicViewContent: View {
/// The type of the underlying collection of data.
associatedtype Data: Collection
/// The collection of underlying data.
var data: Data { get }
}
extension ForEach: DynamicViewContent where Content: View {}
extension ModifiedContent: DynamicViewContent where Content: DynamicViewContent, Modifier: ViewModifier {
public var data: Content.Data {
content.data
}
}
package struct DynamicViewContentIDTraitKey: _ViewTraitKey {
package static let defaultValue: Int? = nil
}
package struct DynamicViewContentOffsetTraitKey: _ViewTraitKey {
package static let defaultValue: Int? = nil
}
package struct DynamicContentOffsetVisitor: ViewListVisitor {
package var offset: Int?
package mutating func visit(view: ViewList.View, traits: ViewTraitCollection) -> Bool {
offset = traits.value(for: DynamicViewContentOffsetTraitKey.self)
return false
}
}