Skip to content

Commit

Permalink
simulate issue #309
Browse files Browse the repository at this point in the history
  • Loading branch information
eric3 committed Nov 22, 2020
1 parent 9298cab commit 1ea6618
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Example-Swift/PhotoBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ final class NYTPhotoBox: NSObject, NYTPhoto {
var image: UIImage?
var imageData: Data?
var placeholderImage: UIImage?
{
get {
return UIImage(named:"placeholder")
}
}

var isPhoto: Bool {
return value.itemType == .image
Expand Down
3 changes: 2 additions & 1 deletion Example-Swift/PhotoViewerCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ final class PhotoViewerCoordinator: NSObject, NYTPhotoViewerDataSource {
for box in slideshow {
if box.isPhoto {
provider.fetchPhoto(named: box.value.name, then: { [weak self] (result) in
box.image = result
// simulate issue #309
// box.image = result
self?.photoViewer.update(box)
})
}
Expand Down
6 changes: 3 additions & 3 deletions Example/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
21 changes: 21 additions & 0 deletions Example/Assets.xcassets/placeholder.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "placeholder.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1ea6618

Please sign in to comment.