All Projects → ayushn21 → Avatarimageview

ayushn21 / Avatarimageview

Licence: mit
DEPRECATED!!! --- Use https://github.com/neone/NDAvatarApp

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Avatarimageview

Flexlayout
FlexLayout adds a nice Swift interface to the highly optimized facebook/yoga flexbox implementation. Concise, intuitive & chainable syntax.
Stars: ✭ 1,342 (+422.18%)
Mutual labels:  ios-lib, ios-ui
Calendarkit
📅 Calendar for Apple platforms in Swift
Stars: ✭ 2,049 (+697.28%)
Mutual labels:  ios-lib, ios-ui
Swiftcocoadsl
An easy way to write iOS UI
Stars: ✭ 103 (-59.92%)
Mutual labels:  ios-lib, ios-ui
Dsgradientprogressview
A simple animated progress bar in Swift
Stars: ✭ 437 (+70.04%)
Mutual labels:  ios-lib, ios-ui
StackViewLayout
Coming soon!
Stars: ✭ 26 (-89.88%)
Mutual labels:  ios-ui, ios-lib
Cardviewlist
An elegant and responsive CardView like Android on iOS with Swift. Available horizontal and vertical scrolling with full animations and customizable.
Stars: ✭ 30 (-88.33%)
Mutual labels:  ios-lib, ios-ui
Pinlayout
Fast Swift Views layouting without auto layout. No magic, pure code, full control and blazing fast. Concise syntax, intuitive, readable & chainable. [iOS/macOS/tvOS/CALayer]
Stars: ✭ 1,870 (+627.63%)
Mutual labels:  ios-lib, ios-ui
Nvactivityindicatorview
A collection of awesome loading animations
Stars: ✭ 10,031 (+3803.11%)
Mutual labels:  ios-lib, ios-ui
Pvview
A small library that helps you to make an amazing parallax view
Stars: ✭ 227 (-11.67%)
Mutual labels:  ios-lib, ios-ui
Mycoretextlabel
图文混排 , 实现图片文字混排 , 可显示常规链接比如网址,@,#话题#,手机号 , 邮箱号等 , 可以自定义链接字,设置关键字高亮等功能 . 适用于微博,微信,IM聊天对话等场景 . 实现这些功能仅用了几百行代码,耦合性也较低
Stars: ✭ 192 (-25.29%)
Mutual labels:  ios-lib, ios-ui
Kdintroview
Stars: ✭ 300 (+16.73%)
Mutual labels:  ios-lib, ios-ui
FacebookMessengerActivity
Share with Facebook Messenger App.
Stars: ✭ 16 (-93.77%)
Mutual labels:  ios-ui, ios-lib
Iosproject
IOS综合项目,完善的框架,路由模块化设计,集成科大讯飞SDK方便iOS基本输入控件实现语音辅助输入,UI效果参照京东APP,JS与OC交互,ionic跨平台开发,MQTT 协议,即时通讯协议,视屏播放,跑马灯效果 仿美团地图定位,城市收索, 友盟分享,基础动画 增加FCUIID帮助类,引导页功能模块,照片上传 ,UIView自定义导航栏,文件下载,Masonry 案例,fmdb,数据库,sqlite,百度地图,二维码,照片上传,照片上传有进度,列表倒计时,H5和原生交互,自定义各种弹框,常见表单类型,人脸识别,列表加载图片,列表拖拽,日历操作,导航条渐变,核心动画,动画特效等等
Stars: ✭ 291 (+13.23%)
Mutual labels:  ios-lib, ios-ui
Cocoaasyncsocket demo
基于AsyncSocket搭建即时通讯体系 . 包含TCP连接 , 消息发送 , 消息接收 , 心跳处理 ,断网重连 , 消息超时 , 消息分发 , 数据库结构设计 , 消息丢失等 . 以及UI设计, 文本表情消息/语音消息/图片消息/视频消息/文件消息/撤回消息/提示语消息的实现思路讲解
Stars: ✭ 981 (+281.71%)
Mutual labels:  ios-lib, ios-ui
Lmmediaplayer
A video and audio player with replaceable UI component.
Stars: ✭ 183 (-28.79%)
Mutual labels:  ios-lib, ios-ui
Rhplaceholder
Show pleasant loading view for your users 😍
Stars: ✭ 238 (-7.39%)
Mutual labels:  ios-lib, ios-ui
RDPopup
A simple way to add custom Popup. Design on Nib and use as you want. Written in Objective-C.
Stars: ✭ 19 (-92.61%)
Mutual labels:  ios-ui, ios-lib
M2DWebViewController
Simple built-in web view controller using WebKit.
Stars: ✭ 25 (-90.27%)
Mutual labels:  ios-lib
SPRCollectionView
iOS:使用CollectionView实现Wallet效果
Stars: ✭ 97 (-62.26%)
Mutual labels:  ios-ui
UIImageViewWithWords
Create UIImageView with words in Swift
Stars: ✭ 89 (-65.37%)
Mutual labels:  uiimageview

MIT Licence Pod Version Swift Version Twitter

🚨🚨 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 Build Status
Master Build Status

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: returns nil
  • var bgColor: UIColor? { get } - Default: returns nil
  • 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: returns 0.5
  • var fontName: String? { get } - Default: returns nil
  • var bgColor: UIColor? { get } - Default: returns innil. The bgColor in AvatarImageViewDataSource 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 AvatarImageViews 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 Circle Initials Mask Initials

Here's an example of when the dataSource supplies a profile picture and the configuration is set to a circle.

Circle Profile Pic

It works great with custom fonts!

Custom Font

...and also with UITableViews

Table View Pics

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

  1. Always set the configuration before the dataSource. If you don't, you will need to manually call refresh() to render the view correctly.

  2. When implementing the AvatarImageViewDataSource and AvatarImageViewConfiguration 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 the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].