forked from HabitRPG/habitica-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetworkImageView.swift
29 lines (24 loc) · 944 Bytes
/
NetworkImageView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//
// NetworkImageView.swift
// Habitica
//
// Created by Phillip Thelen on 10.08.20.
// Copyright © 2020 HabitRPG Inc. All rights reserved.
//
import UIKit
import Kingfisher
class NetworkImageView: AnimatedImageView {
var loadedImageName: String?
func setImagewith(name: String?, extension fileExtension: String = "", completion: ((UIImage?, NSError?) -> Void)? = nil) {
accessibilityIgnoresInvertColors = true
if let name = name {
ImageManager.setImage(on: self, name: name, extension: fileExtension, completion: completion)
}
}
func setShopImagewith(name: String?, extension fileExtension: String = "", completion: ((UIImage?, NSError?) -> Void)? = nil) {
accessibilityIgnoresInvertColors = true
if let name = name {
ImageManager.setImage(on: self, name: "shop_\(name)", extension: fileExtension, completion: completion)
}
}
}