Navi is designed for avatar caching, with style.
The name of Navi from movie Avatar.
Swift 2.0, iOS 8.0
-
Make your User conform Avatar protocol.
protocol Avatar { var URL: NSURL? { get } var style: AvatarStyle { get } var placeholderImage: UIImage? { get } var localOriginalImage: UIImage? { get } var localStyledImage: UIImage? { get } func saveOriginalImage(originalImage: UIImage, styledImage: UIImage) }
-
And, set avatar for your avatarImageView
avatarImageView.navi_setAvatar(userAvatar)
Check the demo for more information.
另有中文介绍。
pod 'Navi', '~> 0.3.7'
github "nixzhu/Navi" >= 0.3.7
NIX @nixzhu
Navi is available under the MIT license. See the LICENSE file for more info.