JNAvatarWithInitials is used to show single avatar image usign web url or UIImage object and have the option to show initials.
- iOS 12.0+ / macOS 15.7+
- Xcode 26+
- Swift 5.10+
JNAvatarWithInitials support SwiftPM. To use SwiftPM, you should use Xcode 26 to open your project. Click File -> Swift Packages -> Add Package Dependency, enter JNAvatarWithInitials repo's URL
-
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، imageFilter: CIFilter)- 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.
- imageFilter : CIFilter to be applyed to the image.
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() -> UIImageViewJayel Zaghmoutt & Mohammad Nabulsi
JNAvatarWithInitials is available under the MIT license. See the LICENSE file for more info.