JNAvatarWithInitials is used to show single avatar image usign web url or UIImage object and have the option to show initials.
- iOS 9.0+ / macOS 10.10+
- Xcode 9.0+
- Swift 4+
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
-
Put some UIView and change the class to "JNAvatarWithInitials"
-
Add refrence for it in the view controller.
-
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.
- Call setup method:
Setup view using image url
func setup(imageUrl : String , placeHolderImage : UIImage , fullName : String , showInitails)
- 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)
- 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.
- Getter methods:
Get Image View
func getImageView() -> UIImageView
Jayel Zaghmoutt & Mohammad Nabulsi
JNAvatarWithInitials is available under the MIT license. See the LICENSE file for more info.