Latest1.1.3
Homepagehttps://github.com/vpeschenkov/LetterAvatarKit
LicenseMIT
Platformsios 8.0, requires ARC
FrameworksFoundation, UIKit
Authors

LetterAvatarKit LetterAvatarKit LetterAvatarKit LetterAvatarKit LetterAvatarKit

LetterAvatarKit is an UIImage extension that generates letter-based avatars. Here are some images showing what LetterAvatarKit does:

LetterAvatarKit

Requirements

  • iOS 8 and later
  • Swift 4.0 and later

Installation

CocoaPods

To install LetterAvatarKit using CocoaPods, add this line to your Podfile:

pod "LetterAvatarKit"

Usage

You can configure the following properties of LetterAvatarBuilderConfiguration:

/// The size of an avatar image.
open var size: CGSize = CGSize(width: 80, height: 80)
/// The username.
open var username: String?
/// The flag that indicates of using single letter instead of two lettters.
open var singleLetter: Bool = false
/// The letters font.
open var lettersFont: UIFont = UIFont.systemFont(ofSize: 16.0)
/// The letters colors
open var lettersColor: UIColor = LAKUIColorByRGB(red: 236, green: 240, blue: 241)
/// The background colors of an image.
open var backgroundColors: [UIColor] = UIColor.colors

Swift

Using a configuration:

let configuration = LetterAvatarBuilderConfiguration()
configuration.username = "Letter Avatar"
avatarImageView?.image = UIImage.makeLetterAvatar(withConfiguration: configuration)

or

avatarImageView?.image = UIImage.makeLetterAvatar(withUsername: "Letter Avatar")

Objective-C

Using a configuration:

LAKLetterAvatarBuilderCongiguration *configuration = [[LAKLetterAvatarBuilderCongiguration alloc] init];
configuration.username = @"Letter Avatar";
self.avatarImageView.image = [UIImage lak_makeLetterAvatarWithConfiguration:configuration];

or

self.avatarImageView.image = [UIImage lak_makeLetterAvatarWithUsername:@"Letter Avatar"];

Community

Questions, comments, issues, and pull requests are always welcome!

Contacts

License

Distributed under the MIT license. See LICENSE for more information.

Latest podspec

{
    "name": "LetterAvatarKit",
    "platforms": {
        "ios": "8.0"
    },
    "version": "1.1.3",
    "license": {
        "type": "MIT"
    },
    "homepage": "https://github.com/vpeschenkov/LetterAvatarKit",
    "authors": {
        "Victor Peschenkov": "[email protected]"
    },
    "summary": "A UIImage extension that generates letter-based avatars written in Swift.",
    "source": {
        "git": "https://github.com/vpeschenkov/LetterAvatarKit.git",
        "tag": "1.1.3"
    },
    "source_files": [
        "LetterAvatarKit/*.{h,swift}",
        "LetterAvatarKit/Extensions/*.{swift}"
    ],
    "requires_arc": true,
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "swift_version": "4.1"
}

Pin It on Pinterest

Share This