Răsfoiți Sursa

Mark final to improve performance (if any)

onevcat 8 ani în urmă
părinte
comite
19710484eb

+ 1 - 1
Sources/Image.swift

@@ -741,7 +741,7 @@ extension Kingfisher where Base: Image {
 }
 }
 
 
 /// Reference the source image reference
 /// Reference the source image reference
-class ImageSource {
+final class ImageSource {
     var imageRef: CGImageSource?
     var imageRef: CGImageSource?
     init(ref: CGImageSource) {
     init(ref: CGImageSource) {
         self.imageRef = ref
         self.imageRef = ref

+ 1 - 1
Sources/ImageDownloader.swift

@@ -421,7 +421,7 @@ extension ImageDownloader {
 /// If we use `ImageDownloader` as the session delegate, it will not be released.
 /// If we use `ImageDownloader` as the session delegate, it will not be released.
 /// So we need an additional handler to break the retain cycle.
 /// So we need an additional handler to break the retain cycle.
 // See https://github.com/onevcat/Kingfisher/issues/235
 // See https://github.com/onevcat/Kingfisher/issues/235
-class ImageDownloaderSessionHandler: NSObject, URLSessionDataDelegate, AuthenticationChallengeResponsable {
+final class ImageDownloaderSessionHandler: NSObject, URLSessionDataDelegate, AuthenticationChallengeResponsable {
     
     
     // The holder will keep downloader not released while a data task is being executed.
     // The holder will keep downloader not released while a data task is being executed.
     // It will be set when the task started, and reset when the task finished.
     // It will be set when the task started, and reset when the task finished.

+ 2 - 2
Sources/Indicator.swift

@@ -86,7 +86,7 @@ extension Indicator {
 
 
 // MARK: - ActivityIndicator
 // MARK: - ActivityIndicator
 // Displays a NSProgressIndicator / UIActivityIndicatorView
 // Displays a NSProgressIndicator / UIActivityIndicatorView
-class ActivityIndicator: Indicator {
+final class ActivityIndicator: Indicator {
 
 
     #if os(macOS)
     #if os(macOS)
     private let activityIndicatorView: NSProgressIndicator
     private let activityIndicatorView: NSProgressIndicator
@@ -143,7 +143,7 @@ class ActivityIndicator: Indicator {
 
 
 // MARK: - ImageIndicator
 // MARK: - ImageIndicator
 // Displays an ImageView. Supports gif
 // Displays an ImageView. Supports gif
-class ImageIndicator: Indicator {
+final class ImageIndicator: Indicator {
     private let animatedImageIndicatorView: ImageView
     private let animatedImageIndicatorView: ImageView
 
 
     var view: IndicatorView {
     var view: IndicatorView {

+ 1 - 1
Sources/KingfisherManager.swift

@@ -35,7 +35,7 @@ public typealias CompletionHandler = ((_ image: Image?, _ error: NSError?, _ cac
 
 
 /// RetrieveImageTask represents a task of image retrieving process.
 /// RetrieveImageTask represents a task of image retrieving process.
 /// It contains an async task of getting image from disk and from network.
 /// It contains an async task of getting image from disk and from network.
-public class RetrieveImageTask {
+public final class RetrieveImageTask {
     
     
     public static let empty = RetrieveImageTask()
     public static let empty = RetrieveImageTask()