-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update ViewDebug and OG version * Update View location * Update View Accessor * Add AnyViewInfo and AnyViewStorageBase * Update AnyViewContainer * Add intern implementation * Update AnyView._makeView * Update AnyViewStorage * Update AnyView and ViewDebug.makeView * Fix GraphHost crash bug * Fix Linux build issue
- Loading branch information
Showing
21 changed files
with
620 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Sources/OpenSwiftUI/Core/BodyAccessor/ViewBodyAccessor.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// ViewBodyAccessor.swift | ||
// OpenSwiftUI | ||
// | ||
// Audited for RELEASE_2021 | ||
// Status: WIP | ||
|
||
struct ViewBodyAccessor<Container: View>: BodyAccessor { | ||
typealias Body = Container.Body | ||
|
||
func updateBody(of: Container, changed: Bool) { | ||
guard changed else { | ||
return | ||
} | ||
// TODO | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// CustomView.swift | ||
// OpenSwiftUI | ||
// | ||
// Audited for RELEASE_2021 | ||
// Status: WIP | ||
// ID: 9F92ACD17B554E8AB7D29ABB1E796415 | ||
|
||
internal import OpenGraphShims | ||
|
||
extension View { | ||
static func makeView(view: _GraphValue<Self>, inputs: _ViewInputs) -> _ViewOutputs { | ||
let fields = DynamicPropertyCache.fields(of: Self.self) | ||
var inputs = inputs | ||
let (body, buffer) = inputs.withMutateGraphInputs { inputs in | ||
makeBody(view: view, inputs: &inputs, fields: fields) | ||
} | ||
let outputs = _ViewDebug.makeView( | ||
view: body, | ||
inputs: inputs | ||
) { view, inputs in | ||
Body._makeView(view: body, inputs: inputs) | ||
} | ||
if let buffer { | ||
buffer.traceMountedProperties(to: body, fields: fields) | ||
} | ||
return outputs | ||
} | ||
|
||
private static func makeBody( | ||
view: _GraphValue<Self>, | ||
inputs: inout _GraphInputs, | ||
fields: DynamicPropertyCache.Fields | ||
) -> (_GraphValue<Body>, _DynamicPropertyBuffer?) { | ||
let kind = OGTypeID(Self.self).kind | ||
switch kind { | ||
case .struct, .enum, .optional, .tuple: | ||
let accessor = ViewBodyAccessor<Self>() | ||
return accessor.makeBody(container: view, inputs: &inputs, fields: fields) | ||
default: | ||
fatalError("views must be value types (either a struct or an enum); \(Self.self) is a class.") | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.