Skip to content

NukeUI shows images despite .redacted(reason: .placeholder) #669

@majelbstoat

Description

@majelbstoat

I replaced my calls to AsyncImage with LazyImageand it works beautifully.

On many of my List screens, while I'm waiting for the network request, I show a cheap placeholder which shows the view populated with some mock data, applying .redacted(reason: .placeholder), e.g.:

struct QuestionListView {

    struct ContentView: View {
      var question: Question
      var body: some View {
        Text(question.title)
        LazyImage(url: question.imageURL)  
      }
    }

    struct Placeholder: View {
        var body: some View {
            QuestionListView.ContentView(questions: Question.mockData)
                .redacted(reason: .placeholder)
                .disabled(true)
        }
    }
}

When this was AsyncImage, the image was redacted as expected. But, when using LazyImage, the actual real image from the URL in the mockData is displayed. (It's hardcoded real-ish data.)

I'm not sure if this is a bug or a feature :) Is there an easy way to keep this capability?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions