Skip to content

Commit 77083e1

Browse files
author
burak.uzunboy
committed
Modifiers are corrected
1 parent 855c047 commit 77083e1

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

Sources/UsefulNetworkLayer/Extensions/UIImage+ResponseImage.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extension UIImage {
1515

1616
/// Returns immediately if image is available on the cache, otherwise requests from Network Layer and calls completion block.
1717
@discardableResult
18-
class func fromURL(_ url: URL, completion: @escaping (_ image: UIImage?)->()) -> UIImage? {
18+
open class func fromURL(_ url: URL, completion: @escaping (_ image: UIImage?)->()) -> UIImage? {
1919
let api = APIConfiguration(url: url, responseBodyObject: ResponseImage.self, cachingTime: NetworkLayer.CachingTime(seconds: 60*60*24))
2020

2121
api.request { (result) in
@@ -34,14 +34,14 @@ extension UIImage {
3434
}
3535

3636
/// Returns immediately the image if it is available on the cache.
37-
class func fromCache(_ url: URL) -> UIImage? {
37+
open class func fromCache(_ url: URL) -> UIImage? {
3838
let api = APIConfiguration(url: url, responseBodyObject: ResponseImage.self)
3939
guard let response = NetworkLayer.cache?.cachedResponse(for: URLRequest(url: api.requestURL)) else { return nil }
4040
return UIImage(data: response.data)
4141
}
4242

4343
/// Downloads image and saves to the cache for future uses.
44-
class func download(_ url: URL) {
44+
open class func download(_ url: URL) {
4545
let api = APIConfiguration(url: url, responseBodyObject: ResponseImage.self, priority: .veryLow, isMainOperation: false)
4646
api.request { (_) in }
4747
}

Sources/UsefulNetworkLayer/Extensions/UIImageView+ImageURL.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extension UIImageView {
1414
///
1515
/// During the loading process, this method is also capable to add activity indicator.
1616
/// Change tag value if other method will be called also to change image of the imageview to override again.
17-
public func imageFromUrl(urlString: String?, fallback: UIImage?, errorCompletion: ((_ error: NSError)->())? = nil){
17+
open func imageFromUrl(urlString: String?, fallback: UIImage?, errorCompletion: ((_ error: NSError)->())? = nil){
1818
guard let urlStr = urlString, let url = URL(string: urlStr) else {
1919
self.image = fallback
2020
return
@@ -29,7 +29,7 @@ extension UIImageView {
2929
- parameter completion: Returns the image that set to imageview even it fallbacks to error. If `fallback` is set, at worst it will return the fallback.
3030
- parameter errorCompletion: This block will be called if any error happens
3131
*/
32-
public func imageFromUrl(url: URL?, fallback: UIImage?,
32+
open func imageFromUrl(url: URL?, fallback: UIImage?,
3333
errorCompletion: ((_ error: NSError)->())? = nil,
3434
completion: ((_ image: UIImage?)->())?) {
3535
guard let url = url else {
@@ -87,11 +87,11 @@ extension UIImageView {
8787
}
8888

8989
/// Wrapper Class to convert Data to UIImage.
90-
class ResponseImage: ResponseBodyParsable {
90+
public class ResponseImage: ResponseBodyParsable {
9191

92-
static var shouldUseCustomInitializer: Bool { true }
92+
public static var shouldUseCustomInitializer: Bool { true }
9393
/// holds `UIImage` object inside.
94-
var image: UIImage
94+
public var image: UIImage
9595

9696
required init?(_ data: Data) {
9797
guard let image = UIImage(data: data) else {
@@ -101,19 +101,19 @@ class ResponseImage: ResponseBodyParsable {
101101
self.image = image
102102
}
103103

104-
func encode(to encoder: Encoder) throws {
104+
public func encode(to encoder: Encoder) throws {
105105

106106
}
107107

108-
required init(from decoder: Decoder) throws {
108+
required public init(from decoder: Decoder) throws {
109109
self.image = UIImage()
110110
}
111111

112112
required init?(_ response: Any?) {
113113
return nil
114114
}
115115

116-
func cachingEndsAt() -> Date? {
116+
public func cachingEndsAt() -> Date? {
117117
return Date().addingTimeInterval(60 * 60)
118118
}
119119

0 commit comments

Comments
 (0)