浏览代码

Apply png serializer to UIKit tutorial

onevcat 2 年之前
父节点
当前提交
b1d6842868
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Sources/Documentation.docc/Resources/code-files/01-ViewController-8.swift

+ 5 - 1
Sources/Documentation.docc/Resources/code-files/01-ViewController-8.swift

@@ -13,7 +13,11 @@ extension ViewController: UITableViewDataSource {
         cell.sampleImageView.kf.indicatorType = .activity
         
         let roundCorner = RoundCornerImageProcessor(radius: .widthFraction(0.5), roundingCorners: [.topLeft, .bottomRight])
-        cell.sampleImageView.kf.setImage(with: url, options: [.processor(roundCorner)])
+        let pngSerializer = FormatIndicatedCacheSerializer.png
+        cell.sampleImageView.kf.setImage(
+            with: url,
+            options: [.processor(roundCorner), .cacheSerializer(pngSerializer)]
+        )
         cell.sampleImageView.backgroundColor = .clear
         return cell
     }