diff --git a/Kingfisher.xcodeproj/project.pbxproj b/Kingfisher.xcodeproj/project.pbxproj index b358eed4c..2d7064195 100644 --- a/Kingfisher.xcodeproj/project.pbxproj +++ b/Kingfisher.xcodeproj/project.pbxproj @@ -29,9 +29,6 @@ 4B77423F1D87E08A0077024E /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B77423E1D87E08A0077024E /* Indicator.swift */; }; 4B7742401D87E08A0077024E /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B77423E1D87E08A0077024E /* Indicator.swift */; }; 4B7742411D87E08A0077024E /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B77423E1D87E08A0077024E /* Indicator.swift */; }; - 4B7742431D87E2AA0077024E /* Box.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7742421D87E2AA0077024E /* Box.swift */; }; - 4B7742441D87E2AA0077024E /* Box.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7742421D87E2AA0077024E /* Box.swift */; }; - 4B7742451D87E2AA0077024E /* Box.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7742421D87E2AA0077024E /* Box.swift */; }; 4B7742471D87E42E0077024E /* loader.gif in Resources */ = {isa = PBXBuildFile; fileRef = 4B7742461D87E42E0077024E /* loader.gif */; }; 4B7742481D87E42E0077024E /* loader.gif in Resources */ = {isa = PBXBuildFile; fileRef = 4B7742461D87E42E0077024E /* loader.gif */; }; 4B98674F1CD1CF42003ADAC7 /* AnimatedImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B98674E1CD1CF42003ADAC7 /* AnimatedImageView.swift */; }; @@ -495,7 +492,6 @@ 4B3E714D1B01FEB200F5AAED /* WatchKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WatchKit.framework; path = System/Library/Frameworks/WatchKit.framework; sourceTree = SDKROOT; }; 4B6313F31D766BEF0078E017 /* Filter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Filter.swift; path = Sources/Filter.swift; sourceTree = ""; }; 4B77423E1D87E08A0077024E /* Indicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Indicator.swift; path = Sources/Indicator.swift; sourceTree = ""; }; - 4B7742421D87E2AA0077024E /* Box.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Box.swift; path = Sources/Box.swift; sourceTree = ""; }; 4B7742461D87E42E0077024E /* loader.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = loader.gif; sourceTree = ""; }; 4B98674E1CD1CF42003ADAC7 /* AnimatedImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AnimatedImageView.swift; path = Sources/AnimatedImageView.swift; sourceTree = ""; }; 4BA697401EC2F06000AA7935 /* kingfisher-round-corner-40-corner-3-mac.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "kingfisher-round-corner-40-corner-3-mac.jpg"; sourceTree = ""; }; @@ -1055,7 +1051,6 @@ 4BF39F3F1D796BDD0035ECC8 /* Helpers */ = { isa = PBXGroup; children = ( - 4B7742421D87E2AA0077024E /* Box.swift */, D10945F41C526B6C001408EB /* String+MD5.swift */, D10945F51C526B6C001408EB /* ThreadHelper.swift */, ); @@ -2225,7 +2220,6 @@ 4B7742411D87E08A0077024E /* Indicator.swift in Sources */, D109461E1C526C61001408EB /* ImageView+Kingfisher.swift in Sources */, D109461F1C526C61001408EB /* KingfisherManager.swift in Sources */, - 4B7742451D87E2AA0077024E /* Box.swift in Sources */, 4B6313F61D766BEF0078E017 /* Filter.swift in Sources */, FB402D101EDEAB7E002B62A1 /* FormatIndicatedCacheSerializer.swift in Sources */, 182FFF781CC9ACBA004B728D /* NSButton+Kingfisher.swift in Sources */, @@ -2303,7 +2297,6 @@ files = ( D109460E1C526C0D001408EB /* Image.swift in Sources */, 4BFBEE7E1D7D0C3600699FD3 /* RequestModifier.swift in Sources */, - 4B7742441D87E2AA0077024E /* Box.swift in Sources */, 4B6313F51D766BEF0078E017 /* Filter.swift in Sources */, 4B9867501CD1CF42003ADAC7 /* AnimatedImageView.swift in Sources */, 4BD8E04D1D9237E200A091BE /* Kingfisher.swift in Sources */, @@ -2375,7 +2368,6 @@ files = ( D10945F71C526B86001408EB /* Image.swift in Sources */, 4BFBEE7D1D7D0C3600699FD3 /* RequestModifier.swift in Sources */, - 4B7742431D87E2AA0077024E /* Box.swift in Sources */, 4B6313F41D766BEF0078E017 /* Filter.swift in Sources */, 4B98674F1CD1CF42003ADAC7 /* AnimatedImageView.swift in Sources */, 4BD8E04C1D9237E200A091BE /* Kingfisher.swift in Sources */, diff --git a/Sources/Box.swift b/Sources/Box.swift deleted file mode 100644 index 5bdf7c2d1..000000000 --- a/Sources/Box.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// Box.swift -// Kingfisher -// -// Created by WANG WEI on 2016/09/12. -// Copyright © 2016年 Wei Wang. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -import Foundation - -class Box { - let value: T - init(value: T) { - self.value = value - } -} diff --git a/Sources/ImageView+Kingfisher.swift b/Sources/ImageView+Kingfisher.swift index b39bfae20..0106151de 100755 --- a/Sources/ImageView+Kingfisher.swift +++ b/Sources/ImageView+Kingfisher.swift @@ -173,7 +173,7 @@ extension Kingfisher where Base: ImageView { /// Default is .none, means no indicator will be shown. public var indicatorType: IndicatorType { get { - let indicator = (objc_getAssociatedObject(base, &indicatorTypeKey) as? Box)?.value + let indicator = objc_getAssociatedObject(base, &indicatorTypeKey) as? IndicatorType return indicator ?? .none } @@ -189,7 +189,7 @@ extension Kingfisher where Base: ImageView { indicator = anIndicator } - objc_setAssociatedObject(base, &indicatorTypeKey, Box(value: newValue), .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + objc_setAssociatedObject(base, &indicatorTypeKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) } } @@ -198,7 +198,7 @@ extension Kingfisher where Base: ImageView { /// It will be `nil` if `indicatorType` is `.none`. public fileprivate(set) var indicator: Indicator? { get { - return (objc_getAssociatedObject(base, &indicatorKey) as? Box)?.value + return objc_getAssociatedObject(base, &indicatorKey) as? Indicator } set { @@ -219,7 +219,7 @@ extension Kingfisher where Base: ImageView { } // Save in associated object - objc_setAssociatedObject(base, &indicatorKey, Box(value: newValue), .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + objc_setAssociatedObject(base, &indicatorKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) } } @@ -233,7 +233,7 @@ extension Kingfisher where Base: ImageView { public fileprivate(set) var placeholder: Placeholder? { get { - return (objc_getAssociatedObject(base, &placeholderKey) as? Box)?.value + return objc_getAssociatedObject(base, &placeholderKey) as? Placeholder } set { @@ -247,7 +247,7 @@ extension Kingfisher where Base: ImageView { base.image = nil } - objc_setAssociatedObject(base, &placeholderKey, Box(value: newValue), .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + objc_setAssociatedObject(base, &placeholderKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) } } }