英文:
Creating a new project on apple vision pro
问题
创建一个新项目在 Apple Vision Pro 中,Xcode 中有以下选项。有人可以解释一下吗?
初始场景
窗口 和 音量。
沉浸式空间
无,混合,逐步,全屏
英文:
Creating a new project on apple vision pro and in xcode there are following option. can someone please explain
> initial scene
windows and Volume.
> Immersive space
None , Mixed , Progressive , Full
答案1
得分: 4
这是供您参考的解释:
Windows(窗口)
您可以在您的 VisionOS 应用程序中创建一个或多个窗口。它们使用 SwiftUI 构建,包含传统的视图和控件,您可以通过添加 3D 内容来增强体验。
👉 可以像创建 iOS 和 macOS 应用程序的窗口一样创建窗口。
import SwiftUI
@main
struct VisionProApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Volumes(体积)
通过 3D 体积来增强您的应用程序。Volumes 是 SwiftUI 场景,可以使用 RealityKit 或 Unity 展示 3D 内容,从而创建可以从任何角度在 Shared Space 或应用程序的 Full Space 中查看的体验。
👉 只需将窗口样式更改为 volumetric,即可创建 Volume。我们还可以为 3D 模型提供默认大小和深度。
import SwiftUI
@main
struct VisionProApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
.windowStyle(.volumetric)
.defaultSize(width: 400, height: 400, depth: 400)
}
}
Spaces(空间)
默认情况下,应用程序启动到 Shared Space,它们并排存在,就像 Mac 桌面上的多个应用程序一样。应用程序可以使用 Windows 和 Volumes 显示内容,用户可以自行重新定位这些元素。对于更沉浸式的体验,应用程序可以打开一个专用的 Full Space,只有该应用程序的内容将显示出来。在 Full Space 中,应用程序可以使用窗口和体积,创建无边界的 3D 内容,打开通往不同世界的门户,甚至完全沉浸人们在环境中。
👉 要添加 Full Space,只需在 App Scene 中添加一个带有 ID 的 Immersive Space 场景,并且通过 ID,我们可以像在 SwiftUI 中调用窗口一样调用它。
有三种可用的沉浸式样式:<br>
> 1. Mixed(混合):用户与真实世界共存。<br>
> 2. Progressive(渐进式):是一个中间地带,沉浸级别可以由数字表冠控制。<br>
> 3. Full(完全):变得完全沉浸,隐藏了人们的周围环境。
import SwiftUI
@main
struct VisionProApp: App {
@State private var immersionStyle: ImmersionStyle = .mixed
var body: some Scene {
WindowGroup {
ContentView()
}
ImmersiveSpace(id: "Immersion_View") {
PlanneView()
}
.immersionStyle(selection: $immersionStyle, in: .mixed, .progressive, .full)
}
}
希望对您有所帮助。
英文:
Here is an explanation for your reference:
Windows <br>
You can create one or more windows in your visionOS app. They’re built with SwiftUI and contain traditional views and controls, and you can add depth to your experience by adding 3D content.
👉 Windows can be created just like we create windows for iOS and macOS apps.
import SwiftUI
@main
struct VisionProApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Volumes <br>
Add depth to your app with a 3D volume. Volumes are SwiftUI scenes that can showcase 3D content using RealityKit or Unity, creating experiences that are viewable from any angle in the Shared Space or an app’s Full Space.
👉 Volume can be created by simply changing the window style to volumetric. We can also provide the default size and depth for the 3D model.
import SwiftUI
@main
struct VisionProApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
.windowStyle(.volumetric)
.defaultSize(width: 400, height: 400, depth: 400)
}
}
Spaces <br>
By default, apps launch into the Shared Space, where they exist side by side — much like multiple apps on a Mac desktop. Apps can use Windows and Volumes to show content, and the user can reposition these elements wherever they like. For a more immersive experience, an app can open a dedicated Full Space where only that app’s content will appear. Inside a Full Space, an app can use windows and volumes, create unbounded 3D content, open a portal to a different world, or even fully immerse people in an environment.
👉 To add a FullSpace, simply add an ImmeriveSpace Scene with ID in the App Scene, and with the ID, we can call it just like we call Windows in SwiftUI.
There are three types of Immersion styles available: <br>
> 1. Mixed: Where the User co-exists with the real world.<br>
> 2. Progressive: It’s a middle ground where the Immersion level can be controlled by the digital crown.<br>
> 3. Full: Becomes Fully Immersive and hides the people’s surroundings.
import SwiftUI
@main
struct VisionProApp: App {
@State private var immersionStyle: ImmersionStyle = .mixed
var body: some Scene {
WindowGroup {
ContentView()
}
ImmersiveSpace(id: "Immersion_View") {
PlanneView()
}
.immersionStyle(selection: $immersionStyle, in: .mixed, .progressive, .full)
}
}
Hope it's useful for you.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论