File tree 4 files changed +73
-11
lines changed
4 files changed +73
-11
lines changed Original file line number Diff line number Diff line change
1
+ //
2
+ // ProtocolDescriptor.swift
3
+ // OpenSwiftUI
4
+ //
5
+ // Audited for RELEASE_2021
6
+ // Status: WIP
7
+
8
+ internal import COpenSwiftUI
9
+
10
+ // MARK: - ProtocolDescriptor
11
+
12
+ protocol ProtocolDescriptor {
13
+ static var descriptor : UnsafeRawPointer { get }
14
+ }
15
+
16
+ // MARK: - TupleDescriptor
17
+
18
+ protocol TupleDescriptor : ProtocolDescriptor {
19
+ static var typeCache : [ ObjectIdentifier : TupleTypeDescription < Self > ] { get set }
20
+ }
21
+
22
+ extension TupleDescriptor where Self == ViewDescriptor {
23
+ // static func tupleDescription(__C.AGTupleType) -> SwiftUI.TupleTypeDescription<A>
24
+ }
25
+
26
+ // MARK: - TupleTypeDescription
27
+
28
+ struct TupleTypeDescription < PD: ProtocolDescriptor > {
29
+ let contentTypes : [ ( Int , TypeConformance < PD > ) ]
30
+ }
31
+
32
+ // MARK: - ViewDescriptor
33
+
34
+ struct ViewDescriptor : TupleDescriptor {
35
+ static var descriptor : UnsafeRawPointer {
36
+ _viewProtocolDescriptor ( )
37
+ }
38
+
39
+ // FIXME
40
+ static var typeCache : [ ObjectIdentifier : TupleTypeDescription < ViewDescriptor > ] = [ : ]
41
+ }
Original file line number Diff line number Diff line change
1
+ //
2
+ // TypeConformance.swift
3
+ // OpenSwiftUI
4
+ //
5
+ // Audited for RELEASE_2021
6
+ // Status: Complete
7
+
8
+ struct TypeConformance < PD: ProtocolDescriptor > {
9
+ var metadata : UnsafeRawPointer
10
+ var conformance : UnsafeRawPointer
11
+
12
+ init ? ( _ type: Any . Type ) {
13
+ guard let conformance = swiftConformsToProtocol ( type, PD . descriptor) else {
14
+ return nil
15
+ }
16
+ self . metadata = unsafeBitCast ( type, to: UnsafeRawPointer . self)
17
+ self . conformance = conformance
18
+ }
19
+ }
20
+
21
+ func conformsToProtocol( _ type: Any . Type , _ protocolDescriptor: UnsafeRawPointer ) -> Bool {
22
+ swiftConformsToProtocol ( type, protocolDescriptor) != nil
23
+ }
24
+
25
+ @_silgen_name ( " swift_conformsToProtocol " )
26
+ @inline ( __always)
27
+ private func swiftConformsToProtocol(
28
+ _ type: Any . Type ,
29
+ _ protocolDescriptor: UnsafeRawPointer
30
+ ) -> UnsafeRawPointer ?
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 6
6
// Status: Complete
7
7
8
8
protocol ViewVisitor {
9
- func visit< V: View > ( _ view: V )
9
+ mutating func visit< V: View > ( _ view: V )
10
10
}
11
11
12
12
protocol ViewTypeVisitor {
13
- func visit< V: View > ( type: V . Type )
13
+ mutating func visit< V: View > ( type: V . Type )
14
14
}
You can’t perform that action at this time.
0 commit comments