Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile errors that demand UnitPoint instead of Alignment #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions VisionOS-Examples/Model/OrnamentAlignment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ enum OrnamentAlignment: String {
case leading
case center

var unitPoint: UnitPoint {
switch self {
case .top:
return .top
case .trailing:
return .trailing
case .bottom:
return .bottom
case .topTrailing:
return .topTrailing
case .bottomTrailing:
return .bottomTrailing
case .leading:
return .leading
case .center:
return .center
}
}

var alignment: Alignment {
switch self {
case .top:
Expand Down
4 changes: 2 additions & 2 deletions VisionOS-Examples/Pages/OrnamentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct OrnamentView: View {
}
.ornament(
visibility: showOrnament ? .visible : .hidden,
attachmentAnchor: .scene(alignment: ornamentPosition.alignment),
attachmentAnchor: .scene(ornamentPosition.unitPoint),
contentAlignment: contentAlignment.alignment) {
Text("Ornament Content")
.padding()
Expand All @@ -109,7 +109,7 @@ struct OrnamentView: View {

.ornament(
visibility: showLargeOrnament ? .visible : .hidden,
attachmentAnchor: .scene(alignment: largeOrnamentPosition.alignment),
attachmentAnchor: .scene(ornamentPosition.unitPoint),
contentAlignment: largeContentAlignment.alignment) {
VStack {
Text("Title")
Expand Down