Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
15 changes: 9 additions & 6 deletions Demo/NukeDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 1000;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
Expand All @@ -201,7 +201,7 @@
};
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "NukeDemo" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -263,7 +263,7 @@
inputFileListPaths = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-NukeDemo/Pods-NukeDemo-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-NukeDemo/Pods-NukeDemo-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
"${BUILT_PRODUCTS_DIR}/DFCache/DFCache.framework",
"${BUILT_PRODUCTS_DIR}/FLAnimatedImage/FLAnimatedImage.framework",
Expand All @@ -282,7 +282,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-NukeDemo/Pods-NukeDemo-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NukeDemo/Pods-NukeDemo-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -335,6 +335,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -390,6 +391,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -429,6 +431,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -449,7 +452,7 @@
PRODUCT_NAME = NukeDemo_Example;
SWIFT_OBJC_BRIDGING_HEADER = "Sources/NukeDemo-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -469,7 +472,7 @@
PRODUCT_NAME = NukeDemo_Example;
SWIFT_OBJC_BRIDGING_HEADER = "Sources/NukeDemo-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
9 changes: 6 additions & 3 deletions Nuke.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 1000;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Alexander Grebenyuk";
TargetAttributes = {
0C22D9C41BCA9734006E1D3B = {
Expand Down Expand Up @@ -851,6 +851,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -1461,6 +1462,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -1507,7 +1509,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -1518,6 +1520,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -1557,7 +1560,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
2 changes: 1 addition & 1 deletion Nuke.xcodeproj/xcshareddata/xcschemes/Nuke iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Nuke.xcodeproj/xcshareddata/xcschemes/Nuke macOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Nuke.xcodeproj/xcshareddata/xcschemes/Nuke tvOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Sources/ImageCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public protocol ImageCaching: class {
/// Convenience subscript.
public extension ImageCaching {
/// Accesses the image associated with the given request.
public subscript(request: ImageRequest) -> Image? {
subscript(request: ImageRequest) -> Image? {
get {
return cachedResponse(for: request)?.image
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/ImagePipeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ public /* final */ class ImageTask: Hashable {

// MARK: - Hashable

public func hash(into hasher: inout Hasher) {
hasher.combine(ObjectIdentifier(self).hashValue)
}

public static func == (lhs: ImageTask, rhs: ImageTask) -> Bool {
return ObjectIdentifier(lhs) == ObjectIdentifier(rhs)
}

public var hashValue: Int {
return ObjectIdentifier(self).hashValue
}
}

protocol ImageTaskDelegate: class {
Expand Down
24 changes: 12 additions & 12 deletions Sources/ImageRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public struct ImageRequest {
public extension ImageRequest {
/// Appends a processor to the request. You can append arbitrary number of
/// processors to the request.
public mutating func process<P: ImageProcessing>(with processor: P) {
mutating func process<P: ImageProcessing>(with processor: P) {
guard let existing = self.processor else {
self.processor = AnyImageProcessor(processor)
return
Expand All @@ -264,34 +264,34 @@ public extension ImageRequest {

/// Appends a processor to the request. You can append arbitrary number of
/// processors to the request.
public func processed<P: ImageProcessing>(with processor: P) -> ImageRequest {
func processed<P: ImageProcessing>(with processor: P) -> ImageRequest {
var request = self
request.process(with: processor)
return request
}

/// Appends a processor to the request. You can append arbitrary number of
/// processors to the request.
public mutating func process<Key: Hashable>(key: Key, _ closure: @escaping (Image) -> Image?) {
mutating func process<Key: Hashable>(key: Key, _ closure: @escaping (Image) -> Image?) {
process(with: AnonymousImageProcessor<Key>(key, closure))
}

/// Appends a processor to the request. You can append arbitrary number of
/// processors to the request.
public func processed<Key: Hashable>(key: Key, _ closure: @escaping (Image) -> Image?) -> ImageRequest {
func processed<Key: Hashable>(key: Key, _ closure: @escaping (Image) -> Image?) -> ImageRequest {
return processed(with: AnonymousImageProcessor<Key>(key, closure))
}
}

internal extension ImageRequest {
struct CacheKey: Hashable {
let request: ImageRequest

var hashValue: Int {
func hash(into hasher: inout Hasher) {
if let customKey = request._ref.cacheKey {
return customKey.hashValue
hasher.combine(customKey)
Comment thread
kean marked this conversation as resolved.
}
return request._ref._urlString?.hashValue ?? 0
hasher.combine(request._ref._urlString?.hashValue ?? 0)
}

static func == (lhs: CacheKey, rhs: CacheKey) -> Bool {
Expand All @@ -309,12 +309,12 @@ internal extension ImageRequest {

struct LoadKey: Hashable {
let request: ImageRequest

var hashValue: Int {
func hash(into hasher: inout Hasher) {
if let customKey = request._ref.loadKey {
return customKey.hashValue
hasher.combine(customKey)
}
return request._ref._urlString?.hashValue ?? 0
hasher.combine(request._ref._urlString?.hashValue ?? 0)
}

static func == (lhs: LoadKey, rhs: LoadKey) -> Bool {
Expand Down
13 changes: 7 additions & 6 deletions Sources/Internal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -558,13 +558,14 @@ extension String {
/// // prints "50334ee0b51600df6397ce93ceed4728c37fee4e"
/// ```
var sha1: String? {
guard let input = self.data(using: .utf8) else {
return nil
}
var hash = [UInt8](repeating: 0, count: Int(CC_SHA1_DIGEST_LENGTH))
input.withUnsafeBytes {
_ = CC_SHA1($0, CC_LONG(input.count), &hash)
guard let input = self.data(using: .utf8) else { return nil }

let hash = input.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) -> [UInt8] in
Comment thread
kean marked this conversation as resolved.
var hash = [UInt8](repeating: 0, count: Int(CC_SHA1_DIGEST_LENGTH))
CC_SHA1(bytes.baseAddress, CC_LONG(input.count), &hash)
return hash
}

return hash.map({ String(format: "%02x", $0) }).joined()
}
}
Expand Down