Skip to content

JNDisrupter/JNAvatarWithInitials

Repository files navigation

JNAvatarWithInitials

Build Status Version License Platform

JNAvatarWithInitials is used to show single avatar image usign web url or UIImage object and have the option to show initials.

Screenshots

ScreenShot1

Requirements

  • iOS 9.0+ / macOS 10.10+
  • Xcode 9.0+
  • Swift 4+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate JNAvatarWithInitials into your Xcode project using CocoaPods, specify it in your Podfile:

use_frameworks!

target '<Your Target Name>' do
    pod 'JNAvatarWithInitials'
end

Then, run the following command:

$ pod install

Usage

To add JNAvatarWithInitials in interface builder:

  1. Put some UIView and change the class to "JNAvatarWithInitials"

  2. Add refrence for it in the view controller.

  3. Change Attributes:

  • initialsFont : The font that is used for the initials.
  • initialTextColor : The text color that is used for the initials.
  • initialLabelInset : The insets that applied to the initials label.
  1. Call setup method:

Setup view using image url

func setup(imageUrl : String , placeHolderImage : UIImage , fullName : String , showInitails)
parameters
  • imageUrl : The image url to use for loading image.
  • placeHolderImage : The placeholder image to use when failed.
  • fullName : The full name to use for initials.
  • showInitails : Flag to indicate if should show initials or not.

Setup view using UIImage

func setup(image : UIImage? , placeHolderImage : UIImage , fullName : String , showInitails)
parameters
  • image : The UIImage object to set.
  • placeHolderImage : The placeholder image to use if the UIImage object is nil.
  • fullName : The full name to use for initials.
  • showInitails : Flag to indicate if should show initials or not.
  1. Getter methods:

Get Image View

func getImageView() -> UIImageView

Authors

Jayel Zaghmoutt & Mohammad Nabulsi

License

JNAvatarWithInitials is available under the MIT license. See the LICENSE file for more info.