Skip to content

Image flash when switching tabs #709

@brzzdev

Description

@brzzdev

Hi,

I've been using Nuke for a while and I love it, but I noticed that there's a noticible flash when switching between tabs

Nuke.mp4

as compared to say Kingfisher

Kingfisher.mp4

Here's the code for both (url: URL, color: Color):

Nuke:

@MainActor @ViewBuilder
private func NukeImageView() -> some View {
    LazyImage(url: url) { state in
        if let image = state.image {
            image
                .resizable()
                .aspectRatio(contentMode: .fill)
        } else {
            color
        }
    }
}

Kingfisher:

@ViewBuilder
private func KFImageView() -> some View {
    KFImage(url)
        .contentConfigure { image in
            image
                .resizable()
                .aspectRatio(contentMode: .fill)
        }
        .placeholder {
            color
        }
}

I see no flash with the built-in AsyncImage either:

@ViewBuilder
private func ImageView() -> some View {
    AsyncImage(url: url) { image in
        image
            .resizable()
            .aspectRatio(contentMode: .fill)
    } placeholder: {
        color
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions