Quantcast
Channel: Combine: Asynchronous Programming with Swift - Kodeco Forums
Viewing all articles
Browse latest Browse all 26

Chapter 8.1 help with .assign(to:)

$
0
0

When I add the line to func bindMainView() - .assign(to: &imagePreview) I get the following error:

Cannot convert value of type ‘UIImage?’ to expected argument type
‘Published<UIImage>.Publisher’

I’ve gone over the code and everything looks good. If I replace .assign with the following:

.sink(receiveValue: { [self] image in self.imagePreview = image })
.store(in: &subscriptions)

everything works just fine. Any ideas?

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 26

Trending Articles