From 10e6e5d6375a41df46d2aac13852be25a70ea99d Mon Sep 17 00:00:00 2001 From: Filip Sasala <31418257+plajdo@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:13:23 +0200 Subject: [PATCH] Code review - refactor --- Sources/GRAsyncImage/GRAsyncImage.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/GRAsyncImage/GRAsyncImage.swift b/Sources/GRAsyncImage/GRAsyncImage.swift index 2f7ccdc..92bb3a8 100644 --- a/Sources/GRAsyncImage/GRAsyncImage.swift +++ b/Sources/GRAsyncImage/GRAsyncImage.swift @@ -17,7 +17,7 @@ public struct GRAsyncImage: var url: URL? var failurePlaceholder: FailurePlaceholder var loadingPlaceholder: LoadingPlaceholder - var reloadingIsAllowed: Bool + var allowsReloading: Bool var onLoading: VoidClosure? var onSuccess: VoidClosure? var onFailure: VoidClosure? @@ -28,7 +28,7 @@ public struct GRAsyncImage: url: URL?, @ViewBuilder failurePlaceholder: () -> FailurePlaceholder = { Image(systemName: "arrow.clockwise") }, @ViewBuilder loadingPlaceholder: () -> LoadingPlaceholder = { ProgressView().progressViewStyle(.circular) }, - reloadingIsAllowed: Bool = true, + allowsReloading: Bool = true, onLoading: VoidClosure? = nil, onSuccess: VoidClosure? = nil, onFailure: VoidClosure? = nil @@ -38,7 +38,7 @@ public struct GRAsyncImage: self.url = url self.failurePlaceholder = failurePlaceholder() self.loadingPlaceholder = loadingPlaceholder() - self.reloadingIsAllowed = reloadingIsAllowed + self.allowsReloading = allowsReloading self.onLoading = onLoading self.onSuccess = onSuccess self.onFailure = onFailure @@ -61,7 +61,7 @@ public struct GRAsyncImage: } case .failure: - if let url, reloadingIsAllowed { + if let url, allowsReloading { Button(action: { loadImage(url: url) }, label: { failurePlaceholder }) } else { failurePlaceholder