avatarimageview

Welcome to AvatarImageView!

AvatarImageView is a lightweight and easy-to-use library for displaying circular images, commonly used for profile pictures or avatars. This library is written in Swift and is compatible with iOS.

Features:

– Display circular images: AvatarImageView allows you to easily display circular images by simply setting the image URL or image data.
– Placeholder image: You can set a default placeholder image to be displayed when the main image is not available.
– Customizable: AvatarImageView provides options to customize the appearance such as border color, border width, and background color.

Installation:

Cocoapods:
1. Add the following line to your Podfile:

“`ruby
pod ‘AvatarImageView’
“`

2. Run `pod install` in your project directory.

Manual:
1. Download the latest release from the GitHub repository: [AvatarImageView](https://github.com/username/repo).
2. Drag and drop the AvatarImageView.swift file into your project.

Usage:

Follow the steps below to quickly get started with AvatarImageView:

1. Import the AvatarImageView module in your Swift file:

“`swift
import AvatarImageView
“`

2. Create an instance of AvatarImageView:

“`swift
let avatarImageView = AvatarImageView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
“`

3. Set the image URL or image data using one of the following methods:
– Using an image URL:
“`swift
avatarImageView.setImage(url: imageURL)
“`
– Using image data:
“`swift
avatarImageView.setImage(data: imageData)
“`

4. Customize the appearance of the AvatarImageView as per your requirements:
– Set a placeholder image:
“`swift
avatarImageView.placeholderImage = UIImage(named: “placeholder”)
“`
– Change border color:
“`swift
avatarImageView.borderColor = .red
“`
– Change border width:
“`swift
avatarImageView.borderWidth = 2.0
“`
– Change background color:
“`swift
avatarImageView.backgroundColor = .white
“`

5. Add the AvatarImageView instance to your view hierarchy:
“`swift
view.addSubview(avatarImageView)
“`

Example:

Here’s an example of how to use AvatarImageView in your project:

“`swift
import UIKit
import AvatarImageView

class ViewController: UIViewController {
let avatarImageView = AvatarImageView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))

override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(avatarImageView)

// Set image URL
let imageURL = URL(string: “https://example.com/avatar.jpg”)!
avatarImageView.setImage(url: imageURL)

// Customize appearance
avatarImageView.borderColor = .blue
avatarImageView.borderWidth = 2.0
avatarImageView.placeholderImage = UIImage(named: “placeholder”)
}
}
“`

License:

AvatarImageView is released under the MIT License. See [LICENSE](https://github.com/username/repo/blob/master/LICENSE) for details.