Skip to content

Instantly share code, notes, and snippets.

@dmytro-anokhin
Created August 19, 2020 23:22
Show Gist options
  • Save dmytro-anokhin/b6b91d0d7f7b0d853d807117c955a946 to your computer and use it in GitHub Desktop.
Save dmytro-anokhin/b6b91d0d7f7b0d853d807117c955a946 to your computer and use it in GitHub Desktop.
extension RemoteContentView where Empty == EmptyView, Progress == ActivityIndicator, Failure == Text {
init<R: RemoteContent>(remoteContent: R,
content: @escaping (_ value: Value) -> Content) where R.ObjectWillChangePublisher == ObservableObjectPublisher,
R.Value == Value
{
self.init(remoteContent: remoteContent,
empty: { EmptyView() },
progress: { ActivityIndicator() },
failure: { error, _ in Text(error.localizedDescription) },
content: content)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment