Swiftpack.co - Package - Alamofire/AlamofireImage
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

AlamofireImage

Build Status CocoaPods Compatible Carthage Compatible Platform Twitter Gitter

AlamofireImage is an image component library for Alamofire.

Features

  • ☑ Image Response Serializers
  • ☑ UIImage Extensions for Inflation / Scaling / Rounding / CoreImage
  • ☑ Single and Multi-Pass Image Filters
  • ☑ Auto-Purging In-Memory Image Cache
  • ☑ Prioritized Queue Order Image Downloading
  • ☑ Authentication with URLCredential
  • ☑ UIImageView Async Remote Downloads with Placeholders
  • ☑ UIImageView Filters and Transitions
  • ☑ Comprehensive Test Coverage
  • Complete Documentation

Requirements

  • iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+
  • Xcode 11+
  • Swift 5.1+

Migration Guides

Dependencies

Communication

  • If you need to find or understand an API, check our documentation.
  • If you need help with an AlamofireImage feature, use our forum on swift.org.
  • If you'd like to discuss AlamofireImage best practices, use our forum on swift.org.
  • If you'd like to discuss a feature request, use our forum on swift.org.
  • If you found a bug, open an issue and follow the guide. The more detail the better!
  • If you want to contribute, submit a pull request.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate AlamofireImage into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'AlamofireImage', '~> 4.1'

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate AlamofireImage into your Xcode project using Carthage, specify it in your Cartfile:

github "Alamofire/AlamofireImage" ~> 4.1

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but AlamofireImage does support its use on supported platforms.

Once you have your Swift package set up, adding AlamofireImage as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/Alamofire/AlamofireImage.git", .upToNextMajor(from: "4.1.0"))
]

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate AlamofireImage into your project manually.

Embedded Framework

  • Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:
$ git init
  • Add AlamofireImage as a git submodule by running the following command:
$ git submodule add https://github.com/Alamofire/AlamofireImage.git
  • Open the new AlamofireImage folder, and drag the AlamofireImage.xcodeproj into the Project Navigator of your application's Xcode project.

    It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.

  • Select the AlamofireImage.xcodeproj in the Project Navigator and verify the deployment target matches that of your application target.

  • Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.

  • In the tab bar at the top of that window, open the "General" panel.

  • Click on the + button under the "Embedded Binaries" section.

  • You will see two different AlamofireImage.xcodeproj folders each with two different versions of the AlamofireImage.framework nested inside a Products folder.

    It does not matter which Products folder you choose from, but it does matter whether you choose the top or bottom AlamofireImage.framework.

  • Select the top AlamofireImage.framework for iOS and the bottom one for OS X.

    You can verify which one you selected by inspecting the build log for your project. The build target for AlamofireImage will be listed as either AlamofireImage iOS, AlamofireImage macOS, AlamofireImage tvOS or AlamofireImage watchOS.

  • And that's it!

    The AlamofireImage.framework is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.


Usage

Image Response Serializers

import Alamofire
import AlamofireImage

Alamofire.request("https://httpbin.org/image/png").responseImage { response in
	debugPrint(response)

	print(response.request)
	print(response.response)
	debugPrint(response.result)

    if case .success(let image) = response.result {
		print("image downloaded: \(image)")
	}
}

The AlamofireImage response image serializers support a wide range of image types including:

  • image/png
  • image/jpeg
  • image/tiff
  • image/gif
  • image/ico
  • image/x-icon
  • image/bmp
  • image/x-bmp
  • image/x-xbitmap
  • image/x-ms-bmp
  • image/x-win-bitmap
  • image/heic
  • application/octet-stream (added for iOS 13 support)

If the image you are attempting to download is an invalid MIME type not in the list, you can add custom acceptable content types using the addAcceptableImageContentTypes extension on the DataRequest type.

UIImage Extensions

There are several UIImage extensions designed to make the common image manipulation operations as simple as possible.

Inflation

let url = Bundle.main.url(forResource: "unicorn", withExtension: "png")!
let data = try! Data(contentsOf: url)
let image = UIImage(data: data, scale: UIScreen.main.scale)!

image.af.inflate()

Inflating compressed image formats (such as PNG or JPEG) in a background queue can significantly improve drawing performance on the main thread.

Scaling

let image = UIImage(named: "unicorn")!
let size = CGSize(width: 100.0, height: 100.0)

// Scale image to size disregarding aspect ratio
let scaledImage = image.af.imageScaled(to: size)

// Scale image to fit within specified size while maintaining aspect ratio
let aspectScaledToFitImage = image.af.imageAspectScaled(toFit: size)

// Scale image to fill specified size while maintaining aspect ratio
let aspectScaledToFillImage = image.af.imageAspectScaled(toFill: size)

Rounded Corners

let image = UIImage(named: "unicorn")!
let radius: CGFloat = 20.0

let roundedImage = image.af.imageRounded(withCornerRadius: radius)
let circularImage = image.af.imageRoundedIntoCircle()

Core Image Filters

let image = UIImage(named: "unicorn")!

let sepiaImage = image.af.imageFiltered(withCoreImageFilter: "CISepiaTone")

let blurredImage = image.af.imageFiltered(
    withCoreImageFilter: "CIGaussianBlur",
    parameters: ["inputRadius": 25]
)

Image Filters

The ImageFilter protocol was designed to make it easy to apply a filter operation and cache the result after an image finished downloading. It defines two properties to facilitate this functionality.

public protocol ImageFilter {
    var filter: Image -> Image { get }
    var identifier: String { get }
}

The filter closure contains the operation used to create a modified version of the specified image. The identifier property is a string used to uniquely identify the filter operation. This is useful when adding filtered versions of an image to a cache. All identifier properties inside AlamofireImage are implemented using protocol extensions.

Single Pass

The single pass image filters only perform a single operation on the specified image.

let image = UIImage(named: "unicorn")!
let imageFilter = RoundedCornersFilter(radius: 10.0)

let roundedImage = imageFilter.filter(image)

The current list of single pass image filters includes:

  • ScaledToSizeFilter - Scales an image to a specified size.
  • AspectScaledToFitSizeFilter - Scales an image from the center while maintaining the aspect ratio to fit within a specified size.
  • AspectScaledToFillSizeFilter - Scales an image from the center while maintaining the aspect ratio to fill a specified size. Any pixels that fall outside the specified size are clipped.
  • RoundedCornersFilter - Rounds the corners of an image to the specified radius.
  • CircleFilter - Rounds the corners of an image into a circle.
  • BlurFilter - Blurs an image using a CIGaussianBlur filter with the specified blur radius.

Each image filter is built ontop of the UIImage extensions.

Multi-Pass

The multi-pass image filters perform multiple operations on the specified image.

let image = UIImage(named: "avatar")!
let size = CGSize(width: 100.0, height: 100.0)
let imageFilter = AspectScaledToFillSizeCircleFilter(size: size)

let avatarImage = imageFilter.filter(image)

The current list of multi-pass image filters includes:

  • ScaledToSizeWithRoundedCornersFilter - Scales an image to a specified size, then rounds the corners to the specified radius.
  • AspectScaledToFillSizeWithRoundedCornersFilter - Scales an image from the center while maintaining the aspect ratio to fit within a specified size, then rounds the corners to the specified radius.
  • ScaledToSizeCircleFilter - Scales an image to a specified size, then rounds the corners into a circle.
  • AspectScaledToFillSizeCircleFilter - Scales an image from the center while maintaining the aspect ratio to fit within a specified size, then rounds the corners into a circle.

Image Cache

Image caching can become complicated when it comes to network images. URLCache is quite powerful and does a great job reasoning through the various cache policies and Cache-Control headers. However, it is not equipped to handle caching multiple modified versions of those images.

For example, let's say you need to download an album of images. Your app needs to display both the thumbnail version as well as the full size version at various times. Due to performance issues, you want to scale down the thumbnails to a reasonable size before rendering them on-screen. You also need to apply a global CoreImage filter to the full size images when displayed. While URLCache can easily handle storing the original downloaded image, it cannot store these different variants. What you really need is another caching layer designed to handle these different variants.

let imageCache = AutoPurgingImageCache(
    memoryCapacity: 100_000_000,
    preferredMemoryUsageAfterPurge: 60_000_000
)

The AutoPurgingImageCache in AlamofireImage fills the role of that additional caching layer. It is an in-memory image cache used to store images up to a given memory capacity. When the memory capacity is reached, the image cache is sorted by last access date, then the oldest image is continuously purged until the preferred memory usage after purge is met. Each time an image is accessed through the cache, the internal access date of the image is updated.

Add / Remove / Fetch Images

Interacting with the ImageCache protocol APIs is very straightforward.

let imageCache = AutoPurgingImageCache()
let avatarImage = UIImage(data: data)!

// Add
imageCache.add(avatarImage, withIdentifier: "avatar")

// Fetch
let cachedAvatar = imageCache.image(withIdentifier: "avatar")

// Remove
imageCache.removeImage(withIdentifier: "avatar")

URL Requests

The ImageRequestCache protocol extends the ImageCache protocol by adding support for URLRequest caching. This allows a URLRequest and an additional identifier to generate the unique identifier for the image in the cache.

let imageCache = AutoPurgingImageCache()

let urlRequest = URLRequest(url: URL(string: "https://httpbin.org/image/png")!)
let avatarImage = UIImage(named: "avatar")!.af.imageRoundedIntoCircle()

// Add
imageCache.add(avatarImage, for: urlRequest, withIdentifier: "circle")

// Fetch
let cachedAvatarImage = imageCache.image(for: urlRequest, withIdentifier: "circle")

// Remove
imageCache.removeImage(for: urlRequest, withIdentifier: "circle")

Auto-Purging

Each time an image is fetched from the cache, the cache internally updates the last access date for that image.

let avatar = imageCache.image(withIdentifier: "avatar")
let circularAvatar = imageCache.image(for: urlRequest, withIdentifier: "circle")

By updating the last access date for each image, the image cache can make more informed decisions about which images to purge when the memory capacity is reached. The AutoPurgingImageCache automatically evicts images from the cache in order from oldest last access date to newest until the memory capacity drops below the preferredMemoryCapacityAfterPurge.

It is important to set reasonable default values for the memoryCapacity and preferredMemoryCapacityAfterPurge when you are initializing your image cache. By default, the memoryCapacity equals 100 MB and the preferredMemoryCapacityAfterPurge equals 60 MB.

Memory Warnings

The AutoPurgingImageCache also listens for memory warnings from your application and will purge all images from the cache if a memory warning is observed.

Image Downloader

The ImageDownloader class is responsible for downloading images in parallel on a prioritized queue. It uses an internal Alamofire SessionManager instance to handle all the downloading and response image serialization. By default, the initialization of an ImageDownloader uses a default URLSessionConfiguration with the most common parameter values.

let imageDownloader = ImageDownloader(
    configuration: ImageDownloader.defaultURLSessionConfiguration(),
    downloadPrioritization: .fifo,
    maximumActiveDownloads: 4,
    imageCache: AutoPurgingImageCache()
)

If you need to customize the URLSessionConfiguration type or parameters, then simply provide your own rather than using the default.

Downloading an Image

let downloader = ImageDownloader()
let urlRequest = URLRequest(url: URL(string: "https://httpbin.org/image/jpeg")!)

downloader.download(urlRequest) { response in
    print(response.request)
    print(response.response)
    debugPrint(response.result)

    if case .success(let image) = response.result {
        print(image)
    }
}

Make sure to keep a strong reference to the ImageDownloader instance, otherwise the completion closure will not be called because the downloader reference will go out of scope before the completion closure can be called.

Applying an ImageFilter

let downloader = ImageDownloader()
let urlRequest = URLRequest(url: URL(string: "https://httpbin.org/image/jpeg")!)
let filter = AspectScaledToFillSizeCircleFilter(size: CGSize(width: 100.0, height: 100.0))

downloader.download(urlRequest, filter: filter) { response in
    print(response.request)
    print(response.response)
    debugPrint(response.result)

    if case .success(let image) = response.result {
        print(image)
    }
}

Authentication

If your images are behind HTTP Basic Auth, you can append the user:password: or the credential to the ImageDownloader instance. The credentials will be applied to all future download requests.

let downloader = ImageDownloader()
downloader.addAuthentication(user: "username", password: "password")

Download Prioritization

The ImageDownloader maintains an internal queue of pending download requests. Depending on your situation, you may want incoming downloads to be inserted at the front or the back of the queue. The DownloadPrioritization enumeration allows you to specify which behavior you would prefer.

public enum DownloadPrioritization {
    case fifo, lifo
}

The ImageDownloader is initialized with a .fifo queue by default.

Image Caching

The ImageDownloader uses a combination of an URLCache and AutoPurgingImageCache to create a very robust, high performance image caching system.

URLCache

The URLCache is used to cache all the original image content downloaded from the server. By default, it is initialized with a memory capacity of 20 MB and a disk capacity of 150 MB. This allows up to 150 MB of original image data to be stored on disk at any given time. While these defaults have been carefully set, it is very important to consider your application's needs and performance requirements and whether these values are right for you.

If you wish to disable this caching layer, create a custom URLSessionConfiguration with the urlCache property set to nil and use that configuration when initializing the ImageDownloader.

Image Cache

The ImageCache is used to cache all the potentially filtered image content after it has been downloaded from the server. This allows multiple variants of the same image to also be cached, rather than having to re-apply the image filters to the original image each time it is required. By default, an AutoPurgingImageCache is initialized with a memory capacity of 100 MB and a preferred memory usage after purge limit of 60 MB. This allows up to 100 MB of most recently accessed filtered image content to be stored in-memory at a given time.

Setting Ideal Capacity Limits

Determining the ideal the in-memory and on-disk capacity limits of the URLCache and AutoPurgingImageCache requires a bit of forethought. You must carefully consider your application's needs, and tailor the limits accordingly. By default, the combination of caches offers the following storage capacities:

  • 150 MB of on-disk storage (original image only)
  • 20 MB of in-memory original image data storage (original image only)
  • 100 MB of in-memory storage of filtered image content (filtered image if using filters, otherwise original image)
  • 60 MB preferred memory capacity after purge of filtered image content

If you do not use image filters, it is advised to set the memory capacity of the URLCache to zero. Otherwise, you will be storing the original image data in both the URLCache's in-memory store as well as the AlamofireImage in-memory store.

Duplicate Downloads

Sometimes application logic can end up attempting to download an image more than once before the initial download request is complete. Most often, this results in the image being downloaded more than once. AlamofireImage handles this case elegantly by merging the duplicate downloads. The image will only be downloaded once, yet both completion handlers will be called.

Image Filter Reuse

In addition to merging duplicate downloads, AlamofireImage can also merge duplicate image filters. If two image filters with the same identifier are attached to the same download, the image filter is only executed once and both completion handlers are called with the same resulting image. This can save large amounts of time and resources for computationally expensive filters such as ones leveraging CoreImage.

Request Receipts

Sometimes it is necessary to cancel an image download for various reasons. AlamofireImage can intelligently handle cancellation logic in the ImageDownloader by leveraging the RequestReceipt type along with the cancelRequestForRequestReceipt method. Each download request vends a RequestReceipt which can be later used to cancel the request.

By cancelling the request through the ImageDownloader using the RequestReceipt, AlamofireImage is able to determine how to best handle the cancellation. The cancelled download will always receive a cancellation error, while duplicate downloads are allowed to complete. If the download is already active, it is allowed to complete even though the completion handler will be called with a cancellation error. This greatly improves performance of table and collection views displaying large amounts of images.

It is NOT recommended to directly call cancel on the request in the RequestReceipt. Doing so can lead to issues such as duplicate downloads never being allowed to complete.

UIImageView Extension

The UIImage Extensions, Image Filters, Image Cache and Image Downloader were all designed to be flexible and standalone, yet also to provide the foundation of the UIImageView extension. Due to the powerful support of these classes, protocols and extensions, the UIImageView APIs are concise, easy to use and contain a large amount of functionality.

Setting Image with URL

Setting the image with a URL will asynchronously download the image and set it once the request is finished.

let imageView = UIImageView(frame: frame)
let url = URL(string: "https://httpbin.org/image/png")!

imageView.af.setImage(withURL: url)

If the image is cached locally, the image is set immediately.

Placeholder Images

By specifying a placeholder image, the image view uses the placeholder image until the remote image is downloaded.

let imageView = UIImageView(frame: frame)
let url = URL(string: "https://httpbin.org/image/png")!
let placeholderImage = UIImage(named: "placeholder")!

imageView.af.setImage(withURL: url, placeholderImage: placeholderImage)

If the remote image is cached locally, the placeholder image is never set.

Image Filters

If an image filter is specified, it is applied asynchronously after the remote image is downloaded. Once the filter execution is complete, the resulting image is set on the image view.

let imageView = UIImageView(frame: frame)

let url = URL(string: "https://httpbin.org/image/png")!
let placeholderImage = UIImage(named: "placeholder")!

let filter = AspectScaledToFillSizeWithRoundedCornersFilter(
    size: imageView.frame.size,
    radius: 20.0
)

imageView.af.setImage(
    withURL: url,
    placeholderImage: placeholderImage,
    filter: filter
)

If the remote image with the applied filter is cached locally, the image is set immediately.

Image Transitions

By default, there is no image transition animation when setting the image on the image view. If you wish to add a cross dissolve or flip-from-bottom animation, then specify an ImageTransition with the preferred duration.

let imageView = UIImageView(frame: frame)

let url = URL(string: "https://httpbin.org/image/png")!
let placeholderImage = UIImage(named: "placeholder")!

let filter = AspectScaledToFillSizeWithRoundedCornersFilter(
    size: imageView.frame.size,
    radius: 20.0
)

imageView.af.setImage(
    withURL: url,
    placeholderImage: placeholderImage,
    filter: filter,
    imageTransition: .crossDissolve(0.2)
)

If the remote image is cached locally, the image transition is ignored.

Image Downloader

The UIImageView extension is powered by the default ImageDownloader instance. To customize cache capacities, download priorities, request cache policies, timeout durations, etc., please refer to the Image Downloader documentation.

Authentication

If an image requires and authentication credential from the UIImageView extension, it can be provided as follows:

ImageDownloader.default.addAuthentication(user: "user", password: "password")

Credits

Alamofire is owned and maintained by the Alamofire Software Foundation. You can follow them on Twitter at @AlamofireSF for project updates and releases.

Security Disclosure

If you believe you have identified a security vulnerability with AlamofireImage, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker.

Donations

The ASF is looking to raise money to officially stay registered as a federal non-profit organization. Registering will allow us members to gain some legal protections and also allow us to put donations to use, tax free. Donating to the ASF will enable us to:

  • Pay our yearly legal fees to keep the non-profit in good status
  • Pay for our mail servers to help us stay on top of all questions and security issues
  • Potentially fund test servers to make it easier for us to test the edge cases
  • Potentially fund developers to work on one of our projects full-time

The community adoption of the ASF libraries has been amazing. We are greatly humbled by your enthusiasm around the projects, and want to continue to do everything we can to move the needle forward. With your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members. If you use any of our libraries for work, see if your employers would be interested in donating. Any amount you can donate today to help us reach our goal would be greatly appreciated.

paypal

License

AlamofireImage is released under the MIT license. See LICENSE for details.

Github

link
Stars: 3643

Dependencies

Releases

Swift 5.1 - 2020-04-06T02:03:56

Released on 2020-04-05. All issues associated with this milestone can be found using this filter.

Updated

  • Project to require Swift 5.1.

Fixed Submodule, Proper nil Default - 2020-03-07T21:59:35

Released on 2020-03-07. All issues associated with this milestone can be found using this filter.

Fixed

  • Missing nil default for completionHandler parameter of download method.
  • Swift Package Manager compatibility with local submodules, for real this time.

SPM Submodule Compatibility - 2020-02-29T22:10:00

Released on 2020-02-29. All issues associated with this milestone can be found using this filter.

Fixed

  • Swift Package Manager compatibility with local submodules.

Swift 5 Compatibility Fix - 2020-02-24T02:39:22

Released on 2020-02-23. All issues associated with this milestone can be found using this filter.

Fixed

Cache Keys, AF Prefix, and AF5 - 2020-02-23T19:05:40

Released on 2020-02-23. All issues associated with this milestone can be found using this filter.

Added

  • Custom cacheKey support to ImageDownloader and UIImageView and UIButton extensions.
  • The application/octet-stream to the list of acceptable image content types to support iOS 13.
  • Custom ImageResponseSerializer support to ImageDownloader and UIImageView and UIButton extensions.
  • Tests to various types to verify they can handle URLRequestConvertible types that throw.
  • AlamofireExtended support to UIImage, UIImageView, and UIButton types to use af. prefixing instead of af_.
  • A 4.0 migration guide to the project and linked in the README.
  • SwiftFormat support to the project.

Updated

  • The license section of the README to link to the actual LICENSE file.
  • The ImageDownloader download image logic by removing variable shadowing to simplify logic flow.
  • The image cache capacity section in the README to improve in-memory setting recommendations.
  • The Alamofire dependency to ~> 5.0 across dependency management files.
  • The README to match all the newer conventions with the Alamofire 5 changes and af. prefixing on extensions.

Deprecated

  • The af_ APIs on UIImage, UIImageView, and UIButton in favor of the new af. equivalent APIs. These APIs will be removed in AFI5.

Fixed

  • Issue in the README where the documentation link was incorrect.
  • Issue where af_setBackgroundImage was not setting the filter correctly on the image download.
  • Issue where runImageTransitionIfCached on UIImageView was not setting the placeholder image correctly.

Thread-safety Fixes - 2019-10-27T23:07:45

Released on 2019-10-27. All issues associated with this milestone can be found using this filter.

Fixed

  • Thread-safety issue in AutoPurgingImageCache.

Catalyst Compatible - 2019-10-27T21:55:30

Released on 2019-10-27. All issues associated with this milestone can be found using this filter.

Fixed

  • Build for Catalyst platform by updating deprecated API usage.
  • Thread-safety issue in AutoPurgingImageCache.

Bringing in the Changes - 2019-09-17T23:33:54

Released on 2019-09-17. All issues associated with this milestone can be found using this filter.

Updated

  • URLCache usage for Mac Catalyst.

Fixed

  • Alamofire API usage after Alamofire 5 RC changes.

ImageDownloader Concurrency Bug Fixes - 2019-08-28T06:10:36

Released on 2019-08-27. All issues associated with this milestone can be found using this filter.

Fixed

  • Issue where ImageDownloader was not dequeuing and cancelling requests correctly in certain race conditions due to Alamofire switching to async request creation.

AppStore Connect Submission Fix - 2019-05-04T21:15:55

Released on 2019-05-04. All issues associated with this milestone can be found using this filter.

Fixed

  • Issue with AppStore submissions where the pre-release version in the bundle short versions string was being rejected when built with Carthage or as a submodule.

Alamofire 5.0.0-beta.5 Support - 2019-04-13T18:42:20

Released on 2019-04-13. All issues associated with this milestone can be found using this filter.

Updated

  • Project to require Alamofire 5.0.0-beta.5+ as a dependency.

Alamofire 5 and Swift 5 - 2019-04-10T16:54:50

Released on 2019-04-10. All issues associated with this milestone can be found using this filter.

Updated

  • Project to use Swift 5 only and require Alamofire 5.0.0-beta.4+ as a dependency.

Suddenly Compatible - 2019-03-28T23:40:03

Released on 2019-03-28. All issues associated with this milestone can be found using this filter.

Fixed

  • Building using Xcode 9.

Sudden Compatibility - 2019-03-28T00:08:48

Released on 2019-03-27. All issues associated with this milestone can be found using this filter.

Updated

  • Project and dependencies for Xcode 10.2.
  • SPM support for Swift 4.2 and 5.

Update for Alamofire 4.8.0. - 2018-11-28T01:31:29

Released on 2018-11-27. All issues associated with this milestone can be found using this filter.

Updated

  • Alamofire Carthage checkout.
  • Required Alamofire version to 4.8.
  • Default Swift version to 4.

Alamofire Workspace Linking - 2018-09-17T23:34:46

Released on 2018-09-17. All issues associated with this milestone can be found using this filter.

Updated

  • The Xcode project configuration to use workspace linking instead of nested projects.

Fixed

  • A minor CIGaussianBlur typo in one of the README examples.

Swift 4.2! - 2018-09-13T19:30:16

Released on 2018-09-13. All issues associated with this milestone can be found using this filter.

Updated

  • Project configuration and files for Xcode 10 and Swift 4.2.

Xcode 9.3 and Swift 4.1 - 2018-04-01T00:15:20

Released on 2018-03-31. All issues associated with this milestone can be found using this filter.

Added

  • Jazzy docs and configuration.
  • Ruby environment settings that match Alamofire's.

Updated

  • Project configuration and files for Xcode 9.3 and Swift 4.1.
  • Copyrights to 2018 for all files.
  • TravisCI configuration for Xcode 9.3.

Fixed

  • Gravatar API usage in example code.

Swift 3.2 and Xcode 9 - 2017-09-06T18:10:56

Released on 2017-09-06. All issues associated with this milestone can be found using this filter.

Added

  • Gitter badge to the README to direct users to the group.
  • Optional queue parameter to responseImage function.
  • Asserts to scaling functions as well as production fallbacks.
  • GitHub templates for issues and pull requests.

Updated

  • Alamofire submodule and dependency to ~> 4.5.
  • The project and codebase to support Swift 3 / 4 simultaneously.
  • The README to use the current version throughout the installation section.
  • Image response serializers code sample in the README to import Alamofire.

Fixed

  • The Swift Package Manager (SPM) integration by excluding Tests folder.
  • Issue in the embedded framework section of the README where bash specifier was incorrect.
  • Various typos throughout the project using misspell.

iOS 8.0 and macOS 10.10 and New ACLs - 2016-11-21T04:02:21

All issues associated with this milestone can be found using this filter.

Added

  • A new imageResponseSerializer property to the ImageDownloader.
  • New embedded framework installation instructions to the README.
  • A new iOS 8.1 target to the Travis CI device matrix.

Updated

  • The AutoPurgingImageCache APIs to an open ACL where applicable.
  • The ImageDownloader and RequestReceipt APIs to an open ACL where applicable.
  • The Xcode project to Xcode 8.1 and made all suggested project updates.
  • UIButton and UIImageView completion closures to be called after image is set.
  • The deployment targets to iOS 8.0 and macOS 10.10 to match core Alamofire project.
  • The Cartfile and pulled in Alamofire 4.2.0 submodule.

Removed

  • CoreImage filters on iOS 8.x due to runtime mapping issue with CIContext.

MJPEG Streams and UIButton Image Filters - 2016-10-02T03:57:27

All issues associated with this milestone can be found using this filter.

Added

  • New .swift-version file to repo and reactivated pod lib lint in Travis file.
  • The OS_ACTIVITY_MODE environment variable to disable excessive logging.
  • The new CoreImageFilter protocol and updated BlurFilter to conform to it.
  • The ability to the AutoPurgingImageCache to remove all images matching a URL request.
  • ImageFilter support to the UIButton extension.
  • MJPEG support to DataRequest extension for streaming images.
  • Stream image test for DataRequest extension and updated docstrings.

Updated

  • The Alamofire submodule to the 4.0.1 release.
  • All cases of OSX to macOS throughout the project.
  • Project settings by removing duplicate settings for individual targets.
  • Project and podspec so all files are compiled on all platforms.

Fixed

  • A typo in placeholderImage parameter in several UIButton APIs.
  • A CIGuassianBlur typo in one of the README code samples.

Upgrade Notes

This release contains a non-backwards compatible change that fixes a typo in the UIButton extension where placeholderImage was misspelled in two APIs. Rather than push a MAJOR version release for a typo that people are generally getting incorrect, we decided to break semver here and fix the typo for everyone. Please note that we always try to follow semver as strictly as possible. However, this seemed like the best option given that users would continue to struggle with the typo throughout the lifespan of the 3.x releases.

🌇🔥 AlamofireImage 3 🔥🌇 - 2016-09-11T10:34:01

All issues associated with this milestone can be found using this filter.

Added

  • An AFI 3.0 Migration Guide and updated the README to match new APIs.

Updated

  • All source, test and example logic as well as project settings to compile against the Xcode 8 beta releases.
  • Deployment targets to iOS 9.0, macOS 10.11, tvOS 9.0 and watchOS 2.0.
  • All instances of com.alamofire with org.alamofire throughout project.
  • Copyright headers to match Alamofire formatting.
  • Updated the travis yaml file for Xcode 8.
  • All source, test and example APIs to match Swift 3 design guidelines.
  • All docstrings to use new Swift 3 syntax.
  • All AssociatedKey names to be lowercased to match Swift 3 guidelines.
  • The podspec for the 3.0.0 release and bumped deployment targets.
  • Code signing to now automatic with an empty team.
  • Number of large image test iterations to 200 to attempt to stabilize travis.

Removed

  • DispatchWorkItemFlags implementation with async flags.
  • ReleaseTest configuration by enabling testability in travis yaml file.
  • An NSURL extension from the test suite that wasn’t used.

Fixed

  • Issue where removeImage API on the image cache would not remove the image.
  • Compilation errors due to AFError refactors in Alamofire.

Swift 2.3 Support and Bug Fixes - 2016-09-08T07:36:44

All issues associated with this milestone can be found using this filter.

Added

  • Cleanup Whitespace aggregate target and scheme and removed all excess whitespace.

Updated

  • The source, test and example code along with project settings to support Swift 2.2 and Swift 2.3 simultaneously.
  • Updated the travis yaml file for Swift 2.3 and the new OS target versions.
  • Updated the Cartfile and Alamofire submodule to the 3.5.0 release.
  • Updated Xcode project settings based on Xcode 8 GM recommendations.
  • Code coverage generation is now disabled on framework targets to improve stability.

Fixed

  • Issue where image download cancellation error was thrown in incorrect domain.
  • Image download cancellation and restart race condition.

Bug Fixes and Documentation Updates - 2016-07-19T06:18:03

All issues associated with this milestone can be found using this filter.

Updated

  • The dependency requirement in the README to Alamofire 3.3+.
  • The Alamofire submodule to the 3.4.1 release.
  • The Travis CI yaml file to use the xcode7.3 build.

Fixed

  • Issue where queue names were not using hex formatters properly.
  • Deprecation warning from errorWithCode usage by switching to explicit NSError creation logic.

Swift 2.2 and Progress Closures - 2016-03-24T00:46:52

All issues associated with this milestone can be found using this filter.

Added

  • The image/x-ms-bmp as an acceptable Content-Type.
  • The ability to track download progress in the ImageDownloader as well as the UIButton and UIImageView extensions.
  • The UIButton extension and tests to the tvOS targets.

Updated

  • The Alamofire submodule to the 3.3.0 release along with the Cartfile and Podspec dependencies.
  • All source code, tests and example logic to use Swift 2.2 conventions.
  • The required version of Xcode to 7.3 in the README.
  • The AutoPurgingImageCache to purge cache during memory warnings on tvOS.
  • Several Request and ImageDownloader tests on tvOS that were previously disabled.

Bug Fixes and Condensing APIs - 2016-02-08T01:59:46

All issues associated with this milestone can be found using this filter.

Added

  • Default value to completion parameter in downloadImage API in `ImageDownloader.

Updated

  • The Alamofire submodule to the 3.2.0 release.

Removed

  • Superfluous APIs on ImageDownloader, UIButton and UIImageView extensions and replaced with default parameter values.

Fixed

  • Issue in UIImage extension where CoreImage filters were using the incorrect output frame.
  • All blur filter tests across all devices and OS's.
  • Issue where image response serializer was not thread-safe by switching over to thread-safe UIImage initializer.
  • Build warnings in Xcode 7.3 beta 2 for Swift 2.2.

UIButton Extension and SPM Support - 2016-01-18T01:09:02

All issues associated with this milestone can be found using this filter.

Added

  • Alpha properties to UIImage extension along with unit tests.
  • Condition to UIImageView test to verify active request receipt is reset.
  • UIButton extension supporting remote image downloads.
  • Tests verifying Accept header is set properly for button image downloads.
  • UIButton extension tests around cancelling and restarting image downloads.
  • iOS 9.2 devices to the travis yaml device matrix.
  • Carthage/Build ignore flag to the .gitignore file to match Alamofire.
  • Package.swift file to support Swift Package Manager (SPM).

Updated

  • UIImage scaling now uses af_isOpaque property where applicable.
  • Refactored UIButton extension and tests to more closely follow coding standards.
  • Simplified UIImageView tests replacing KVO by overriding the image property.
  • Excluded the UIButton extension from osx and watchOS targets in podspec.
  • Copyright headers to include 2016! 🎉🎉🎉
  • The default parameters in AutoPurgingImageCache initializer with correct MB values.
  • Several UIImageView APIs to public ACL to allow for better reuse.
  • Alamofire submodule to 3.1.5 release.

Enqueuing Multiple Image Downloads, Cached Image Transitions and Bug Fixes - 2015-12-17T06:17:09

All issues associated with this milestone can be found using this filter.

Added

  • Ability for ImageDownloader to enqueue multiple image downloads at once.
  • Tests to verify image view can cancel and restart the same request.
  • Precondition to ImageCache ensuring memory capacity is GTE preferred usage after purge.
  • Ability for image transitions to run when image is cached if specified.
  • Test to verify Accept header is set correctly on UIImageView extension.
  • Added ReleaseTest configuration to allow running tests against optimized build.

Updated

  • Project to disable testability on release and to only build tests on when testing.
  • The Travis-CI configuration to Xcode 7.2, iOS 9.2, tvOS 9.1 and watchOS 2.1.

Fixed

  • Issue where image was not downloaded when cancelled and restarted.
  • Issue where af_setImageWithURL was not using acceptable content types.

ImageDownloader ACL Update and tvOS Fix - 2015-11-22T22:05:55

All issues associated with this milestone can be found using this filter.

Added

  • Note to the README about storing a strong ref to image downloaders.
  • Custom Info.plist for tvOS setting the UIRequiredDeviceCapabilities to arm64.

Updated

  • The sessionManager ACL in the ImageDownloader to allow access to the underlying session and configuration.
  • The Alamofire submodule to the Alamofire 3.1.3 release.

tvOS Framework and Tests - 2015-10-24T19:54:18

All issues associated with this milestone can be found using this filter.

Added

  • New tvOS framework and test targets to the project.
  • The tvOS deployment target to the podspec.
  • The BITCODE_GENERATION_MODE user defined setting to tvOS framework target.

Updated

  • The README to include tvOS and bumped the required version of Xcode.
  • The default tvOS and watchOS deployment targets in the Xcode project.
  • The Cartfile and Alamofire submodule to the 3.1.0 release.
  • The Travis-CI yaml file to run watchOS and tvOS builds and tests on xcode7.1 osx_image.