LetterAvatarKit provides an UIImage extension for generating letter-based avatars/placeholders. There are a few images showing what you can achive by using this framework:
Requirements
iOS 8+
tvOS 9+
Swift 4.0+
Features
Easy to use and intuitive interface
Highly flexible API allows for customization and integration into various projects
Use of the builder pattern for constructing avatar configurations
Support for creating circular, square, or bordered images
LetterAvatarKit is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod "LetterAvatarKit", "1.2.5" # Swift 5.0+, Xcode 12
pod "LetterAvatarKit", "1.2.3" # Swift 5.0+, Xcode 11
pod "LetterAvatarKit", "1.1.7" # Swift 4.2
pod "LetterAvatarKit", "1.1.5" # Swift 4.0
You can configure the following properties of LetterAvatarBuilderConfiguration:
/// The username.
open var username: String?
/// The size of an avatar image.
open var size: CGSize = CGSize(width: 80, height: 80)
/// The flag that indicates of using single only one letter, otherwise,
/// as much as wil be possible to obtain. But no more than 3 letters.
open var isSingleLettered: Bool = false
/// The letters font.
open var lettersFont: UIFont = UIFont.systemFont(ofSize: 16.0)
/// The letters colors
open var lettersColor: UIColor = LKUIColorByRGB(red: 236, green: 240, blue: 241)
/// The background colors of an image.
open var backgroundColors: [UIColor] = UIColor.colors
/// The letters font attributes.
open var lettersFontAttributes: [NSAttributedString.Key: Any]?
/// Indicates whether to generate circle or square image.
open var circle: Bool = false
/// The border width of the image.
open var borderWidth: CGFloat = 0.0
/// The border color of the image.
open var borderColor: UIColor = UIColor.white
/// A Boolean flag indicating whether the avatar is opaque.
open var opaque: Bool = false
Community
Questions, comments, issues, and pull requests are welcome!
LetterAvatarKit
LetterAvatarKit
provides anUIImage
extension for generating letter-based avatars/placeholders. There are a few images showing what you can achive by using this framework:Requirements
Features
Installation
CocoaPods
LetterAvatarKit
is available through CocoaPods. To install it, simply add the following line to your Podfile:Carthage
Add this to
Cartfile
Usage
Swift
Using
LetterAvatarMaker
:Using
LetterAvatarMaker
with closures:Using
LetterAvatarBuilderConfiguration
:Using UIImage extension:
Objective-C
Using
LKLetterAvatarBuilderCongiguration
:Using UIImage extension:
Customization
You can configure the following properties of
LetterAvatarBuilderConfiguration
:Community
Questions, comments, issues, and pull requests are welcome!
Contacts
License
Distributed under the MIT license. See LICENSE for more information.