Fixed errors and changed minimum version
NerdzUtils is a list of useful classes and extensions for simplifying development with Swift language and UIKit framework
NerdzUtils
Swift
UIKit
LoadableImageView
Simple loading image from url
avatarImageView.loadableImage = .fromUrl(object.url)
Loading image from url with caching
let blurInfo = BlurHashInfo( hash: object.hash, size: CGSize(width: 16, height: 16 ) avatarImageView.loadableImage = .fromUrl( object.url, storingPolicy: .cache(timeout: 3600), blurHash: blurInfo)
placeholderImage
UIImage?
read-write
IBInspectable
loadableImage
LoadableImage
LoadableImageView.LoadableImage
TYPE: enum
enum
An enum that represents different ways of loading image for LoadableImageView
.fromUrl( _ url: URL?, storingPolicy: ImageStoringPolicy, blurHash: BlurHashInfo? = nil, completion: ((UIImage?) -> Void)? = nil )
Representation of an image in URL format
URL
url
URL?
storingPolicy
ImageStoringPolicy
blurHash
BlurHashInfo?
nil
blur.sh
completion
((UIImage?) -> Void)?
.fromData( _ data: Data?, scale: CGFloat = 1 )
Representation of an image in Data format
Data
data
Data?
scale
CGFloat
1
.named(_ name: String)
Representation of a local image that can be retrived by name
name
String
.image(_ image: UIImage)
UIImage representation
UIImage
image
.placeholder
Setting image to placeholder state
LoadableImageView.ImageStoringPolicy
Represents a way of storing loaded image by LoadableImageView class
For more imformation follow the docummentation of LoadableImageView
.none
No storing needed
.cache(timeout: TimeInterval? = nil)
Loaded image needs to be cached
If timeout is not provided - image will be cached while target exist
timeout
TimeInterval?
Weak<T>
TYPE: class
class
Adding a possibility of having a weak referance in strong wrapper. Useful for cases when you need a weak referance for objects in Array or Dictionary
Array
Dictionary
class SomeClass { // All objects stored in this array will be storred with weak reference private let weekArray = Array<Weak<AnotherClass>>() }
object
T?
init(_ object: T?)
Initialize wrapper with wrapped object
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
NerdzUtils
NerdzUtilsis a list of useful classes and extensions for simplifying development withSwiftlanguage andUIKitframeworkLoadableImageViewSimple loading image from url
Loading image from url with caching
Properties
placeholderImageUIImage?read-writeIBInspectableloadableImageLoadableImageread-write@
LoadableImageView.LoadableImageenumTYPE:
enumAn enum that represents different ways of loading image for
LoadableImageViewCases
Representation of an image in
URLformaturlURL?storingPolicyImageStoringPolicyblurHashBlurHashInfo?nilblur.shif it is supported by imagecompletion((UIImage?) -> Void)?nilRepresentation of an image in
DataformatdataData?scaleCGFloat1Representation of a local image that can be retrived by name
nameStringUIImagerepresentationimageUIImageSetting image to placeholder state
@
LoadableImageView.ImageStoringPolicyenumTYPE:
enumRepresents a way of storing loaded image by
LoadableImageViewclassCases
No storing needed
Loaded image needs to be cached
timeoutTimeInterval?nil@
Weak<T>classTYPE:
classAdding a possibility of having a weak referance in strong wrapper. Useful for cases when you need a weak referance for objects in
ArrayorDictionaryUsage examples
Properties
objectT?read-writeMethods
Initialize wrapper with wrapped object
objectT?