I would like to know if it's possible to load a SwiftUI view into an NSView.
I was hoping to set the windows content view to aSwiftUI but it seems impossible
window?.contentView = view where view is of swiftUI
Is there a way to load swiftUI view into NSView?
2.3k Views Asked by Tochukwu At
1
There are 1 best solutions below
Related Questions in SWIFTUI
- Ternary operator inside NavigationLink SwiftUI
- Use ViewRouter in SwiftUI Project in Xcode 12
- SwiftUI Navigation View - Handling Size Classes over multiple views
- Is there any way to create a new Gesture in SwiftUI?
- SwiftUI extension to display Image in Alert()
- Get changes on button tapped using Combine and SwiftUI
- Does `ShapeStyle` inherit from `View`?
- Nested transitions / animations in SwiftUI
- How do I set an image in a cell class from a ImagePicker Controller
- How to disable minimum value of 0 in Slider?
- SwiftUI NavigationView issue with Parent-Child-Grandchild scenario when attempting grandchild previous next navigation
- SwiftUI strange tabbar behaviour with groups
- Picker in SwiftUI 2 .onChange() does not change UINavigationBar.appearance()
- SwiftUI Change Form Background
- SwiftUI image picker, url image from camera
Related Questions in NSVIEW
- Swift - AVFoundation on OS X adding sublayer issue
- Xcode Storyboard "Embed In" Scroll View blanks view controller OSX
- Overuse of NSView -> Alternatives?
- rounded corners on NSView using NSBezierPath are drawn badly
- NSView* from wxPython
- Layer-backed NSView subclass causes z-index issue on its non layer-backed superview
- Move a NSWindow by dragging a NSView
- Access NSProgressIndicator outside of NSTableViewDelegate method
- NSView dataWithPDF inside rect but with background view
- Mac OSX swift resize video view
- NSView cannot be resized because of subview size set programmatically
- Instantiate NSView with custom objects in it using NSNib
- How do I optimise Cocoa drawing to ensure smooth scrolling
- NSView constraints work on subviews?
- Get Image from CALayer or NSView (swift 3)
Related Questions in APPKIT
- Using autolayout, how can I center a subview in an NSSplitView without forcing the width NSSplitView to be static?
- Prevent NSScrollView from flashing its scroller
- How to show NSTextView-like context menu
- NSSearchField occasionally causing an NSInternalInconsistencyException
- NSTextField draws white area after resigning first responder
- macOS AppKit: Strange dragging behavior of modeless NSSavePanel
- Sample NSImage and retain quality (swift 3)
- MacOS views rendering same font differently
- Hide the mouse in a Mac application after not moving it
- ViewController + Storyboard setting up validation with controlTextDidChange
- Why does NSLocale.current.identifier include currency on macOS?
- C Disable command-line input
- OSX Layout positioning from code cause wrong position
- NSScrollView how to start from top left corner
- Custom selection style for view based "Source List" NSOutlineView
Related Questions in ROOTVIEW
- Add UINavigationController to navigation stack
- How to call view from DatePickerFragment
- Swap rootViewController with animation?
- Setting TabBarViewController as Root View in AppDelegate on launch
- remove all uiviewcontroller from hierarchy to display the first uiviewcontroller
- How do you stop the UIWindow from clipping to bounds on rotation and showing the 'black frame'?
- reinitialize root view in iOS
- pushViewController and popToRootViewController
- How to fade up initial root view controller to reveal new background root view controller
- Is there a way to load swiftUI view into NSView?
- how do i find the root view in my android studio project?
- android.view.ViewRootImpl cannot be cast to android.view.View
- iOS switch rootViewController not working
- RootviewController and viewControllers rotation
- How can you add 2 rootviewcontrollers in IOS App using storyboard
Related Questions in CONTENTVIEW
- How Can I Dynamically Display Content of an Outer View Based on the State in a Nested View in SwiftUI?
- ObservableObject var not update on Text
- How to add edge insets to UICollectionView's contentView when using UICollectionViewCompositionalLayout of type .list
- Maui Using Binding in a custom Control inside a CollectionView
- Facebook Pixel: What does Content View event "Value" in Facebook Analytics mean?
- Is there a way to load swiftUI view into NSView?
- Collection View outline shows under and over my horizontal collection
- How to prevent focus going to whole ListViewItem when the item's content view is clicked
- SwiftUI check if URL is reachable and switch to ContentView automaticly
- SwiftUI: Sheet gets dismissed immediately after being presented
- In .NET MAUI is there a way to choose a different XAML view based upon whether the device is in Landscape or Portrait
- MAUI ContentView can't inherit from custom base class
- Can't bind property for ContentView control
- How to omit setter of PropertyChanged when the framework draws controls [MAUI.NET]
- How to setcontentView with subfolder
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If we talk about
AppKitwhichNSViewis part of. There is a way to convert SwiftUI view to NSView usingNSHostingViewlike this:So, you can write:
If you need the same for
UIKit- useUIHostingControllerin pretty much similar but slightly more complex way: