Skip to content

Commit

Permalink
fix(expo-modules-core): allow SwiftUI views to work on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
hassankhan committed Dec 15, 2024
1 parent 7889e97 commit c96c5ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/expo-modules-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Ensure `uuid.v4`and`uuid.v5` is available on old react native architecture. ([#33621](https://github.com/expo/expo/pull/33621) by [@andrejpavlovic](https://github.com/andrejpavlovic))
- Changed `import` to `import type` for TS type declarations. ([#33447](https://github.com/expo/expo/pull/33447) by [@j-piasecki](https://github.com/j-piasecki))
- [macOS] Allow SwiftUI views to work on macOS ([#33506](https://github.com/expo/expo/pull/33506) by [@hassankhan](https://github.com/hassankhan))

### 💡 Others

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ extension ExpoSwiftUI {
struct UIViewHost: UIViewRepresentable {
let view: UIView


#if os(macOS)
func makeNSView(context: Context) -> NSView {
return view
}

func updateNSView(_ nsView: NSView, context: Context) {
// Nothing to do here
}
#endif

func makeUIView(context: Context) -> UIView {
return view
}
Expand Down
1 change: 1 addition & 0 deletions packages/expo-modules-core/ios/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ public typealias UIResponder = NSResponder
public typealias UIApplicationDelegate = NSApplicationDelegate
public typealias UIWindow = NSWindow
public typealias UIHostingController = NSHostingController
public typealias UIViewRepresentable = NSViewRepresentable

#endif // os(macOS)

0 comments on commit c96c5ee

Please sign in to comment.