English 中文(简体)
如何根据温得小组的风格确定有条件的财产?
原标题:How to set conditional properties on style in WindowGroup?

我工作依靠的是高度依赖窗口集团的愿景服务。 如果你使用窗户,你就可以消除我有时想要的玻璃背景。 我有时喜欢玻璃。 财产窗户显然是一种规程,在试图设定时,我可以不使用独家经营人,因为它要求大体类型相同。 我怎么办?

我在下面对法典做了如下规定:如果我单独使用,就会进行罚款,但如果我试图将罚款与毛皮联系起来,则会发生错误。 我将每一次尝试之后的错误信息包括在内。

WindowGroup {
    //Display the tutorial view.
    SetupView()
}
//This Works
.windowStyle(.plain)

//This also works
.windowStyle(.automatic)

//But they can t combine. What I have tried.
.windowStyle(showGlassBackground ? .plain : .automatic) //Member  automatic  in  PlainWindowStyle  produces result of type  DefaultWindowStyle , but context expects  PlainWindowStyle 
.windowStyle(showGlassBackground ? (.plain as WindowStyle) : (.automatic as WindowStyle) //Type  any WindowStyle  cannot conform to  WindowStyle 
.windowStyle(showGlassBackground ? (PlainWindowStyle.plain as any WindowStyle) : (DefaultWindowStyle.automatic as any WindowStyle)) //Value of type  any WindowStyle  has no member  windowStyle 
.windowStyle(showGlassBackground ? (PlainWindowStyle.plain as WindowStyle) : (DefaultWindowStyle.automatic as WindowStyle)) //Type  any WindowStyle  cannot conform to  WindowStyle 
.windowStyle(showGlassBackground ? WindowStyle(.plain) : WindowStyle(.automatic)) //  any WindowStyle  cannot be constructed because it has no accessible initializers
最佳回答

因此,我仍然想听一下如何能够做到这一点,正如“Alexander”一样,这很可能是一个技能问题,但我找到了一种办法,使我能够这样做。 如果你把窗户定在平原上,玻璃窗就消失了,但你可以单独实施玻璃效应。 这可能是什么? 永远也永远不会发生为我需要的工作。

WindowGroup {
    SetupView().glassBackgroundEffect(displayMode: showGlassBackground ? .always : .never)
}.windowStyle(.plain)
问题回答

暂无回答




相关问题
SwiftUI: How do I position a button x points above a sheet?

I am trying to recreate a Maps-style UI with a persistent bottom sheet and controls fixed above. Apple Maps UI with controls above ☝️ Example here, the "Look Around" binoculars button and ...

BraintreeDropIn deprecated functions error

I m getting this error on the latest release of BraintreeDropIn, I really don t get it since based on the patch notes, this should ve been addressed already, I have already tried cleaning derived data,...

how to limit zoom level in map swift ui?

how to limit zoom level in map swift ui i have map and need to make zoom level limited Map(coordinateRegion: $region,annotationItems: viewModel.nearbyGyms) { item in ...

UIImageView - How to get the file name of the image assigned?

Is it possible to read the name of an UIImageView s UIImage that s presently stored in the UIImageView? I was hoping you could do something kind of like this, but haven t figured it out. NSString *...

热门标签