Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
- name: Build Example Project
run: |
cd Example
xcodebuild -workspace ImageKit.xcworkspace -scheme ImageKit-Example -destination 'platform=iOS Simulator,name=iPhone 15' clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
xcodebuild -workspace ImageKit.xcworkspace -scheme ImageKit-Example -destination 'platform=iOS Simulator,name=iPhone 17' clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

- name: Run Tests
run: |
cd Example
xcodebuild -workspace ImageKit.xcworkspace -scheme ImageKit-Example -destination 'platform=iOS Simulator,name=iPhone 15' -enableCodeCoverage YES clean test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
xcodebuild -workspace ImageKit.xcworkspace -scheme ImageKit-Example -destination 'platform=iOS Simulator,name=iPhone 17' -enableCodeCoverage YES clean test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

- name: Upload Coverage to codecov
run: bash <(curl -s https://codecov.io/bash) -J '^ImageKitIO$' -X coveragepy
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ Carthage/Build
Pods/*
Example/Pods/*
Server/node_modules
Server/*.lock
Server/*.lock

#Swift package build outputs
.swiftpm
.build/
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions Example/ImageKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = FY66VYM646;
LastSwiftMigration = 0900;
};
};
Expand Down Expand Up @@ -385,11 +386,12 @@
baseConfigurationReference = 7661EF116E06444B352B18F0 /* Pods-ImageKit_Example.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = FY66VYM646;
INFOPLIST_FILE = ImageKit/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.--PRODUCT-NAME-";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
Expand All @@ -401,11 +403,12 @@
baseConfigurationReference = BFEF935EF71672E4888B2B32 /* Pods-ImageKit_Example.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = FY66VYM646;
INFOPLIST_FILE = ImageKit/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.--PRODUCT-NAME-";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
Expand Down
2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
installer.pods_project.targets.each do |target|
Expand Down
10 changes: 5 additions & 5 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- ImageKitIO (3.0.0)
- ImageKitIO/Tests (3.0.0):
- ImageKitIO (3.1.0)
- ImageKitIO/Tests (3.1.0):
- Mocker (~> 2.5)
- Nimble (~> 10.0.0)
- Quick (~> 5.0.1)
Expand All @@ -23,11 +23,11 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
ImageKitIO: 804da6f03a903c4f540d6a3c0dd8ee87e9f29040
ImageKitIO: 9cb4bb64a800a248f0f60ed5070458bd3e6ac61a
Mocker: 8c731a8104962f246cadf2b02556218e9edc1390
Nimble: 5316ef81a170ce87baf72dd961f22f89a602ff84
Quick: 749aa754fd1e7d984f2000fe051e18a3a9809179

PODFILE CHECKSUM: 406170311ac5dd5482330203b884d5db8ef323c7
PODFILE CHECKSUM: 8224e8c767b2e111bf4f338e9aaa55d7cd447b9e

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
11 changes: 7 additions & 4 deletions ImageKitIO.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'ImageKitIO'
s.version = '3.0.0'
s.version = '3.1.0'
s.summary = 'iOS SDK for ImageKit.io'


Expand All @@ -14,13 +14,16 @@ ImageKit is a complete image optimization and transformation solution that comes
s.author = { 'ImageKit Developer' => '[email protected]', 'ahnv' => '[email protected]' }
s.source = { :git => 'https://github.com/imagekit-developer/imagekit-ios.git', :tag => s.version.to_s }

s.swift_version = '4.0'
s.ios.deployment_target = '12.0'
s.swift_version = '6.0'
s.ios.deployment_target = '13.0'

s.source_files = 'ImageKit/**/*'
s.source_files = 'Sources/ImageKit/**/*'

s.test_spec 'Tests' do |test_spec|
test_spec.source_files = 'Tests/**/*'
test_spec.resource_bundles = {
"ImageKitIO_ImageKitIO-Tests" => ["Tests/fixtures/**"]
}
test_spec.dependency 'Quick', '~> 5.0.1'
test_spec.dependency 'Nimble', '~> 10.0.0'
test_spec.dependency 'Mocker', '~> 2.5'
Expand Down
60 changes: 60 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// swift-tools-version: 6.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "ImageKitIO",
platforms: [.iOS(.v13)],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "ImageKitIO",
targets: ["ImageKitIO"]),
],
dependencies: [
.package(url: "https://github.com/Quick/Quick.git", from: "5.0.1"),
.package(url: "https://github.com/Quick/Nimble.git", from: "10.0.0"),
.package(url: "https://github.com/WeTransfer/Mocker.git", from: "2.5.0"),
.package(url: "https://github.com/httpswift/swifter.git", from: "1.5.0")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "ImageKitIO",
path: "Sources",
),
.testTarget(
name: "ImageKitIO-Tests",
dependencies: ["ImageKitIO", "Quick", "Nimble", "Mocker", .product(name: "Swifter", package: "swifter")],
path: "Tests",
resources: [.process("fixtures")]
),
]
)
53 changes: 51 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,58 @@ ImageKit iOS Pod allows you to use real-time [image resizing](https://docs.image
## Installation

### Requirements
The library requires Swift 4.0 or above.
The library requires Swift 6.0 and minimum iOS version for deployment be 13.0 or above.

#### CocoaPods
### Swift Package Manager

You can integrate ImageKit into your iOS project using the Swift Package Manager (SPM).

After completing the Swift Package setup in your project, you can add ImageKit in one of the following ways:

#### Using Xcode

Open your project in Xcode, then go to File → Add Packages…

```
https://github.com/imagekit-developer/imagekit-ios.git
```

Select the Up to Next Major version rule, starting from version 3.1.0, and add the package to your app target’s Package Dependencies list.

#### Using `Package.swift`

If you prefer managing dependencies manually, add ImageKit to the dependencies array in your `Package.swift` file:

```swift
// swift-tools-version: 6.0
import PackageDescription

let package = Package(
name: "Example",
platforms: [
.iOS(.v13)
],
dependencies: [
.package(url: "https://github.com/imagekit-developer/imagekit-ios.git", .upToNextMajor(from: "3.1.0"))
],
targets: [
.target(
name: "Example",
dependencies: [
"ImageKitIO"
]
)
]
)
```

Once added, you can import ImageKitIO into your Swift files:

```
import ImageKitIO
```

### CocoaPods

You can use CocoaPods to install ImageKit by adding it to your Podfile:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public enum IKError: Error {
case serverSideError(Int)
}

public enum MultipartEncodingFailureReason {
public enum MultipartEncodingFailureReason : Sendable {
case inputStreamReadFailed(error: Error)
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

public class UploadPolicy {
public final class UploadPolicy : Sendable {
private static let DEFAULT_MAX_ERROR_RETRIES = 5
private static let DEFAULT_BACKOFF_MILLIS = 1000
private static let DEFAULT_BACKOFF_POLICY = BackoffPolicy.LINEAR
Expand All @@ -26,12 +26,12 @@ public class UploadPolicy {
self.backoffPolicy = backoffPolicy
}

public enum NetworkType {
public enum NetworkType : Sendable {
case ANY
case UNMETERED
}

public enum BackoffPolicy {
public enum BackoffPolicy : Sendable {
case LINEAR
case EXPONENTIAL
}
Expand Down
9 changes: 6 additions & 3 deletions ImageKit/ImageKit.swift → Sources/ImageKit/ImageKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
//

import Foundation
public var TESTING: Bool = true

public struct UserDefaultKeys {
public static let KEY_CLIENT_PUBLIC_KEY = "IKClientKey"
public static let KEY_IMAGEKIT_URL_ENDPOINT = "IKURLEndpoint"
public static let KEY_IMAGEKIT_TRANSFORMATION_POSITION = "IKTransformationPosition"
}

open class ImageKit: NSObject {
open class ImageKit: NSObject, @unchecked Sendable {

open fileprivate(set) var clientPublicKey: String! = ""
open fileprivate(set) var imageKitEndpoint: String! = ""
Expand All @@ -26,7 +25,8 @@ open class ImageKit: NSObject {

public static let shared = ImageKit()

private let sharedUploader = ImageKitUploader()
@MainActor
private lazy var sharedUploader = ImageKitUploader()

public override init() {

Expand All @@ -43,11 +43,13 @@ open class ImageKit: NSObject {
}

@available(*, deprecated, message: "clientPublicKey Renamed to publicKey")
@MainActor
public convenience init(clientPublicKey: String = "", imageKitEndpoint: String, transformationPosition: TransformationPosition = TransformationPosition.PATH) {
self.init(publicKey: clientPublicKey, imageKitEndpoint: imageKitEndpoint, transformationPosition: transformationPosition)
}

@available(*, deprecated, message: "imageKitEndpoint Renamed to urlEndpoint")
@MainActor
public convenience init(publicKey: String = "", imageKitEndpoint: String, transformationPosition: TransformationPosition = TransformationPosition.PATH) {
self.init(publicKey: publicKey, urlEndpoint: imageKitEndpoint, transformationPosition: transformationPosition)
}
Expand Down Expand Up @@ -80,6 +82,7 @@ open class ImageKit: NSObject {
return ImagekitUrlConstructor(src: src, transformationPosition: transformationPosition)
}

@MainActor
public func uploader() -> ImageKitUploader {
return sharedUploader
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Created by Abhinav Dhiman on 16/07/20.
//
import Foundation
import UIKit

public class ImagekitUrlConstructor {

Expand Down Expand Up @@ -528,6 +529,7 @@ public class ImagekitUrlConstructor {
* @param focus Possible values include the values defined in enum FocusType.
* @return the current ImagekitUrlConstructor object.
*/
@MainActor
public func setResponsive(
view: UIView,
minSize: Int = 0,
Expand Down
Loading