AvatarImageView alternatives and similar libraries
Based on the "Image" category.
Alternatively, view AvatarImageView alternatives based on common mentions on social networks and blogs.
-
TOCropViewController
A view controller for iOS that allows users to crop portions of UIImage objects -
GPUImage2
GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing. -
IDMPhotoBrowser
Photo Browser / Viewer inspired by Facebook's and Tweetbot's with ARC support, swipe-to-dismiss, image progress and more -
SKPhotoBrowser
Simple PhotoBrowser/Viewer inspired by facebook, twitter photo browsers written by swift -
AspectFillFaceAware
DISCONTINUED. An extension that gives UIImageView the ability to focus on faces within an image. -
GPUImage3
GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal. -
RSKImageCropper
An image / photo crop view controller for iOS like in the Contacts app with support for landscape orientation. -
EBPhotoPages
A photo gallery for iOS with a modern feature set. Similar features as the Facebook photo browser. -
Twitter Image Pipline
Twitter Image Pipeline is a robust and performant image loading and caching framework for iOS clients -
ImagePickerSheetController
ImagePickerSheetController replicates the custom photo action sheet in iMessage. -
YUCIHighPassSkinSmoothing
An implementation of High Pass Skin Smoothing using Apple's Core Image Framework -
CTPanoramaView
A library that displays spherical or cylindrical panoramas with touch or motion based controls. -
OnlyPictures
A simple and flexible way to add source of overlapping circular pictures, currently supports horizontal overlapping or distant pictures with great layout flexibility. -
AXPhotoViewer
An iOS/tvOS photo gallery viewer, useful for viewing a large (or small!) number of photos. -
ComplimentaryGradientView
Create complementary gradients generated from dominant and prominent colors in supplied image. Inspired by Grade.js
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of AvatarImageView or a related project?
README
🚨🚨 THIS LIBRARY IS NO LONGER BEING MAINTAINED 🚨🚨
I've made a career move away from iOS and decided to stop maintaining this library due to Swift's continued instability.
The amazing folks at Neone have forked the project and continued to develop it. Please use their fork located here: https://github.com/neone/NDAvatarApp.
Build Status
Branch | Build Status |
---|---|
Develop | |
Master |
Description
AvatarImageView
is a customisable subclass of UIImageView that is designed to show users' profile pictures. It falls back to the user's initials with a random background color if no profile picture is supplied.
This library was inspired by and is supposed to be a Swift rewrite of bachonk/UIImageView-Letters.
Usage
To set up AvatarImageView
, a dataSource
that conforms to AvatarImageViewDataSource
needs to be set. Optionally a configuration
that conforms to AvatarImageViewConfiguration
can also be set. The default configuration will show a square picture; and if no profile picture is supplied, it will draw the initials with the system font on a random background color.
The AvatarImageViewDataSource
contains the following members. All have default implementations and are hence optional.
var name: String { get }
- Default: returns""
var avatar: UIImage? { get }
- Default: returnsnil
var bgColor: UIColor? { get }
- Default: returnsnil
var initials: String { get }
- Default: returns initials calculated from the name.var avatarId: Int { get }
- Default: returns the hash values of the name and initials combined using XOR.
The AvatarImageViewConfiguration
contains the following members. All have default implementations and are hence optional.
var shape: Shape { get }
- Default: returns.Square
var textSizeFactor: CGFloat { get }
- Default: returns0.5
var fontName: String? { get }
- Default: returnsnil
var bgColor: UIColor? { get }
- Default: returns innil
. ThebgColor
inAvatarImageViewDataSource
will take precedence over this one.var textColor: UIColor { get }
- Default: returns.white
.
Check out the docs for more information.
The random background colour is generated for each unique user from its avatarId
, so if you have AvatarImageView
s in different parts of your app, the background color for a particular user will be the same in both.
The image view can be drawn as a square or circle out of the box. You can even sepcify a mask image if you want a custom shape. These settings are done in an AvatarImageViewConfiguration
. Here are some examples for initials being drawn in different shapes.
[Square Initials](./Screenshots/square_initials.png) [Circle Initials](./Screenshots/circle_initials.png) [Mask Initials](./Screenshots/mask_initials.png)
Here's an example of when the dataSource
supplies a profile picture and the configuration
is set to a circle.
[Circle Profile Pic](./Screenshots/circle_profile_pic.png)
It works great with custom fonts!
[Custom Font](./Screenshots/circle_custom_font.png)
...and also with UITableView
s
[Table View Pics](./Screenshots/table_view.png)
Example Project
Please refer to the example project in this repository for an implementation of all the above use cases. If you find any bugs, open a GitHub issue!
Gotchas
Always set the
configuration
before thedataSource
. If you don't, you will need to manually callrefresh()
to render the view correctly.When implementing the
AvatarImageViewDataSource
andAvatarImageViewConfiguration
protocols, you will need to explicitly define the type for any protocol member that is an optional otherwise Swift goes insane.
For example, AvatarImageViewConfiguration
has a type called var fontName: String?
that returns nil
by default. To implement this in a struct
, define it as follows:
struct Config: AvatarImageViewConfiguration {
var fontName: String? = "Futura-Medium"
}
Defining it as:
struct Config: AvatarImageViewConfiguration {
var fontName = "Futura-Medium"
}
... will not work :(
Documentation
Docs are available on CocoaDocs
Requirements
AvatarImageView requires at least iOS 8.
Installation
AvatarImageView is available through CocoaPods. To install it, add the following lines to your Podfile:
use_frameworks!
# Swift 2.2
pod "AvatarImageView", '1.1.1'
# Swift 2.3
pod "AvatarImageView", '~> 1.2.1'
# Swift 3.0
pod "AvatarImageView", '2.0.0'
# Swift 4.0
pod "AvatarImageView", '~> 2.1.0'
# Swift 4.2
pod "AvatarImageView", '~> 2.2.0'
Release Notes
2.2.0
Added Swift 4.2 support
2.1.1
Fixed irrational test suite and test warnings
2.1.0
Migrated to Swift 4
2.0.3
Added a baseline offset config attribute which may be needed for custom fonts
2.0.2
Fixing an issue where a profile picture may not always appear in a circle even if specified in the configuration.
2.0.1
Modified init(frame:)
to be public. Seems to have reversed from earlier by a bad merge.
2.0.0
Migrated code to Swift 3.0.
1.2.1
Set deployment target to 8.0. No further features or patches will be issued for Swift 2.3 after this release.
1.2.0
Migrated code to Swift 2.3.
1.1.1
Modified init(frame:)
to be public.
1.1.0
Improved the random color generator. It now generates a hash from the initials and name, and then uses that as the seed to generate the random color, so it's always the same for each unique user.
1.0.0
Initial Release
Author
Ayush Newatia, [email protected]
License
AvatarImageView is available under the MIT license. See the LICENSE.md file for more info.
*Note that all licence references and agreements mentioned in the AvatarImageView README section above
are relevant to that project's source code only.