-
Notifications
You must be signed in to change notification settings - Fork 41
Add initial rendering support for NSHostingView #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces initial support for rendering in NSHostingView by adding temporary layout values, new environment parameters, and updated view creation logic across the rendering and hosting integration layers.
- Added temporary hard-coded frame assignments for macOS and iOS in RendererLeafView.
- Introduced macOS-specific opaqueBackground handling and a new initializer in the DisplayList view renderer.
- Enhanced NSHostingView rendering logic and integrated new AppKit view implementations including NSProjectionView, NSInheritedView, and NSGraphicsView.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
Sources/OpenSwiftUICore/Render/RendererLeafView.swift | Temporary hard-coded frame values added for macOS and iOS. |
Sources/OpenSwiftUICore/Render/DisplayList/DisplayListViewRenderer.swift | Added opaqueBackground property and new initializer for macOS. |
Sources/OpenSwiftUI/Integration/Render/AppKit/NSViewPlatformViewDefinition.swift | Updated view creation logic with switch cases. |
Sources/OpenSwiftUI/Integration/Hosting/AppKit/View/NSProjectionView.swift | New NSProjectionView implementation. |
Sources/OpenSwiftUI/Integration/Hosting/AppKit/View/NSInheritedView.swift | New NSInheritedView implementation. |
Sources/OpenSwiftUI/Integration/Hosting/AppKit/View/NSHostingView.swift | Enhanced rendering flow and display list update logic. |
Sources/OpenSwiftUI/Integration/Hosting/AppKit/View/NSGraphicsView.swift | Added new NSGraphicsView implementation. |
Sources/COpenSwiftUI/QuartzCore/CAChameleonLayer.m & CAChameleonLayer.h | Added CAChameleonLayer implementation. |
Sources/COpenSwiftUI/AppKit/OpenSwiftUI+NSView.m & OpenSwiftUI+NSView.h | Added NSView category with a setFlipped declaration. |
Comments suppressed due to low confidence (1)
Sources/COpenSwiftUI/AppKit/OpenSwiftUI+NSView.h:23
- [nitpick] The method name 'setFlipped:' may be confused with NSView's built-in computed property 'isFlipped'. Consider renaming it to more clearly indicate its intended behavior.
- (void)setFlipped:(BOOL)flipped;
item.frame = CGRect(x: 0, y: 0, width: 500, height: 300) | ||
#elseif os(iOS) | ||
item.frame = CGRect(x: 0, y: 100.333, width: 402, height: 739) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The temporary hard-coded frame values may hinder adaptability across different screen sizes. Consider deferring to the layout system or using configurable parameters once implemented.
item.frame = CGRect(x: 0, y: 0, width: 500, height: 300) | |
#elseif os(iOS) | |
item.frame = CGRect(x: 0, y: 100.333, width: 402, height: 739) | |
let defaultSize = CGSize(width: 500, height: 300) | |
item.frame = CGRect(origin: .zero, size: proposedSize.or(defaultSize)) | |
#elseif os(iOS) | |
let defaultSize = CGSize(width: 402, height: 739) | |
item.frame = CGRect(origin: CGPoint(x: 0, y: 100.333), size: proposedSize.or(defaultSize)) |
Copilot uses AI. Check for mistakes.
version: DisplayList.Version, | ||
maxVersion: DisplayList.Version | ||
) -> Time { | ||
func render() -> Time { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The nested render() function increases the complexity of renderDisplayList. Consider extracting it into a separate method to improve readability and maintainability.
func render() -> Time { | |
private func renderDisplayListSynchronously( | |
list: DisplayList, | |
time: Time, | |
nextTime: Time, | |
version: DisplayList.Version, | |
maxVersion: DisplayList.Version | |
) -> Time { |
Copilot uses AI. Check for mistakes.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #291 +/- ##
==========================================
- Coverage 22.38% 22.28% -0.10%
==========================================
Files 343 346 +3
Lines 16246 16333 +87
==========================================
+ Hits 3636 3640 +4
- Misses 12610 12693 +83 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.