What's New / Spatial, 3D & RealityKit

What's new in _SpatialPreview_SwiftUI

+3 NewmacOS

_SpatialPreview_SwiftUI is a Swift cross-import overlay, not a standalone framework. Its API is available only to targets that import both SpatialPreview and SwiftUI, and it provides SwiftUI types for picking and previewing spatial content.

The 27 SDK adds 3 APIs and removes or deprecates none. The new type is the SpatialPreviewDevicePicker view, with its associated SpatialPreviewDevicePicker.Body.

New

3
struct

SpatialPreviewDevicePicker

NewmacOS
public struct SpatialPreviewDevicePicker : View

Presents nearby companion devices and allows the user to make a selection.

Declaration
@MainActor @preconcurrency public struct SpatialPreviewDevicePicker : View {

    /// Creates a device picker.
    ///
    /// - Parameters:
    ///   - isPresented: A binding to a Boolean that determines whether the picker view is displayed
    ///   - onSelect: When a device is selected the `SpatialPreviewEndpoint` for that device will be returned.
    @MainActor @preconcurrency public init(isPresented: Binding<Bool>, onSelect: @escaping (SpatialPreviewEndpoint) -> Void)

    /// The content and behavior of the view.
    ///
    /// When you implement a custom view, you must implement a computed
    /// `body` property to provide the content for your view. Return a view
    /// that's composed of built-in views that SwiftUI provides, plus other
    /// composite views that you've already defined:
    ///
    ///     struct MyView: View {
    ///         var body: some View {
    ///             Text("Hello, World!")
    ///         }
    ///     }
    ///
    /// For more information about composing views and a view hierarchy,
    /// see <doc:Declaring-a-Custom-View>.
    @MainActor @preconcurrency public var body: some View { get }

    /// The type of view representing the body of this view.
    ///
    /// When you create a custom view, Swift infers this type from your
    /// implementation of the required ``View/body-swift.property`` property.
    @available(macOS 27.0, *)
    @available(visionOS, unavailable)
    public typealias Body = some View
}
extension

SpatialPreviewDevicePicker

NewmacOS
extension SpatialPreviewDevicePicker : Sendable
Declaration
extension SpatialPreviewDevicePicker : Sendable {
}
typealias

SpatialPreviewDevicePicker.Body

NewmacOS
public typealias Body = some View

The type of view representing the body of this view.

When you create a custom view, Swift infers this type from your implementation of the required body-swift.property property.

No APIs match your filter.

← More in Spatial, 3D & RealityKit