Libraries
imgix-swift build
Installation
- Carthage:
github "imgix/imgix-swift"
- CocoaPods:
pod "ImgixSwift"
- Swift Package Manager:
As of version 1.0.0
imgix Swift client is compatible with Swift 5.0.
The latest version compatible with Swift 4.0 is 0.4.3
.
The latest version compatible with Swift 3.0 is 0.3.0
.
Usage
Swift
Objective-C
If your project doesn't contain any other Swift code, make sure to set your target's Build Settings > Build Options > Embedded Content Contains Swift Code
to YES
.
// Import the framework
#import <ImgixSwift/ImgixSwift.h>
// Set up an ImgixClient
ImgixClient *client = [[ImgixClient alloc] initWithHost:@"assets.imgix.net"];
// Build a basic URL
[client buildUrl:@"dog.jpg"]; // => https://assets.imgix.net/dog.jpg
// Add some parameters
[client buildUrl:@"dog.jpg", params:@{
@"w": @300,
@"h": @300,
@"fit": @"crop",
}]; // => https://assets.imgix.net/dog.jpg?fit=crop&h=300&w=300
Advanced Usage
Automatic Signing
If you're using a source that requires signed URLs, imgix-swift can automatically build and sign them for you.
Automatic Base64 Encoding
imgix-swift will automatically Base64-encode any parameter key ending in 64
, according to the requirements of imgix's Base64 variant parameters.
URL Reconstruction
You can reconstruct existing URLs by using the ImgixClient#reconstruct
method. Existing parameters on the input URL will be merged and/or overridden by passed params.
What is the ixlib
param
For security and diagnostic purposes, we default to signing all requests with the language and version of library used to generate the URL. This can be disabled by setting client.includeLibraryParam = false
.
License
More Core Libraries
- imgix-csharpbuildA C# client library for generating image URLs with imgixC# 14 a year ago
- imgix-gobuildA Go client library for generating image URLs with imgixGo 12 a year ago
- imgix-javabuildA Java client library for generating URLs with imgixJava 19 a year ago
- imgix-phpbuildA PHP client library for generating URLs with imgixPHP 111 a year ago
- imgix-pythonbuildA Python client library for generating URLs with imgixPython 36 a year ago
- imgix-rbbuildA Ruby gem for generating image URLs with imgixRuby 76 a year ago
- @imgix/js-corebuildA JavaScript client library for generating image URLs with imgixJavaScript 120 5 days ago