You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a “Designed for iPad” SwiftUI app on visionOS, the toolbar’s standard items lack default hover states when that toolbar is embedded inside a TabView. Removing the TabView fixes the issue.
See the sample code and attached video.
Expected Results:
Standard toolbar items have a hover state when gazed at.
Actual Results:
No hover state is displayed. hoverEffect has no effect either.
Files
TabView.Breaks.visionOS.Hover.Effects.in.Toolbar.mp4HoverVision.zip (expand for files)
//// HoverVisionApp.swift// HoverVision//// Created by Matthew Bischoff on 11/13/24.//
import SwiftUI
@mainstructHoverVisionApp:App{varbody:someScene{WindowGroup{ContentView()}}}
//// ContentView.swift// HoverVision//// Created by Matthew Bischoff on 11/13/24.//
import SwiftUI
structContentView:View{@StateprivatevarselectedTab:HomeTab=.overview
varbody:someView{// TabView(selection: $selectedTab) {OverviewView()// .tabItem {// Label(HomeTab.overview.title, systemImage: HomeTab.overview.systemName)// }// .tag(HomeTab.overview)// // Text("Transactions")// .tabItem {// Label(HomeTab.transactions.title, systemImage: HomeTab.transactions.systemName)// }// .tag(HomeTab.transactions)// }}}enumHomeTab{case overview
case transactions
vartitle:String{
switch self{case.overview:return"Overview"case.transactions:return"Transactions"}}varsystemName:String{
switch self{case.overview:return"chart.bar"case.transactions:return"list.bullet"}}}
#Preview {ContentView()}
//// OverviewView.swift// HoverVision//// Created by Sam Gold on 2024-11-13.//
import SwiftUI
structOverviewView:View{varbody:someView{NavigationStack{List{ForEach(UIFont.familyNames, id: \.self){ font inText(font)}}.navigationTitle("Overview").toolbar{ToolbarItem(placement:.topBarLeading){EditButton()}ToolbarItem(placement:.topBarTrailing){Button{// Action} label:{Image(systemName:"gear")}}}}}}
#Preview {OverviewView()}
The text was updated successfully, but these errors were encountered:
Description
When running a “Designed for iPad” SwiftUI app on visionOS, the toolbar’s standard items lack default hover states when that toolbar is embedded inside a TabView. Removing the TabView fixes the issue.
See the sample code and attached video.
Expected Results:
Standard toolbar items have a hover state when gazed at.
Actual Results:
No hover state is displayed.
hoverEffect
has no effect either.Files
TabView.Breaks.visionOS.Hover.Effects.in.Toolbar.mp4
HoverVision.zip (expand for files)
The text was updated successfully, but these errors were encountered: