SwiftUI isPlaceholder not showing

12 Replies

In video "Build SwiftUI views for widgets" author use .isPlaceholder(false) to set view is not placeholder, but... It's not available >____<

Code Block
Value of type 'Text' has no member 'isPlaceholder'

Xcode Version 12.0.1 (12A7300)

Code Block
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
extension View {
    public func redacted(reason: RedactionReasons) -> some View
    public func unredacted() -> some View

I'm using the official Xcode 12 and it's also not there.

Edit: The following worked. I just had to refresh the preview to see the change.

.redacted(reason: .placeholder)
I'm a bit confused about this, to be honest. As I just started using the Betas since 3 or 4, for me it looks like it never actually was there. But now as of Beta 5 it kinda automatically applies this effect to widgets (during loading)?!
Still not available in Beta 5?
You can just use this on a view, instead of .isPlaceholder:

Code Block
.redacted(reason: .placeholder)

it's actually deprecated in Beta 3 and replaced by "redacted". I am not sure yet how this is supposed to be used.
It is available on beta 3 finally!
Oh, still waiting..
maybe in beta 3? not in beta 2
Is there a tentative timeline for this to be available? It is still not present in Beta 2.