Avatar
Generate random user Avatars for apps.
Works for iOS 9.3+
Installation
- Simply install using Cocoapods, add
'pod Avatar'
to your podfile
Simple to use
-
import Avatar
-
Get a random user avatar by running
let avatar = Avatar.generate(for: avatar.frame.size, scale: 20)
avatar.frame.size
is the size of your UIImageView for the avatarscale
is the pixel size of each color generated, aka. the resolution
-
Get a random user avatar and the seed by running
Avatar.generate(for: avatar.frame.size, scale: 20) { (seed, avatarImage) in }
-
AvatarSeed
has the available properties:scale: Int
- resolution of each square of the imagemap: [Int]
- the layout map of the colors represented by anInt
from 0 to 2size: CGSize
- size of the overall imagecolors: Colors
- tuple that contains the primary, secondary, and tertiary colors of the image.- Can be created by calling:
let seed = AvatarSeed(map: map, colors: colors, size: size, scale: scale)