Alternatively use the macCatalyst APIs which make UIView available under macOS. To enable this you have to explicitly set the app's target architecture to be macCatalyst instead of macOS.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: