kean / Nuke

Image loading system
https://kean.blog/nuke
MIT License
8.16k stars 529 forks source link

SWIFT 3 loadImage(with: into:) do not set image after successful loading #90

Closed iuriivolochai closed 8 years ago

iuriivolochai commented 8 years ago

SWIFT 3 func loadImage(with request: Request, into target: AnyObject, handler: @escaping Manager.Handler)

Do not set image to 'into' image view: code example

        if let imageURL = viewModel?.bannerImageURL
        {
            let request = Request(urlRequest: URLRequest(url: imageURL))
            Nuke.loadImage(with: request, into: bannerImageView) {[weak self, weak viewModel] response, isFromMemoryCache in
                guard let strongSelf = self else { return }
                guard let strongViewModel = viewModel else { return }

                if case .fulfilled(let image) = response
                {
                    // bannerImageView.image is nil here
                    strongSelf.bannerTextLabel.attributedText = strongViewModel.bannerAttributedStringForImage(image)
                }

            }
        }
kean commented 8 years ago

Hey, duplicate question here https://github.com/kean/Nuke/issues/89

P.S. I guess I should clarify this behaviour a bit more.