Skip to content

Commit

Permalink
Use class for kf wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Oct 6, 2016
1 parent 20749fb commit bc657b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Sources/Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,11 @@ extension Kingfisher where Base: Image {
guard let (images, gifDuration) = decode(from: imageSource, for: options) else {
return nil
}
var image = Kingfisher<Image>.animated(with: images, forDuration: duration <= 0.0 ? gifDuration : duration)
let image = Kingfisher<Image>.animated(with: images, forDuration: duration <= 0.0 ? gifDuration : duration)
image?.kf.animatedImageData = data
return image
} else {
var image = Image(data: data)
let image = Image(data: data)
image?.kf.animatedImageData = data
image?.kf.imageSource = ImageSource(ref: imageSource)
return image
Expand Down
10 changes: 2 additions & 8 deletions Sources/ImageView+Kingfisher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,7 @@ extension ImageView {
@available(*, deprecated, message: "Extensions directly on image views are deprecated. Use `imageView.kf.indicatorType` instead.", renamed: "kf.indicatorType")
public var kf_indicatorType: IndicatorType {
get { return kf.indicatorType }
set {
var holder = kf
holder.indicatorType = newValue
}
set { kf.indicatorType = newValue }
}

@available(*, deprecated, message: "Extensions directly on image views are deprecated. Use `imageView.kf.indicator` instead.", renamed: "kf.indicator")
Expand All @@ -275,10 +272,7 @@ extension ImageView {
/// It will be `nil` if `kf_indicatorType` is `.none`.
public private(set) var kf_indicator: Indicator? {
get { return kf.indicator }
set {
var holder = kf
holder.indicator = newValue
}
set { kf.indicator = newValue }
}

@available(*, deprecated, message: "Extensions directly on image views are deprecated.", renamed: "kf.imageTask")
Expand Down
3 changes: 1 addition & 2 deletions Sources/Kingfisher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import ImageIO
#endif
#endif

public struct Kingfisher<Base> {
public final class Kingfisher<Base> {
public let base: Base
public init(_ base: Base) {
self.base = base
Expand All @@ -61,7 +61,6 @@ public protocol KingfisherCompatible {
public extension KingfisherCompatible {
public var kf: Kingfisher<Self> {
get { return Kingfisher(self) }
set { }
}
}

Expand Down

0 comments on commit bc657b6

Please sign in to comment.