= CFDataGetBytePtr(rhsData) else {
return false
}
var errorCount = 0
let numberOfPixels = Int(self.size.width * self.size.height * 4)
// swiftlint:disable line_length
for i in stride(from: 0, to: numberOfPixels, by: 1) where lhsPixelsPointer[i] != rhsPixelsPointer[i] {
errorCount += 1
let error = CGFloat(CGFloat(errorCount) / CGFloat(numberOfPixels))
if error > tolerance {
return false
}
}
// swiftlint:enable line_length
return true
}
}
// swiftlint:enable cyclomatic_complexity
// swiftlint:enable function_body_length
}
================================================
FILE: PULL_REQUEST_TEMPLATE.md
================================================
### Summary
Describe the goal of this PR. Mention any related Issue numbers.
### Requirements (place an `x` in each `[ ]`)
* [ ] I've read and agree to the [Code of Conduct](CODE_OF_CONDUCT.md).
* [ ] I've written tests to cover the new code and functionality included in this PR.
================================================
FILE: Package.swift
================================================
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "LetterAvatarKit",
platforms: [
.iOS(.v9),
.tvOS(.v9)
],
products: [
.library(
name: "LetterAvatarKit",
targets: ["LetterAvatarKit"]
),
],
dependencies: [
],
targets: [
.target(
name: "LetterAvatarKit",
dependencies: [],
path: "LetterAvatarKit"
),
.testTarget(
name: "LetterAvatarKitTests",
dependencies: [],
path: "LetterAvatarKitTests"
)
]
)
================================================
FILE: README.md
================================================
# LetterAvatarKit
![][Swift Version] ![][Pods] ![][Platform] ![][Carthage compatible] ![][Codacy Badge]
![][Travis]
`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:
![][screenshots]
## 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
- Wide range of flat UI colors available
- Compatible with tvOS platform
## Installation
### [CocoaPods](https://cocoapods.org)
`LetterAvatarKit` is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
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
```
### [Carthage](https://github.com/Carthage/Carthage)
Add this to `Cartfile`
```ruby
github "vpeschenkov/LetterAvatarKit" == 1.2.5 # Swift 5.0+, Xcode 12
github "vpeschenkov/LetterAvatarKit" == 1.2.3 # Swift 5.0+, Xcode 11
github "vpeschenkov/LetterAvatarKit" == 1.1.7 # Swift 4.2
github "vpeschenkov/LetterAvatarKit" == 1.1.5 # Swift 4.0
```
```sh
$ carthage update
```
## Usage
### Swift
Using `LetterAvatarMaker`:
```swift
// Square avatar image
let avatarImage = LetterAvatarMaker()
.setUsername("Letter Avatar")
.build()
avatarImageView.image = avatarImage
// Circle avatar image with white border
let circleAvatarImage = LetterAvatarMaker()
.setCircle(true)
.setUsername("Letter Avatar")
.setBorderWidth(1.0)
.setBackgroundColors([ .red ])
.build()
avatarImageView.image = circleAvatarImage
```
Using `LetterAvatarMaker` with closures:
```swift
let avatarImage = LetterAvatarMaker()
.build { c in
c.username = "Letter Avatar"
}
avatarImageView.image = avatarImage
let avatarImage = LetterAvatarMaker()
.build { c in
c.circle = true
c.username = "Letter Avatar"
c.borderWidth = 1.0
c.backgroundColors = [ .red ]
}
avatarImageView.image = avatarImage
```
Using `LetterAvatarBuilderConfiguration`:
```swift
let configuration = LetterAvatarBuilderConfiguration()
configuration.username = "Letter Avatar"
avatarImageView.image = UIImage.makeLetterAvatar(withConfiguration: configuration)
```
Using UIImage extension:
```swift
avatarImageView.image = UIImage.makeLetterAvatar(withUsername: "Letter Avatar")
```
### Objective-C
Using `LKLetterAvatarBuilderCongiguration`:
```objc
LKLetterAvatarBuilderCongiguration *configuration = [[LKLetterAvatarBuilderCongiguration alloc] init];
configuration.username = @"Letter Avatar";
self.avatarImageView.image = [UIImage lk_makeLetterAvatarWithConfiguration:configuration];
```
Using UIImage extension:
```objc
self.avatarImageView.image = [UIImage lk_makeLetterAvatarWithUsername:@"Letter Avatar"];
```
## Customization
You can configure the following properties of `LetterAvatarBuilderConfiguration`:
```swift
/// The username.
open var username: String?
```
```swift
/// The size of an avatar image.
open var size: CGSize = CGSize(width: 80, height: 80)
```
```swift
/// 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
```
```swift
/// The letters font.
open var lettersFont: UIFont = UIFont.systemFont(ofSize: 16.0)
```
```swift
/// The letters colors
open var lettersColor: UIColor = LKUIColorByRGB(red: 236, green: 240, blue: 241)
```
```swift
/// The background colors of an image.
open var backgroundColors: [UIColor] = UIColor.colors
```
```swift
/// The letters font attributes.
open var lettersFontAttributes: [NSAttributedString.Key: Any]?
```
```swift
/// Indicates whether to generate circle or square image.
open var circle: Bool = false
```
```swift
/// The border width of the image.
open var borderWidth: CGFloat = 0.0
```
```swift
/// The border color of the image.
open var borderColor: UIColor = UIColor.white
```
```swift
/// A Boolean flag indicating whether the avatar is opaque.
open var opaque: Bool = false
```
## Community
Questions, comments, issues, and pull requests are welcome!
## Contacts
- [GitHub](https://github.com/vpeschenkov)
- [Twitter](https://twitter.com/vpeschenkov)
## License
Distributed under the MIT license. See [LICENSE](https://github.com/vpeschenkov/LetterAvatarKit/blob/master/LICENSE) for more information.
[Screenshots]: https://i.imgur.com/n3SjH6q.jpg
[Platform]: https://cocoapod-badges.herokuapp.com/p/LetterAvatarKit/badge.png
[Travis]: https://travis-ci.org/vpeschenkov/LetterAvatarKit.svg?branch=master
[Pods]: https://cocoapod-badges.herokuapp.com/v/LetterAvatarKit/badge.png
[Swift Version]: https://img.shields.io/badge/swift-5.0-orange.svg?style=flat
[Codacy Badge]: https://api.codacy.com/project/badge/Grade/d0f9b1a4ccb64d4aacd18a971e4cf8b7
[Carthage compatible]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat(https://github.com/Carthage/Carthage)
================================================
FILE: docs/Classes/LetterAvatarBuilder.html
================================================
LetterAvatarBuilder Class Reference
LetterAvatarKit Reference
LetterAvatarBuilder Class Reference
LetterAvatarBuilder
@objc(LKLetterAvatarBuilder)
open class LetterAvatarBuilder : NSObject
Uses for making letter-based avatar images.
Makes a letter-based avatar image by using a given configuration.
Parameters
configuration
A configuration that is used to draw a
letter-based avatar image.
Return Value
Returns whether an instance of UIImage or nil.
================================================
FILE: docs/Classes/LetterAvatarBuilderConfiguration.html
================================================
LetterAvatarBuilderConfiguration Class Reference
LetterAvatarKit Reference
LetterAvatarBuilderConfiguration Class Reference
LetterAvatarBuilderConfiguration
@objc(LKLetterAvatarBuilderConfiguration)
open class LetterAvatarBuilderConfiguration : NSObject
Uses for configurating a LetterAvatarBuilder instance.
A size of an avatar image.
Declaration
Swift
@objc(size)
open var size : CGSize
Declaration
Swift
@objc(username)
open var username : String ?
A flag that indicates of using single only one letter, otherwise,
as much as wil be possible to obtain. But no more than 3 letters.
Declaration
Swift
@objc(useSingleLetter)
open var useSingleLetter : Bool
Declaration
Swift
@objc(lettersFont)
open var lettersFont : UIFont ?
Colors that are used to draw image.
Declaration
Swift
@objc(lettersColor)
open var lettersColor : UIColor
Background colors of the image.
Declaration
Swift
@objc(backgroundColors)
open var backgroundColors : [ UIColor ]
Declaration
Swift
@objc(lettersFontAttributes)
open var lettersFontAttributes : [ NSAttributedString . Key : Any ]?
Indicates whether to generate circle or square image.
Declaration
Swift
@objc(circle)
open var circle : Bool
A border width of the image.
Declaration
Swift
@objc(borderWidth)
open var borderWidth : CGFloat
A border color of the image.
Declaration
Swift
@objc(borderColor)
open var borderColor : UIColor
A Boolean flag indicating whether the avatar is opaque.
Declaration
Swift
@objc(isOpaque)
open var isOpaque : Bool
================================================
FILE: docs/Classes.html
================================================
Classes Reference
Classes
The following classes are available globally.
Uses for making letter-based avatar images.
See more
Declaration
Swift
@objc(LKLetterAvatarBuilder)
open class LetterAvatarBuilder : NSObject
Uses for configurating a LetterAvatarBuilder instance.
See more
Declaration
Swift
@objc(LKLetterAvatarBuilderConfiguration)
open class LetterAvatarBuilderConfiguration : NSObject
================================================
FILE: docs/Extensions/UIColor.html
================================================
UIColor Extension Reference
LetterAvatarKit Reference
UIColor Extension Reference
UIColor
class UIColor : NSObject , NSSecureCoding , NSCopying
Declaration
Swift
public enum HEXColor
================================================
FILE: docs/Extensions/UIImage.html
================================================
UIImage Extension Reference
LetterAvatarKit Reference
UIImage Extension Reference
UIImage
class UIImage : NSObject , NSSecureCoding
Makes an letter-based avatar image using given configuration.
Declaration
Swift
@objc(lk_makeLetterAvatarWithConfiguration:)
static public func makeLetterAvatar (
withConfiguration configuration : LetterAvatarBuilderConfiguration
) -> UIImage ?
Parameters
configuration
The configuration that uses to draw a
letter-based avatar image.
Return Value
Returns whether an instance of UIImage or nil.
Makes an letter-based avatar image using given username.
Declaration
Swift
@objc(lk_makeLetterAvatarWithUsername:)
public static func makeLetterAvatar ( withUsername username : String ?) -> UIImage ?
Parameters
username
The username that uses to draw a
letter-based avatar image.
Return Value
Returns whether an instance of UIImage or nil.
Makes an letter-based avatar image using given username and size.
Declaration
Swift
@objc(lk_makeLetterAvatarWithUsername:size:)
public static func makeLetterAvatar ( withUsername username : String ?, size : CGSize ) -> UIImage ?
Parameters
username
The username that uses to draw a
letter-based avatar image.
size
Return Value
Returns whether an instance of UIImage or nil.
================================================
FILE: docs/Extensions.html
================================================
Extensions Reference
Extensions
The following extensions are available globally.
Declaration
Swift
class UIColor : NSObject , NSSecureCoding , NSCopying
Declaration
Swift
class UIImage : NSObject , NSSecureCoding
================================================
FILE: docs/css/highlight.css
================================================
/* Credit to https://gist.github.com/wataru420/2048287 */
.highlight {
/* Comment */
/* Error */
/* Keyword */
/* Operator */
/* Comment.Multiline */
/* Comment.Preproc */
/* Comment.Single */
/* Comment.Special */
/* Generic.Deleted */
/* Generic.Deleted.Specific */
/* Generic.Emph */
/* Generic.Error */
/* Generic.Heading */
/* Generic.Inserted */
/* Generic.Inserted.Specific */
/* Generic.Output */
/* Generic.Prompt */
/* Generic.Strong */
/* Generic.Subheading */
/* Generic.Traceback */
/* Keyword.Constant */
/* Keyword.Declaration */
/* Keyword.Pseudo */
/* Keyword.Reserved */
/* Keyword.Type */
/* Literal.Number */
/* Literal.String */
/* Name.Attribute */
/* Name.Builtin */
/* Name.Class */
/* Name.Constant */
/* Name.Entity */
/* Name.Exception */
/* Name.Function */
/* Name.Namespace */
/* Name.Tag */
/* Name.Variable */
/* Operator.Word */
/* Text.Whitespace */
/* Literal.Number.Float */
/* Literal.Number.Hex */
/* Literal.Number.Integer */
/* Literal.Number.Oct */
/* Literal.String.Backtick */
/* Literal.String.Char */
/* Literal.String.Doc */
/* Literal.String.Double */
/* Literal.String.Escape */
/* Literal.String.Heredoc */
/* Literal.String.Interpol */
/* Literal.String.Other */
/* Literal.String.Regex */
/* Literal.String.Single */
/* Literal.String.Symbol */
/* Name.Builtin.Pseudo */
/* Name.Variable.Class */
/* Name.Variable.Global */
/* Name.Variable.Instance */
/* Literal.Number.Integer.Long */ }
.highlight .c {
color: #999988;
font-style: italic; }
.highlight .err {
color: #a61717;
background-color: #e3d2d2; }
.highlight .k {
color: #000000;
font-weight: bold; }
.highlight .o {
color: #000000;
font-weight: bold; }
.highlight .cm {
color: #999988;
font-style: italic; }
.highlight .cp {
color: #999999;
font-weight: bold; }
.highlight .c1 {
color: #999988;
font-style: italic; }
.highlight .cs {
color: #999999;
font-weight: bold;
font-style: italic; }
.highlight .gd {
color: #000000;
background-color: #ffdddd; }
.highlight .gd .x {
color: #000000;
background-color: #ffaaaa; }
.highlight .ge {
color: #000000;
font-style: italic; }
.highlight .gr {
color: #aa0000; }
.highlight .gh {
color: #999999; }
.highlight .gi {
color: #000000;
background-color: #ddffdd; }
.highlight .gi .x {
color: #000000;
background-color: #aaffaa; }
.highlight .go {
color: #888888; }
.highlight .gp {
color: #555555; }
.highlight .gs {
font-weight: bold; }
.highlight .gu {
color: #aaaaaa; }
.highlight .gt {
color: #aa0000; }
.highlight .kc {
color: #000000;
font-weight: bold; }
.highlight .kd {
color: #000000;
font-weight: bold; }
.highlight .kp {
color: #000000;
font-weight: bold; }
.highlight .kr {
color: #000000;
font-weight: bold; }
.highlight .kt {
color: #445588; }
.highlight .m {
color: #009999; }
.highlight .s {
color: #d14; }
.highlight .na {
color: #008080; }
.highlight .nb {
color: #0086B3; }
.highlight .nc {
color: #445588;
font-weight: bold; }
.highlight .no {
color: #008080; }
.highlight .ni {
color: #800080; }
.highlight .ne {
color: #990000;
font-weight: bold; }
.highlight .nf {
color: #990000; }
.highlight .nn {
color: #555555; }
.highlight .nt {
color: #000080; }
.highlight .nv {
color: #008080; }
.highlight .ow {
color: #000000;
font-weight: bold; }
.highlight .w {
color: #bbbbbb; }
.highlight .mf {
color: #009999; }
.highlight .mh {
color: #009999; }
.highlight .mi {
color: #009999; }
.highlight .mo {
color: #009999; }
.highlight .sb {
color: #d14; }
.highlight .sc {
color: #d14; }
.highlight .sd {
color: #d14; }
.highlight .s2 {
color: #d14; }
.highlight .se {
color: #d14; }
.highlight .sh {
color: #d14; }
.highlight .si {
color: #d14; }
.highlight .sx {
color: #d14; }
.highlight .sr {
color: #009926; }
.highlight .s1 {
color: #d14; }
.highlight .ss {
color: #990073; }
.highlight .bp {
color: #999999; }
.highlight .vc {
color: #008080; }
.highlight .vg {
color: #008080; }
.highlight .vi {
color: #008080; }
.highlight .il {
color: #009999; }
================================================
FILE: docs/css/jazzy.css
================================================
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
background: transparent;
border: 0;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline; }
body {
background-color: #f2f2f2;
font-family: Helvetica, freesans, Arial, sans-serif;
font-size: 14px;
-webkit-font-smoothing: subpixel-antialiased;
word-wrap: break-word; }
h1, h2, h3 {
margin-top: 0.8em;
margin-bottom: 0.3em;
font-weight: 100;
color: black; }
h1 {
font-size: 2.5em; }
h2 {
font-size: 2em;
border-bottom: 1px solid #e2e2e2; }
h4 {
font-size: 13px;
line-height: 1.5;
margin-top: 21px; }
h5 {
font-size: 1.1em; }
h6 {
font-size: 1.1em;
color: #777; }
.section-name {
color: gray;
display: block;
font-family: Helvetica;
font-size: 22px;
font-weight: 100;
margin-bottom: 15px; }
pre, code {
font: 0.95em Menlo, monospace;
color: #777;
word-wrap: normal; }
p code, li code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px; }
a {
color: #0088cc;
text-decoration: none; }
ul {
padding-left: 15px; }
li {
line-height: 1.8em; }
img {
max-width: 100%; }
blockquote {
margin-left: 0;
padding: 0 10px;
border-left: 4px solid #ccc; }
.content-wrapper {
margin: 0 auto;
width: 980px; }
header {
font-size: 0.85em;
line-height: 26px;
background-color: #414141;
position: fixed;
width: 100%;
z-index: 1; }
header img {
padding-right: 6px;
vertical-align: -4px;
height: 16px; }
header a {
color: #fff; }
header p {
float: left;
color: #999; }
header .header-right {
float: right;
margin-left: 16px; }
#breadcrumbs {
background-color: #f2f2f2;
height: 27px;
padding-top: 17px;
position: fixed;
width: 100%;
z-index: 1;
margin-top: 26px; }
#breadcrumbs #carat {
height: 10px;
margin: 0 5px; }
.sidebar {
background-color: #f9f9f9;
border: 1px solid #e2e2e2;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
top: 70px;
bottom: 0;
width: 230px;
word-wrap: normal; }
.nav-groups {
list-style-type: none;
background: #fff;
padding-left: 0; }
.nav-group-name {
border-bottom: 1px solid #e2e2e2;
font-size: 1.1em;
font-weight: 100;
padding: 15px 0 15px 20px; }
.nav-group-name > a {
color: #333; }
.nav-group-tasks {
margin-top: 5px; }
.nav-group-task {
font-size: 0.9em;
list-style-type: none;
white-space: nowrap; }
.nav-group-task a {
color: #888; }
.main-content {
background-color: #fff;
border: 1px solid #e2e2e2;
margin-left: 246px;
position: absolute;
overflow: hidden;
padding-bottom: 60px;
top: 70px;
width: 734px; }
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
margin-bottom: 1em; }
.main-content p {
line-height: 1.8em; }
.main-content section .section:first-child {
margin-top: 0;
padding-top: 0; }
.main-content section .task-group-section .task-group:first-of-type {
padding-top: 10px; }
.main-content section .task-group-section .task-group:first-of-type .section-name {
padding-top: 15px; }
.main-content section .heading:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.section {
padding: 0 25px; }
.highlight {
background-color: #eee;
padding: 10px 12px;
border: 1px solid #e2e2e2;
border-radius: 4px;
overflow-x: auto; }
.declaration .highlight {
overflow-x: initial;
padding: 0 40px 40px 0;
margin-bottom: -25px;
background-color: transparent;
border: none; }
.section-name {
margin: 0;
margin-left: 18px; }
.task-group-section {
padding-left: 6px;
border-top: 1px solid #e2e2e2; }
.task-group {
padding-top: 0px; }
.task-name-container a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item {
padding-top: 8px;
width: 100%;
list-style-type: none; }
.item a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item code {
background-color: transparent;
padding: 0; }
.item .token {
padding-left: 3px;
margin-left: 15px;
font-size: 11.9px; }
.item .declaration-note {
font-size: .85em;
color: gray;
font-style: italic; }
.pointer-container {
border-bottom: 1px solid #e2e2e2;
left: -23px;
padding-bottom: 13px;
position: relative;
width: 110%; }
.pointer {
background: #f9f9f9;
border-left: 1px solid #e2e2e2;
border-top: 1px solid #e2e2e2;
height: 12px;
left: 21px;
top: -7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
width: 12px; }
.height-container {
display: none;
left: -25px;
padding: 0 25px;
position: relative;
width: 100%;
overflow: hidden; }
.height-container .section {
background: #f9f9f9;
border-bottom: 1px solid #e2e2e2;
left: -25px;
position: relative;
width: 100%;
padding-top: 10px;
padding-bottom: 5px; }
.aside, .language {
padding: 6px 12px;
margin: 12px 0;
border-left: 5px solid #dddddd;
overflow-y: hidden; }
.aside .aside-title, .language .aside-title {
font-size: 9px;
letter-spacing: 2px;
text-transform: uppercase;
padding-bottom: 0;
margin: 0;
color: #aaa;
-webkit-user-select: none; }
.aside p:last-child, .language p:last-child {
margin-bottom: 0; }
.language {
border-left: 5px solid #cde9f4; }
.language .aside-title {
color: #4b8afb; }
.aside-warning {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
color: #ff0000; }
.graybox {
border-collapse: collapse;
width: 100%; }
.graybox p {
margin: 0;
word-break: break-word;
min-width: 50px; }
.graybox td {
border: 1px solid #e2e2e2;
padding: 5px 25px 5px 10px;
vertical-align: middle; }
.graybox tr td:first-of-type {
text-align: right;
padding: 7px;
vertical-align: top;
word-break: normal;
width: 40px; }
.slightly-smaller {
font-size: 0.9em; }
#footer {
position: absolute;
bottom: 10px;
margin-left: 25px; }
#footer p {
margin: 0;
color: #aaa;
font-size: 0.8em; }
html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
display: none; }
html.dash .main-content {
width: 980px;
margin-left: 0;
border: none;
width: 100%;
top: 0;
padding-bottom: 0; }
html.dash .height-container {
display: block; }
html.dash .item .token {
margin-left: 0; }
html.dash .content-wrapper {
width: auto; }
html.dash #footer {
position: static; }
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Info.plist
================================================
CFBundleIdentifier
com.jazzy.letteravatarkit
CFBundleName
LetterAvatarKit
DocSetPlatformFamily
letteravatarkit
isDashDocset
dashIndexFilePath
index.html
isJavaScriptEnabled
DashDocSetFamily
dashtoc
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/Classes/LetterAvatarBuilder.html
================================================
LetterAvatarBuilder Class Reference
LetterAvatarKit Reference
LetterAvatarBuilder Class Reference
LetterAvatarBuilder
@objc(LKLetterAvatarBuilder)
open class LetterAvatarBuilder : NSObject
Uses for making letter-based avatar images.
Makes a letter-based avatar image by using a given configuration.
Parameters
configuration
A configuration that is used to draw a
letter-based avatar image.
Return Value
Returns whether an instance of UIImage or nil.
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/Classes/LetterAvatarBuilderConfiguration.html
================================================
LetterAvatarBuilderConfiguration Class Reference
LetterAvatarKit Reference
LetterAvatarBuilderConfiguration Class Reference
LetterAvatarBuilderConfiguration
@objc(LKLetterAvatarBuilderConfiguration)
open class LetterAvatarBuilderConfiguration : NSObject
Uses for configurating a LetterAvatarBuilder instance.
A size of an avatar image.
Declaration
Swift
@objc(size)
open var size : CGSize
Declaration
Swift
@objc(username)
open var username : String ?
A flag that indicates of using single only one letter, otherwise,
as much as wil be possible to obtain. But no more than 3 letters.
Declaration
Swift
@objc(useSingleLetter)
open var useSingleLetter : Bool
Declaration
Swift
@objc(lettersFont)
open var lettersFont : UIFont ?
Colors that are used to draw image.
Declaration
Swift
@objc(lettersColor)
open var lettersColor : UIColor
Background colors of the image.
Declaration
Swift
@objc(backgroundColors)
open var backgroundColors : [ UIColor ]
Declaration
Swift
@objc(lettersFontAttributes)
open var lettersFontAttributes : [ NSAttributedString . Key : Any ]?
Indicates whether to generate circle or square image.
Declaration
Swift
@objc(circle)
open var circle : Bool
A border width of the image.
Declaration
Swift
@objc(borderWidth)
open var borderWidth : CGFloat
A border color of the image.
Declaration
Swift
@objc(borderColor)
open var borderColor : UIColor
A Boolean flag indicating whether the avatar is opaque.
Declaration
Swift
@objc(isOpaque)
open var isOpaque : Bool
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/Classes.html
================================================
Classes Reference
Classes
The following classes are available globally.
Uses for making letter-based avatar images.
See more
Declaration
Swift
@objc(LKLetterAvatarBuilder)
open class LetterAvatarBuilder : NSObject
Uses for configurating a LetterAvatarBuilder instance.
See more
Declaration
Swift
@objc(LKLetterAvatarBuilderConfiguration)
open class LetterAvatarBuilderConfiguration : NSObject
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/Extensions/UIColor.html
================================================
UIColor Extension Reference
LetterAvatarKit Reference
UIColor Extension Reference
UIColor
class UIColor : NSObject , NSSecureCoding , NSCopying
Declaration
Swift
public enum HEXColor
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/Extensions/UIImage.html
================================================
UIImage Extension Reference
LetterAvatarKit Reference
UIImage Extension Reference
UIImage
class UIImage : NSObject , NSSecureCoding
Makes an letter-based avatar image using given configuration.
Declaration
Swift
@objc(lk_makeLetterAvatarWithConfiguration:)
static public func makeLetterAvatar (
withConfiguration configuration : LetterAvatarBuilderConfiguration
) -> UIImage ?
Parameters
configuration
The configuration that uses to draw a
letter-based avatar image.
Return Value
Returns whether an instance of UIImage or nil.
Makes an letter-based avatar image using given username.
Declaration
Swift
@objc(lk_makeLetterAvatarWithUsername:)
public static func makeLetterAvatar ( withUsername username : String ?) -> UIImage ?
Parameters
username
The username that uses to draw a
letter-based avatar image.
Return Value
Returns whether an instance of UIImage or nil.
Makes an letter-based avatar image using given username and size.
Declaration
Swift
@objc(lk_makeLetterAvatarWithUsername:size:)
public static func makeLetterAvatar ( withUsername username : String ?, size : CGSize ) -> UIImage ?
Parameters
username
The username that uses to draw a
letter-based avatar image.
size
Return Value
Returns whether an instance of UIImage or nil.
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/Extensions.html
================================================
Extensions Reference
Extensions
The following extensions are available globally.
Declaration
Swift
class UIColor : NSObject , NSSecureCoding , NSCopying
Declaration
Swift
class UIImage : NSObject , NSSecureCoding
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/css/highlight.css
================================================
/* Credit to https://gist.github.com/wataru420/2048287 */
.highlight {
/* Comment */
/* Error */
/* Keyword */
/* Operator */
/* Comment.Multiline */
/* Comment.Preproc */
/* Comment.Single */
/* Comment.Special */
/* Generic.Deleted */
/* Generic.Deleted.Specific */
/* Generic.Emph */
/* Generic.Error */
/* Generic.Heading */
/* Generic.Inserted */
/* Generic.Inserted.Specific */
/* Generic.Output */
/* Generic.Prompt */
/* Generic.Strong */
/* Generic.Subheading */
/* Generic.Traceback */
/* Keyword.Constant */
/* Keyword.Declaration */
/* Keyword.Pseudo */
/* Keyword.Reserved */
/* Keyword.Type */
/* Literal.Number */
/* Literal.String */
/* Name.Attribute */
/* Name.Builtin */
/* Name.Class */
/* Name.Constant */
/* Name.Entity */
/* Name.Exception */
/* Name.Function */
/* Name.Namespace */
/* Name.Tag */
/* Name.Variable */
/* Operator.Word */
/* Text.Whitespace */
/* Literal.Number.Float */
/* Literal.Number.Hex */
/* Literal.Number.Integer */
/* Literal.Number.Oct */
/* Literal.String.Backtick */
/* Literal.String.Char */
/* Literal.String.Doc */
/* Literal.String.Double */
/* Literal.String.Escape */
/* Literal.String.Heredoc */
/* Literal.String.Interpol */
/* Literal.String.Other */
/* Literal.String.Regex */
/* Literal.String.Single */
/* Literal.String.Symbol */
/* Name.Builtin.Pseudo */
/* Name.Variable.Class */
/* Name.Variable.Global */
/* Name.Variable.Instance */
/* Literal.Number.Integer.Long */ }
.highlight .c {
color: #999988;
font-style: italic; }
.highlight .err {
color: #a61717;
background-color: #e3d2d2; }
.highlight .k {
color: #000000;
font-weight: bold; }
.highlight .o {
color: #000000;
font-weight: bold; }
.highlight .cm {
color: #999988;
font-style: italic; }
.highlight .cp {
color: #999999;
font-weight: bold; }
.highlight .c1 {
color: #999988;
font-style: italic; }
.highlight .cs {
color: #999999;
font-weight: bold;
font-style: italic; }
.highlight .gd {
color: #000000;
background-color: #ffdddd; }
.highlight .gd .x {
color: #000000;
background-color: #ffaaaa; }
.highlight .ge {
color: #000000;
font-style: italic; }
.highlight .gr {
color: #aa0000; }
.highlight .gh {
color: #999999; }
.highlight .gi {
color: #000000;
background-color: #ddffdd; }
.highlight .gi .x {
color: #000000;
background-color: #aaffaa; }
.highlight .go {
color: #888888; }
.highlight .gp {
color: #555555; }
.highlight .gs {
font-weight: bold; }
.highlight .gu {
color: #aaaaaa; }
.highlight .gt {
color: #aa0000; }
.highlight .kc {
color: #000000;
font-weight: bold; }
.highlight .kd {
color: #000000;
font-weight: bold; }
.highlight .kp {
color: #000000;
font-weight: bold; }
.highlight .kr {
color: #000000;
font-weight: bold; }
.highlight .kt {
color: #445588; }
.highlight .m {
color: #009999; }
.highlight .s {
color: #d14; }
.highlight .na {
color: #008080; }
.highlight .nb {
color: #0086B3; }
.highlight .nc {
color: #445588;
font-weight: bold; }
.highlight .no {
color: #008080; }
.highlight .ni {
color: #800080; }
.highlight .ne {
color: #990000;
font-weight: bold; }
.highlight .nf {
color: #990000; }
.highlight .nn {
color: #555555; }
.highlight .nt {
color: #000080; }
.highlight .nv {
color: #008080; }
.highlight .ow {
color: #000000;
font-weight: bold; }
.highlight .w {
color: #bbbbbb; }
.highlight .mf {
color: #009999; }
.highlight .mh {
color: #009999; }
.highlight .mi {
color: #009999; }
.highlight .mo {
color: #009999; }
.highlight .sb {
color: #d14; }
.highlight .sc {
color: #d14; }
.highlight .sd {
color: #d14; }
.highlight .s2 {
color: #d14; }
.highlight .se {
color: #d14; }
.highlight .sh {
color: #d14; }
.highlight .si {
color: #d14; }
.highlight .sx {
color: #d14; }
.highlight .sr {
color: #009926; }
.highlight .s1 {
color: #d14; }
.highlight .ss {
color: #990073; }
.highlight .bp {
color: #999999; }
.highlight .vc {
color: #008080; }
.highlight .vg {
color: #008080; }
.highlight .vi {
color: #008080; }
.highlight .il {
color: #009999; }
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/css/jazzy.css
================================================
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
background: transparent;
border: 0;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline; }
body {
background-color: #f2f2f2;
font-family: Helvetica, freesans, Arial, sans-serif;
font-size: 14px;
-webkit-font-smoothing: subpixel-antialiased;
word-wrap: break-word; }
h1, h2, h3 {
margin-top: 0.8em;
margin-bottom: 0.3em;
font-weight: 100;
color: black; }
h1 {
font-size: 2.5em; }
h2 {
font-size: 2em;
border-bottom: 1px solid #e2e2e2; }
h4 {
font-size: 13px;
line-height: 1.5;
margin-top: 21px; }
h5 {
font-size: 1.1em; }
h6 {
font-size: 1.1em;
color: #777; }
.section-name {
color: gray;
display: block;
font-family: Helvetica;
font-size: 22px;
font-weight: 100;
margin-bottom: 15px; }
pre, code {
font: 0.95em Menlo, monospace;
color: #777;
word-wrap: normal; }
p code, li code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px; }
a {
color: #0088cc;
text-decoration: none; }
ul {
padding-left: 15px; }
li {
line-height: 1.8em; }
img {
max-width: 100%; }
blockquote {
margin-left: 0;
padding: 0 10px;
border-left: 4px solid #ccc; }
.content-wrapper {
margin: 0 auto;
width: 980px; }
header {
font-size: 0.85em;
line-height: 26px;
background-color: #414141;
position: fixed;
width: 100%;
z-index: 1; }
header img {
padding-right: 6px;
vertical-align: -4px;
height: 16px; }
header a {
color: #fff; }
header p {
float: left;
color: #999; }
header .header-right {
float: right;
margin-left: 16px; }
#breadcrumbs {
background-color: #f2f2f2;
height: 27px;
padding-top: 17px;
position: fixed;
width: 100%;
z-index: 1;
margin-top: 26px; }
#breadcrumbs #carat {
height: 10px;
margin: 0 5px; }
.sidebar {
background-color: #f9f9f9;
border: 1px solid #e2e2e2;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
top: 70px;
bottom: 0;
width: 230px;
word-wrap: normal; }
.nav-groups {
list-style-type: none;
background: #fff;
padding-left: 0; }
.nav-group-name {
border-bottom: 1px solid #e2e2e2;
font-size: 1.1em;
font-weight: 100;
padding: 15px 0 15px 20px; }
.nav-group-name > a {
color: #333; }
.nav-group-tasks {
margin-top: 5px; }
.nav-group-task {
font-size: 0.9em;
list-style-type: none;
white-space: nowrap; }
.nav-group-task a {
color: #888; }
.main-content {
background-color: #fff;
border: 1px solid #e2e2e2;
margin-left: 246px;
position: absolute;
overflow: hidden;
padding-bottom: 60px;
top: 70px;
width: 734px; }
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
margin-bottom: 1em; }
.main-content p {
line-height: 1.8em; }
.main-content section .section:first-child {
margin-top: 0;
padding-top: 0; }
.main-content section .task-group-section .task-group:first-of-type {
padding-top: 10px; }
.main-content section .task-group-section .task-group:first-of-type .section-name {
padding-top: 15px; }
.main-content section .heading:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.section {
padding: 0 25px; }
.highlight {
background-color: #eee;
padding: 10px 12px;
border: 1px solid #e2e2e2;
border-radius: 4px;
overflow-x: auto; }
.declaration .highlight {
overflow-x: initial;
padding: 0 40px 40px 0;
margin-bottom: -25px;
background-color: transparent;
border: none; }
.section-name {
margin: 0;
margin-left: 18px; }
.task-group-section {
padding-left: 6px;
border-top: 1px solid #e2e2e2; }
.task-group {
padding-top: 0px; }
.task-name-container a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item {
padding-top: 8px;
width: 100%;
list-style-type: none; }
.item a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item code {
background-color: transparent;
padding: 0; }
.item .token {
padding-left: 3px;
margin-left: 15px;
font-size: 11.9px; }
.item .declaration-note {
font-size: .85em;
color: gray;
font-style: italic; }
.pointer-container {
border-bottom: 1px solid #e2e2e2;
left: -23px;
padding-bottom: 13px;
position: relative;
width: 110%; }
.pointer {
background: #f9f9f9;
border-left: 1px solid #e2e2e2;
border-top: 1px solid #e2e2e2;
height: 12px;
left: 21px;
top: -7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
width: 12px; }
.height-container {
display: none;
left: -25px;
padding: 0 25px;
position: relative;
width: 100%;
overflow: hidden; }
.height-container .section {
background: #f9f9f9;
border-bottom: 1px solid #e2e2e2;
left: -25px;
position: relative;
width: 100%;
padding-top: 10px;
padding-bottom: 5px; }
.aside, .language {
padding: 6px 12px;
margin: 12px 0;
border-left: 5px solid #dddddd;
overflow-y: hidden; }
.aside .aside-title, .language .aside-title {
font-size: 9px;
letter-spacing: 2px;
text-transform: uppercase;
padding-bottom: 0;
margin: 0;
color: #aaa;
-webkit-user-select: none; }
.aside p:last-child, .language p:last-child {
margin-bottom: 0; }
.language {
border-left: 5px solid #cde9f4; }
.language .aside-title {
color: #4b8afb; }
.aside-warning {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
color: #ff0000; }
.graybox {
border-collapse: collapse;
width: 100%; }
.graybox p {
margin: 0;
word-break: break-word;
min-width: 50px; }
.graybox td {
border: 1px solid #e2e2e2;
padding: 5px 25px 5px 10px;
vertical-align: middle; }
.graybox tr td:first-of-type {
text-align: right;
padding: 7px;
vertical-align: top;
word-break: normal;
width: 40px; }
.slightly-smaller {
font-size: 0.9em; }
#footer {
position: absolute;
bottom: 10px;
margin-left: 25px; }
#footer p {
margin: 0;
color: #aaa;
font-size: 0.8em; }
html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
display: none; }
html.dash .main-content {
width: 980px;
margin-left: 0;
border: none;
width: 100%;
top: 0;
padding-bottom: 0; }
html.dash .height-container {
display: block; }
html.dash .item .token {
margin-left: 0; }
html.dash .content-wrapper {
width: auto; }
html.dash #footer {
position: static; }
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/index.html
================================================
LetterAvatarKit Reference
LetterAvatarKit Reference
LetterAvatarKit Reference
LetterAvatarKit
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 and later
Swift 4.0 and later
Features
Ease of use
Flexible API
Builder pattern
Circle/Square/Bordered image
Flat UI colors
Installation
LetterAvatarKit is available through CocoaPods . To install
it, simply add the following line to your Podfile:
pod "LetterAvatarKit" , "1.2.2" # Swift 5.0+
pod "LetterAvatarKit" , "1.1.7" # Swift 4.2
pod "LetterAvatarKit" , "1.1.5" # Swift 4.0
Add this to Cartfile
github "vpeschenkov/LetterAvatarKit" == 1.2 . 2 # Swift 5.0+
github "vpeschenkov/LetterAvatarKit" == 1.1 . 7 # Swift 4.2
github "vpeschenkov/LetterAvatarKit" == 1.1 . 5 # Swift 4.0
$ carthage update
Usage
Swift
Using LetterAvatarMaker:
// Square avatar image
let avatarImage = LetterAvatarMaker ()
. setUsername ( "Letter Avatar" )
. build ()
avatarImageView . image = avatarImage
// Circle avatar image with white border
let circleAvatarImage = LetterAvatarMaker ()
. setCircle ( true )
. setUsername ( "Letter Avatar" )
. setBorderWidth ( 1.0 )
. setBackgroundColors ([ . red ])
. build ()
avatarImageView . image = circleAvatarImage
Using LetterAvatarMaker with closures:
let avatarImage = LetterAvatarMaker ()
. build { c in
c . username = "Letter Avatar"
}
avatarImageView . image = avatarImage
let avatarImage = LetterAvatarMaker ()
. build { c in
c . isCircle = true
c . username = "Letter Avatar"
c . borderWidth = 1.0
c . backgroundColors = [ . red ]
}
avatarImageView . image = avatarImage
Using LetterAvatarBuilderConfiguration :
let configuration = LetterAvatarBuilderConfiguration ()
configuration . username = "Letter Avatar"
avatarImageView . image = UIImage . makeLetterAvatar ( withConfiguration : configuration )
Using UIImage extension:
avatarImageView . image = UIImage . makeLetterAvatar ( withUsername : "Letter Avatar" )
Objective-C
Using LKLetterAvatarBuilderCongiguration:
LKLetterAvatarBuilderCongiguration * configuration = [[ LKLetterAvatarBuilderCongiguration alloc ] init ];
configuration . username = @"Letter Avatar" ;
self . avatarImageView . image = [ UIImage lk_makeLetterAvatarWithConfiguration : configuration ];
Using UIImage extension:
self . avatarImageView . image = [ UIImage lk_makeLetterAvatarWithUsername : @"Letter Avatar" ];
Customization
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 isCircle : 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
Questions, comments, issues, and pull requests are welcome!
License
Distributed under the MIT license. See LICENSE for more information.
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/js/jazzy.js
================================================
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
var tokenOffset = "15px";
var original = link.css('marginLeft') == tokenOffset;
link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
location.hash = href;
}
event.preventDefault();
});
// Dumb down quotes within code blocks that delimit strings instead of quotations
// https://github.com/realm/jazzy/issues/714
$("code q").replaceWith(function () {
return ["\"", $(this).contents(), "\""];
});
================================================
FILE: docs/docsets/LetterAvatarKit.docset/Contents/Resources/Documents/search.json
================================================
{"Extensions/UIImage.html#/c:@CM@LetterAvatarKit@@objc(cs)UIImage(cm)lk_makeLetterAvatarWithConfiguration:":{"name":"makeLetterAvatar(withConfiguration:)","abstract":"Makes an letter-based avatar image using given configuration.
","parent_name":"UIImage"},"Extensions/UIImage.html#/c:@CM@LetterAvatarKit@@objc(cs)UIImage(cm)lk_makeLetterAvatarWithUsername:":{"name":"makeLetterAvatar(withUsername:)","abstract":"Makes an letter-based avatar image using given username.
","parent_name":"UIImage"},"Extensions/UIImage.html#/c:@CM@LetterAvatarKit@@objc(cs)UIImage(cm)lk_makeLetterAvatarWithUsername:size:":{"name":"makeLetterAvatar(withUsername:size:)","abstract":"Makes an letter-based avatar image using given username and size.
","parent_name":"UIImage"},"Extensions/UIColor.html#/s:So7UIColorC15LetterAvatarKitE8HEXColorO":{"name":"HEXColor","abstract":"Colors from http://flatuicolors.com/
","parent_name":"UIColor"},"Extensions/UIColor.html":{"name":"UIColor"},"Extensions/UIImage.html":{"name":"UIImage"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)size":{"name":"size","abstract":"A size of an avatar image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)username":{"name":"username","abstract":"An username.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)useSingleLetter":{"name":"useSingleLetter","abstract":"A flag that indicates of using single only one letter, otherwise,","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)lettersFont":{"name":"lettersFont","abstract":"
Letters font.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)lettersColor":{"name":"lettersColor","abstract":"Colors that are used to draw image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)backgroundColors":{"name":"backgroundColors","abstract":"Background colors of the image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)lettersFontAttributes":{"name":"lettersFontAttributes","abstract":"Letters font attributes.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)circle":{"name":"circle","abstract":"Indicates whether to generate circle or square image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)borderWidth":{"name":"borderWidth","abstract":"A border width of the image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)borderColor":{"name":"borderColor","abstract":"A border color of the image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)isOpaque":{"name":"isOpaque","abstract":"A Boolean flag indicating whether the avatar is opaque.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilder.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilder(im)makeAvatarWithConfiguration:":{"name":"makeAvatar(with:)","abstract":"Makes a letter-based avatar image by using a given configuration.
","parent_name":"LetterAvatarBuilder"},"Classes/LetterAvatarBuilder.html":{"name":"LetterAvatarBuilder","abstract":"Uses for making letter-based avatar images.
"},"Classes/LetterAvatarBuilderConfiguration.html":{"name":"LetterAvatarBuilderConfiguration","abstract":"Uses for configurating a LetterAvatarBuilder instance.
"},"Classes.html":{"name":"Classes","abstract":"The following classes are available globally.
"},"Extensions.html":{"name":"Extensions","abstract":"The following extensions are available globally.
"}}
================================================
FILE: docs/index.html
================================================
LetterAvatarKit Reference
LetterAvatarKit Reference
LetterAvatarKit Reference
LetterAvatarKit
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 and later
Swift 4.0 and later
Features
Ease of use
Flexible API
Builder pattern
Circle/Square/Bordered image
Flat UI colors
Installation
LetterAvatarKit is available through CocoaPods . To install
it, simply add the following line to your Podfile:
pod "LetterAvatarKit" , "1.2.2" # Swift 5.0+
pod "LetterAvatarKit" , "1.1.7" # Swift 4.2
pod "LetterAvatarKit" , "1.1.5" # Swift 4.0
Add this to Cartfile
github "vpeschenkov/LetterAvatarKit" == 1.2 . 2 # Swift 5.0+
github "vpeschenkov/LetterAvatarKit" == 1.1 . 7 # Swift 4.2
github "vpeschenkov/LetterAvatarKit" == 1.1 . 5 # Swift 4.0
$ carthage update
Usage
Swift
Using LetterAvatarMaker:
// Square avatar image
let avatarImage = LetterAvatarMaker ()
. setUsername ( "Letter Avatar" )
. build ()
avatarImageView . image = avatarImage
// Circle avatar image with white border
let circleAvatarImage = LetterAvatarMaker ()
. setCircle ( true )
. setUsername ( "Letter Avatar" )
. setBorderWidth ( 1.0 )
. setBackgroundColors ([ . red ])
. build ()
avatarImageView . image = circleAvatarImage
Using LetterAvatarMaker with closures:
let avatarImage = LetterAvatarMaker ()
. build { c in
c . username = "Letter Avatar"
}
avatarImageView . image = avatarImage
let avatarImage = LetterAvatarMaker ()
. build { c in
c . isCircle = true
c . username = "Letter Avatar"
c . borderWidth = 1.0
c . backgroundColors = [ . red ]
}
avatarImageView . image = avatarImage
Using LetterAvatarBuilderConfiguration :
let configuration = LetterAvatarBuilderConfiguration ()
configuration . username = "Letter Avatar"
avatarImageView . image = UIImage . makeLetterAvatar ( withConfiguration : configuration )
Using UIImage extension:
avatarImageView . image = UIImage . makeLetterAvatar ( withUsername : "Letter Avatar" )
Objective-C
Using LKLetterAvatarBuilderCongiguration:
LKLetterAvatarBuilderCongiguration * configuration = [[ LKLetterAvatarBuilderCongiguration alloc ] init ];
configuration . username = @"Letter Avatar" ;
self . avatarImageView . image = [ UIImage lk_makeLetterAvatarWithConfiguration : configuration ];
Using UIImage extension:
self . avatarImageView . image = [ UIImage lk_makeLetterAvatarWithUsername : @"Letter Avatar" ];
Customization
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 isCircle : 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
Questions, comments, issues, and pull requests are welcome!
License
Distributed under the MIT license. See LICENSE for more information.
================================================
FILE: docs/js/jazzy.js
================================================
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
var tokenOffset = "15px";
var original = link.css('marginLeft') == tokenOffset;
link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
location.hash = href;
}
event.preventDefault();
});
// Dumb down quotes within code blocks that delimit strings instead of quotations
// https://github.com/realm/jazzy/issues/714
$("code q").replaceWith(function () {
return ["\"", $(this).contents(), "\""];
});
================================================
FILE: docs/search.json
================================================
{"Extensions/UIImage.html#/c:@CM@LetterAvatarKit@@objc(cs)UIImage(cm)lk_makeLetterAvatarWithConfiguration:":{"name":"makeLetterAvatar(withConfiguration:)","abstract":"Makes an letter-based avatar image using given configuration.
","parent_name":"UIImage"},"Extensions/UIImage.html#/c:@CM@LetterAvatarKit@@objc(cs)UIImage(cm)lk_makeLetterAvatarWithUsername:":{"name":"makeLetterAvatar(withUsername:)","abstract":"Makes an letter-based avatar image using given username.
","parent_name":"UIImage"},"Extensions/UIImage.html#/c:@CM@LetterAvatarKit@@objc(cs)UIImage(cm)lk_makeLetterAvatarWithUsername:size:":{"name":"makeLetterAvatar(withUsername:size:)","abstract":"Makes an letter-based avatar image using given username and size.
","parent_name":"UIImage"},"Extensions/UIColor.html#/s:So7UIColorC15LetterAvatarKitE8HEXColorO":{"name":"HEXColor","abstract":"Colors from http://flatuicolors.com/
","parent_name":"UIColor"},"Extensions/UIColor.html":{"name":"UIColor"},"Extensions/UIImage.html":{"name":"UIImage"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)size":{"name":"size","abstract":"A size of an avatar image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)username":{"name":"username","abstract":"An username.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)useSingleLetter":{"name":"useSingleLetter","abstract":"A flag that indicates of using single only one letter, otherwise,","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)lettersFont":{"name":"lettersFont","abstract":"
Letters font.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)lettersColor":{"name":"lettersColor","abstract":"Colors that are used to draw image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)backgroundColors":{"name":"backgroundColors","abstract":"Background colors of the image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)lettersFontAttributes":{"name":"lettersFontAttributes","abstract":"Letters font attributes.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)circle":{"name":"circle","abstract":"Indicates whether to generate circle or square image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)borderWidth":{"name":"borderWidth","abstract":"A border width of the image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)borderColor":{"name":"borderColor","abstract":"A border color of the image.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilderConfiguration.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilderConfiguration(py)isOpaque":{"name":"isOpaque","abstract":"A Boolean flag indicating whether the avatar is opaque.
","parent_name":"LetterAvatarBuilderConfiguration"},"Classes/LetterAvatarBuilder.html#/c:@M@LetterAvatarKit@objc(cs)LKLetterAvatarBuilder(im)makeAvatarWithConfiguration:":{"name":"makeAvatar(with:)","abstract":"Makes a letter-based avatar image by using a given configuration.
","parent_name":"LetterAvatarBuilder"},"Classes/LetterAvatarBuilder.html":{"name":"LetterAvatarBuilder","abstract":"Uses for making letter-based avatar images.
"},"Classes/LetterAvatarBuilderConfiguration.html":{"name":"LetterAvatarBuilderConfiguration","abstract":"Uses for configurating a LetterAvatarBuilder instance.
"},"Classes.html":{"name":"Classes","abstract":"The following classes are available globally.
"},"Extensions.html":{"name":"Extensions","abstract":"The following extensions are available globally.
"}}
================================================
FILE: docs/undocumented.json
================================================
{
"warnings": [
{
"file": "/Users/vpeschenkov/Documents/git/LetterAvatarKit/LetterAvatarKit/Extensions/UIColor+LetterAvatarKit.swift",
"line": 99,
"symbol": "UIColor.colors",
"symbol_kind": "source.lang.swift.decl.var.static",
"warning": "undocumented"
},
{
"file": "/Users/vpeschenkov/Documents/git/LetterAvatarKit/LetterAvatarKit/LetterAvatarMaker.swift",
"line": null,
"symbol": "LetterAvatarMaker",
"symbol_kind": "source.lang.swift.decl.extension",
"warning": "undocumented"
},
{
"file": "/Users/vpeschenkov/Documents/git/LetterAvatarKit/LetterAvatarKit/LetterAvatarMaker.swift",
"line": 29,
"symbol": "LetterAvatarMaker",
"symbol_kind": "source.lang.swift.decl.class",
"warning": "undocumented"
},
{
"file": "/Users/vpeschenkov/Documents/git/LetterAvatarKit/LetterAvatarKit/LetterAvatarMakerExtendable.swift",
"line": 29,
"symbol": "LetterAvatarMakerExtendable",
"symbol_kind": "source.lang.swift.decl.protocol",
"warning": "undocumented"
}
],
"source_directory": "/Users/vpeschenkov/Documents/git/LetterAvatarKit"
}
================================================
FILE: fastlane/Appfile
================================================
# app_identifier "[[APP_IDENTIFIER]]" # The bundle identifier of your app
# apple_id "[[APPLE_ID]]" # Your Apple email address
# For more information about the Appfile, see:
# https://docs.fastlane.tools/advanced/#appfile
================================================
FILE: fastlane/Fastfile
================================================
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
setup_travis
default_platform(:ios)
platform :ios do
lane :test do
swiftlint()
scan(
scheme: "LetterAvatarKit",
clean: true
)
end
end
================================================
FILE: fastlane/README.md
================================================
fastlane documentation
================
# Installation
Make sure you have the latest version of the Xcode command line tools installed:
```
xcode-select --install
```
Install _fastlane_ using
```
[sudo] gem install fastlane -NV
```
or alternatively using `brew cask install fastlane`
# Available Actions
## iOS
### ios test
```
fastlane ios test
```
----
This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run.
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
================================================
FILE: scripts/generate_docs.sh
================================================
#!/bin/sh
jazzy \
-x USE_SWIFT_RESPONSE_FILE=NO \
--clean \
--author Victor Peschenkov \
--author_url hhttps://github.com/vpeschenkov \
--github_url https://github.com/vpeschenkov/LetterAvatarKit \
--include=/*/LetterAvatar*.*,/*/Extensions/UIImage* \
--skip-undocumented \
--output docs