Skip to content

Commit

Permalink
Add reload(completion:) method
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0c committed Apr 18, 2019
1 parent d3a2212 commit d9265fc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../RDImageViewerController/Classes/RDImageViewerController.swift"
timestampString = "577135342.8833359"
timestampString = "577297685.6991071"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "270"
Expand Down
4 changes: 2 additions & 2 deletions RDImageViewerController/Classes/RDImageContentData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ open class RDImageContentData: RDPageContentData {
return true
}

override open func reload() {
@objc override open func reload(completion: ((RDPageContentData) -> Void)?) {
image = nil
preload()
preload(completion: completion)
}

override open func stopPreload() {
Expand Down
5 changes: 5 additions & 0 deletions RDImageViewerController/Classes/RDPageContentData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public protocol RDPageContentProtocol {
func preload(completion: ((RDPageContentData) -> Void)?)
func stopPreload()
func reload()
func reload(completion: ((RDPageContentData) -> Void)?)
func reuseIdentifier() -> String
func size(inRect rect: CGRect, direction: RDPagingView.ForwardDirection) -> CGSize
}
Expand Down Expand Up @@ -56,6 +57,10 @@ open class RDPageContentData: NSObject, RDPageContentProtocol {
}

@objc open func reload() {
reload(completion: nil)
}

@objc open func reload(completion: ((RDPageContentData) -> Void)?) {
NSException(name: NSExceptionName(rawValue: "RDPageContentData"), reason: "You have to override this method. \(#function)", userInfo: nil).raise()
}

Expand Down
10 changes: 5 additions & 5 deletions RDImageViewerController/Classes/RDRemoteImageContentData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ open class RDRemoteImageContentData: RDImageContentData {
}
}

@objc override open func preload() {
preload(completion: nil)
@objc override open func reload(completion: ((RDPageContentData) -> Void)?) {
image = nil
preload(completion: completion)
}

@objc override open func reload() {
image = nil
preload()
@objc override open func preload() {
preload(completion: nil)
}

open override func preload(completion: ((RDPageContentData) -> Void)?) {
Expand Down

0 comments on commit d9265fc

Please sign in to comment.