Latest 0.4.0
License MIT
Platforms ios 8.0, requires ARC
Dependencies SDWebImage
Frameworks Foundation, UIKit

A deadly simple UIView subclass for rounded corners lazy-loaded images.

Pure swift code.

It loads and renders a UIImage lazyily from a URL, optionally specifying a placeholder image.

Interface Builder support

You can use GPAvatarImage directly from Interface Builder, dragging a UIView into your view hierarchy and chaning its class to GPAvatarImage. The view is fully compliant with Xcode 6 Live Rendering feature, so you can preview the image and set a placeholder directly from IB.

Needless to say, you can otherwise use this component programmatically.


There’s a single method you can call:

func setImageWithURL(
  placeholder: UIImage? = nil,
  completionHandler:((UIImage!, NSError?) -> Void)? = nil

as you see the only required parameter is URL. placeholder and completionHandler are optional.

Quick example

let url = NSURL(string: "")
let placeholder = UIImage(named: "placeholder")

avatarView.setImageWithURL(url, placeholder: placeholder) { (image, error) in
  if let e = error {
    println("Houston, we have a problem: (e)")
  } else {
    // do whatever you like with your damn image


Latest podspec

    "name": "GPAvatarView",
    "version": "0.4.0",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "summary": "A dead simple UIView subclass for rounded corners images",
    "homepage": "",
    "social_media_url": "",
    "authors": {
        "Gabriele Petronella": "[email protected]"
    "platforms": {
        "ios": "8.0"
    "source": {
        "git": "",
        "tag": "v0.4.0"
    "source_files": "GPAvatarView/GPAvatarView.swift",
    "frameworks": [
    "requires_arc": true,
    "dependencies": {
        "SDWebImage": [
            "~> 3.7.1"
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This