惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
月光博客
月光博客
WordPress大学
WordPress大学
C
Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 【当耐特】
大猫的无限游戏
大猫的无限游戏
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
The Cloudflare Blog
有赞技术团队
有赞技术团队
Microsoft Azure Blog
Microsoft Azure Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
小众软件
小众软件
H
Heimdal Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
W
WeLiveSecurity
量子位
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
F
Fortinet All Blogs
T
Threat Research - Cisco Blogs
Attack and Defense Labs
Attack and Defense Labs
P
Privacy & Cybersecurity Law Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
NISL@THU
NISL@THU
Forbes - Security
Forbes - Security
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
L
LINUX DO - 热门话题
Google Online Security Blog
Google Online Security Blog
S
Security Affairs
V2EX - 技术
V2EX - 技术
TaoSecurity Blog
TaoSecurity Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
S
Security @ Cisco Blogs
宝玉的分享
宝玉的分享
Project Zero
Project Zero
The Hacker News
The Hacker News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
PCI Perspectives
PCI Perspectives
G
GRAHAM CLULEY
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
S
Schneier on Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 聂微东

ImageKit.io Blog

Next.js Image Optimization with ImageKit Use Video as a Background in Your Next.js Project How to Fix Autoplay Video in Next.js How Durian Scaled a Visual-First Retail Experience to 350K Monthly Visitors Online How Matsmart accelerated image delivery across countries with ImageKit AI in Digital Asset Management: From Smart Workflows to Agentic Automation How Joseph Joseph unified and secured global video delivery with ImageKit How Modall powers fast, effortless media delivery across 40+ projects with ImageKit Digital Asset Management (DAM) Trends: 2026 Report How to add a poster image to Video.js player (and automate it) HLS streaming with Video.js + React Building the future of storytelling with fast, AI-powered video delivery How PushOwl delivers 100M+ image-rich notifications seamlessly with ImageKit How Homify delivers millions of interior design images seamlessly with ImageKit Better event discovery with lightning‑fast videos & images Adding video player in React Native Video player in Angular applications Crop and resize videos in React Next.js image and video upload React image and video upload React video optimization How we quadrupled our traffic to 625K monthly page views How Apollo 24|7 boosted performance & reduced costs with ImageKit Simplify your media workflows with ImageKit DAM integrations Extending Lighthouse for custom image and video optimization analysis Brand Asset Management: What is it? How does it work? WordPress Digital Asset Management Guide - Manage your WP media assets better Why Shopify retailers need a digital asset management solution DAM vs. SharePoint: Which is best for you? AI-powered Metadata and Tagging in Digital Asset Management How Hopscotch built India's largest online Kids' fashion brand with ImageKit Dropbox Vs. DAM: Which Is The Right Tool For Digital Asset Management Digital Asset Management for Photographers: A Complete Guide Why digital asset management for agencies is essential Helping both Top and Bottom Line: SaffronStays rapid, profitable growth with ImageKit How KreditBee simplified media experiences with ImageKit Google Drive alternatives for businesses (with fast-growing teams) Node.js image upload ImageKit: The Secret Ingredient in Swiggy’s Expansion Journey Streamlining the Design Approval Process: A Comprehensive Guide AV1 Codec - Complete guide for video application devs PHP image and video upload Angular image & video upload AV1 vs VP9: Which codec should you choose? Adding video player in Next.js React Video Player VP8 vs VP9 - In the context of online video delivery Exploring WebM vs MP4 7 Free Digital Asset Management Software that are not Open-Source Comparing 9 Top Digital Asset Management Tools in the Market What are Brand Standards and Why do they Matter? Boost Sales and Brand Appeal: Essential Tips for eCommerce Image Management Brand Recall: The Strategy to Create Unforgettable Brands How to upload files in HTML? Branding for Small Businesses (2025 Edition) Everything you need to know about VP9 codec Recent updates from ImageKit and what's next Best Ways to Write RFP For Digital Asset Management (+ with free RFP template) What is Brand Dilution? How to Avoid It? Explained with [Examples] The Importance of Brand Identity: Leveraging Digital Asset Management for Impact From Launch to Scale: How to Launch a Brand Campaign Digital Asset Management Requirements - What do You Need to Evaluate and How? Marketing Collateral Management: A Quick End-to-End Guide Video Content Management System: What Is It And How To Choose One? Dropbox vs. Google Drive vs. Onedrive: The Best Cloud Storage Solution How to Build Brand Trust: Get Started In 2025 Google Drive vs. Box: A Detailed Comparison How Digital Asset Management Solutions Help Protect Brand Equity A DAM Solution Can Safeguard Your Digital Intellectual Property - Here’s How WebP Vs. PNG: Which Image Format Should You Use and Why? How to Resize Images in Bootstrap Easily Progressive jpegs (PJPEG): the key to loading images faster on your website Dropbox vs. Google Drive: The Best Cloud Storage For Digital Assets Dropbox Pros & Cons In 2024: An In-Depth Analysis and Why A DAM Solution Stands Out Google Drive Vs OneDrive: The Better Storage Option For Digital Assets Manage your video assets better with video metadata Understanding DAM's Role in Strengthening Brand Identity Digital asset management strategy: What to know before creating one The Ultimate Guide To Marketing Agency Onboarding 6 Solutions To Simplify Large File Sharing Over The Web A Step-by-Step Breakdown of a Video Production Workflow 13 Digital Asset Management Use Cases You Should Know How to Conduct a Brand Audit and Manage Your Brand Assets Costly Consequences of Inconsistent Branding And How DAM Can Help Dynamic Asset Transformation: What It Is, Why You Need It, and How ImageKit Can Help Everything You Need to Know About HTML Video Autoplay How To Select Your DAM Vendor: A Complete Guide How to Boost User Experience with Smart Digital Asset Management React Image Optimization: A Guide for Web Developers Why Should DAM Be A Part Of Your MarTech Stack? Unleashing the Power of Content Repurposing with ImageKit MKV vs MP4: Which Video File Format Is Better for Your Needs? Digital Asset Management For Ecommerce: A Complete Guide How an Image Tagging Software can Transform Your Image Search How to Manage Your Content Lifecycle Effectively M4V vs MP4: Which Video Format Should You Use and Why? Why Every Business Needs An Image Management System All The Questions To Ask During A Dam Demo Which is the Best Image Format for Your Website? Uploading Multiple Files Using JavaScript: A Comprehensive Guide
Image optimization and file upload in iOS using ImageKit
Abhinav Dhiman · 2020-09-10 · via ImageKit.io Blog

ImageKit.io is an image CDN that provides intelligent real-time image optimization, resizing, cropping, and fast CDN delivery. It allows provides a media library with unlimited storage.

ImageKit.io iOS SDK simplifies the URL generation and file uploading in the iOS application.

Prerequisites

If you want to explore how an iOS App can utilize this ImageKit SDK, we have provided a pre-built sample iOS Example app. Refer to this repository for the same.

Basic setup

Here is how you can create a new project and start using the ImageKit iOS SDK.

Step 1: Create iOS Application in XCode

Step 2: Get the ImageKit iOS SDK code using Cocoapods

If you don’t have Cocoapods set up in your project, run pod init.

Add ImageKitIO to Podfile.

target 'MyApp' do
  pod 'ImageKitIO', '~> 1.0.0'
end

Then, run the command.

pod install

Step 3: Get your ImageKit Public Key

In your ImageKit account dashboard, go to the developer section to find your API Keys section from the navigation bar.  Note down your public API key.

Step 4: Initialize ImageKit object in AppDelegate.swift file


import ImageKitIO
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
  ...
  _ = ImageKit.init(
          clientPublicKey: "your_public_key", 
          imageKitEndpoint: "https://ik.imagekit.io/your_imagekit_id", 
          transformationPosition: TransformationPosition.PATH, 
          authenticationEndpoint: "http://localhost:8080/auth"
  ) 
  ....
  return true 
}
...

publicKey and urlEndpoint are mandatory parameters for SDK initialization.

publicKey should be your ImageKit account's public key, which we discovered in step 3.

authenticationEndpoint is required if you want to use the SDK for client-side file uploads.  The SDK makes an HTTP GET request to this endpoint and expects a JSON response with three fields i.e. signature, token and expire. You must implement this API endpoint in your backend using ImageKit.io server-side SDKs. Learn more about this process.

Once you've configured these and the backend API to generate a signature for uploads, you can start using the SDK to fetch transformed images from or upload new files to your ImageKit account.

URL generation

There are multiple ways in which you can generate a URL for an image.

Specifying a transformation and generating an image URL

Using default urlEndpoint defined while initalizing the SDK:

// https://ik.imagekit.io/your_imagekit_id/tr:h-400,ar-3-2/default-image.jpg
let url = ImageKit.shared.url(
            path: "default-image.jpg"
        )
	.height(height: 400)
	.aspectRatio(width: 3, height: 2)
	.create()

Using custom urlEndpoint

In case you want to override the default URL endpoint provided during initilization.

// https://images.your_domain.com/tr:h-400,ar-3-2/default-image.jpg
let url = ImageKit.shared.url(
			urlEndpoint: "https://images.your_domain.com",
            path: "default-image.jpg"
        )
	.height(height: 400)
	.aspectRatio(width: 3, height: 2)
	.create()

Using src parameter

In case you already have an absolute image URL. You can use src parameter.

// https://ik.imagekit.io/your_imagekit_id/default-image.jpg?tr=h-400,ar-3-2
let url = ImageKit.shared.url(
			src: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg"
        )
	.height(height: 400)
	.aspectRatio(width: 3, height: 2)
	.create()

Transformations can be chained onto the ImagekitUrlConstructor, as following:

// https://ik.imagekit.io/your_imagekit_id/default-image.jpg?tr=h-400,ar-3-2
let imagekitUrlConstructor: ImagekitUrlConstructor = ImageKit.shared.url(
            path: "default-image.jpg",
            transformationPosition: TransformationPosition.QUERY
        )
imagekitUrlConstructor =  imagekitUrlConstructor.height(height: 400)
imagekitUrlConstructor =  imagekitUrlConstructor.aspectRatio(width: 3, height: 2)
let url = imagekitUrlConstructor.create()

You can refer to ImageKitURLConstructor.swift file in sample application provided with SDK for the list of all transforms.

You can pass any custom parameter using .addCustomTransformation("custom_param", "custom_value") function.

File uploading

The SDK enables you to upload a file directly to ImageKit Media Library.

Note: If you want to use the ImageKit SDK to upload files to Media Library, authenticationEndpoint is required.

You can pass any option supported by the upload API. Authentication related parameters are added by the SDK itself like publicKey, signature, expire, and token.

Upload file from UIImage

let image: UIImage
ImageKit.shared.uploader().upload(
  file: image,
  fileName: "sample-image.jpg",
  useUniqueFilename: true,
  tags: ["demo"],
  folder: "/path/of/destination/folder/",
  isPrivateFile: false,
  customCoordinates: "10,10,100,100",
  responseFields: "tags,isPrivateFile",
  progress: { progress in
  	// Handle Progress
  },
  completion: { result in 
  	// Handle upload response as returned from the upload API
  }
)

Upload file from Data

let data : Data
ImageKit.shared.uploader().upload(
  file: data,
  fileName: "sample-image.jpg",
  useUniqueFilename: true,
  tags: ["demo"],
  folder: "/",
  isPrivateFile: false,
  customCoordinates: "",
  responseFields: "",
  progress: { progress in
  	// Handle Progress
  },
  completion: { result in 
  	// Handle Upload Response
  }
)

Upload file from Remote URL

ImageKit.shared.uploader().upload(
  file: "https://www.example.com/sample-image.jpg",
  fileName: "sample-image.jpg",
  useUniqueFilename: true,
  tags: ["demo"],
  folder: "/",
  isPrivateFile: false,
  customCoordinates: "",
  responseFields: "",
  progress: { progress in
  	// Handle Progress
  },
  completion: { result in 
  	// Handle Upload Response
  }
)

Conclusion

The ImageKit iOS SDK solves the challenges that iOS developers face related to file upload and quick loading. Transformations enable you to deliver high-quality images in different sizes for different devices as per the layout.

If you have any questions, create an issue on the Github repo or contact us at support@imagekit.io.