From 9807b08f3eae54c1369dd16aaeb4e23d24a6a86c Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Sat, 4 Jan 2014 00:03:20 -0600 Subject: [PATCH 01/13] Minor work, bumping build number --- TypeExtensions.xcodeproj/project.pbxproj | 6 ++++-- TypeExtensions/TypeExtensions-Info.plist | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/TypeExtensions.xcodeproj/project.pbxproj b/TypeExtensions.xcodeproj/project.pbxproj index f266a91..c3e1899 100644 --- a/TypeExtensions.xcodeproj/project.pbxproj +++ b/TypeExtensions.xcodeproj/project.pbxproj @@ -560,7 +560,7 @@ 420D1A97165BF5020097EE03 /* Sources */, 420D1A98165BF5020097EE03 /* Frameworks */, 420D1A99165BF5020097EE03 /* Headers */, - 42352D481877C9A20011CA48 /* ShellScript */, + 42352D481877C9A20011CA48 /* Update Build Number */, 420D1A9A165BF5020097EE03 /* Resources */, ); buildRules = ( @@ -625,18 +625,20 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 42352D481877C9A20011CA48 /* ShellScript */ = { + 42352D481877C9A20011CA48 /* Update Build Number */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); + name = "Update Build Number"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\""; + showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/TypeExtensions/TypeExtensions-Info.plist b/TypeExtensions/TypeExtensions-Info.plist index c527d3f..409a09b 100644 --- a/TypeExtensions/TypeExtensions-Info.plist +++ b/TypeExtensions/TypeExtensions-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 100 + 108 NSHumanReadableCopyright Copyright © 2012 Lens Flare. Some rights reserved, see license. NSPrincipalClass From 99c1dc7389c1f9b86d2de00110f97966392802f1 Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Sat, 4 Jan 2014 00:05:17 -0600 Subject: [PATCH 02/13] Revert "Cleaning experimental work out of master" This reverts commit 0da7631fbc40903fcb46753293af10e77956bfcb. Conflicts: TypeExtensions/Other Extensions/Misc.h --- TypeExtensions.xcodeproj/project.pbxproj | 52 +++++ .../Collection Extensions/Collection.h | 8 +- ...rrayMutable_NonRetaining_Zeroing+Private.h | 22 ++ .../Collection Extensions/TXBTree.h | 24 +++ .../Collection Extensions/TXBTree.m | 77 +++++++ .../TXBijectiveDictionary.h | 13 ++ .../TXBijectiveDictionary.m | 13 ++ .../TXMutableWeakArray.h | 15 ++ .../TXMutableWeakArray.m | 97 +++++++++ .../TXMutableWeakDictionary.h | 13 ++ .../TXMutableWeakDictionary.m | 150 ++++++++++++++ TypeExtensions/Other Extensions/Misc.h | 2 + .../NSObject+DeallocListener.h | 29 +++ .../NSObject+DeallocListener.m | 195 ++++++++++++++++++ 14 files changed, 709 insertions(+), 1 deletion(-) create mode 100644 TypeExtensions/Collection Extensions/NSArrayMutable_NonRetaining_Zeroing+Private.h create mode 100644 TypeExtensions/Collection Extensions/TXBTree.h create mode 100644 TypeExtensions/Collection Extensions/TXBTree.m create mode 100644 TypeExtensions/Collection Extensions/TXBijectiveDictionary.h create mode 100644 TypeExtensions/Collection Extensions/TXBijectiveDictionary.m create mode 100644 TypeExtensions/Collection Extensions/TXMutableWeakArray.h create mode 100644 TypeExtensions/Collection Extensions/TXMutableWeakArray.m create mode 100644 TypeExtensions/Collection Extensions/TXMutableWeakDictionary.h create mode 100644 TypeExtensions/Collection Extensions/TXMutableWeakDictionary.m create mode 100644 TypeExtensions/Other Extensions/NSObject+DeallocListener.h create mode 100644 TypeExtensions/Other Extensions/NSObject+DeallocListener.m diff --git a/TypeExtensions.xcodeproj/project.pbxproj b/TypeExtensions.xcodeproj/project.pbxproj index c3e1899..92afc27 100644 --- a/TypeExtensions.xcodeproj/project.pbxproj +++ b/TypeExtensions.xcodeproj/project.pbxproj @@ -23,6 +23,10 @@ 4202873416CC241600F2C92A /* NSString+dateValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4202873216CC241600F2C92A /* NSString+dateValue.m */; }; 4202873716CC245E00F2C92A /* NSDate+stringValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4202873516CC245E00F2C92A /* NSDate+stringValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4202873816CC245E00F2C92A /* NSDate+stringValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4202873616CC245E00F2C92A /* NSDate+stringValue.m */; }; + 4205F9FA1851329100051E68 /* TXBTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 4205F9F81851329100051E68 /* TXBTree.h */; }; + 4205F9FB1851329100051E68 /* TXBTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 4205F9F91851329100051E68 /* TXBTree.m */; }; + 420952B0185054CF006E904A /* TXBijectiveDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 420952AE185054CF006E904A /* TXBijectiveDictionary.h */; }; + 420952B1185054CF006E904A /* TXBijectiveDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 420952AF185054CF006E904A /* TXBijectiveDictionary.m */; }; 420D1AA0165BF5020097EE03 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 420D1A9F165BF5020097EE03 /* Cocoa.framework */; }; 420D1AAA165BF5020097EE03 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 420D1AA8165BF5020097EE03 /* InfoPlist.strings */; }; 420D1AC6165BF54D0097EE03 /* NSArray+orNull.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AB5165BF54D0097EE03 /* NSArray+orNull.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -43,6 +47,7 @@ 420D1AD5165BF54D0097EE03 /* NSString+plistValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AC5165BF54D0097EE03 /* NSString+plistValue.m */; }; 42352D3518765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42352D3618765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */; }; + 42352D471877C58A0011CA48 /* NSArrayMutable_NonRetaining_Zeroing+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D461877C58A0011CA48 /* NSArrayMutable_NonRetaining_Zeroing+Private.h */; }; 42719C5317C935A6007AAB83 /* Design.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C5117C9343C007AAB83 /* Design.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42719C5417C935A9007AAB83 /* Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C5017C933F8007AAB83 /* Protocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42719C5517C935AB007AAB83 /* String.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C4F17C933AC007AAB83 /* String.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -51,6 +56,10 @@ 42719C6517C9386A007AAB83 /* Collection.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C6417C9386A007AAB83 /* Collection.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42719C6C17C93B66007AAB83 /* NSString+random.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C6A17C93B66007AAB83 /* NSString+random.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42719C6D17C93B66007AAB83 /* NSString+random.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C6B17C93B66007AAB83 /* NSString+random.m */; }; + 42719C7017C9450A007AAB83 /* TXMutableWeakArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C6E17C9450A007AAB83 /* TXMutableWeakArray.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 42719C7117C9450A007AAB83 /* TXMutableWeakArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C6F17C9450A007AAB83 /* TXMutableWeakArray.m */; }; + 42719C7917C94F2A007AAB83 /* TXMutableWeakDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C7717C94F2A007AAB83 /* TXMutableWeakDictionary.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 42719C7A17C94F2A007AAB83 /* TXMutableWeakDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C7817C94F2A007AAB83 /* TXMutableWeakDictionary.m */; }; 427307F017C932F50045A398 /* NSObject+abstractClass.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307DA17C932F50045A398 /* NSObject+abstractClass.h */; settings = {ATTRIBUTES = (Public, ); }; }; 427307F117C932F50045A398 /* NSObject+abstractClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DB17C932F50045A398 /* NSObject+abstractClass.m */; }; 427307F217C932F50045A398 /* NSObject+abstractProtocolConformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307DC17C932F50045A398 /* NSObject+abstractProtocolConformer.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -74,6 +83,8 @@ 42877CAF183DAC4100967368 /* Misc.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA4183DAC4100967368 /* Misc.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42877CB0183DAC4100967368 /* NSObject+associatedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA5183DAC4100967368 /* NSObject+associatedObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42877CB1183DAC4100967368 /* NSObject+associatedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CA6183DAC4100967368 /* NSObject+associatedObject.m */; }; + 42877CB2183DAC4100967368 /* NSObject+DeallocListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA7183DAC4100967368 /* NSObject+DeallocListener.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 42877CB3183DAC4100967368 /* NSObject+DeallocListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CA8183DAC4100967368 /* NSObject+DeallocListener.m */; }; 42877CB4183DAC4100967368 /* NSObject+invocationForSelector.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA9183DAC4100967368 /* NSObject+invocationForSelector.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42877CB5183DAC4100967368 /* NSObject+invocationForSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */; }; 42877CBA183DB08900967368 /* NSObject+invokeSafely.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -117,6 +128,10 @@ 4202873216CC241600F2C92A /* NSString+dateValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+dateValue.m"; sourceTree = ""; }; 4202873516CC245E00F2C92A /* NSDate+stringValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+stringValue.h"; sourceTree = ""; }; 4202873616CC245E00F2C92A /* NSDate+stringValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+stringValue.m"; sourceTree = ""; }; + 4205F9F81851329100051E68 /* TXBTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXBTree.h; sourceTree = ""; }; + 4205F9F91851329100051E68 /* TXBTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXBTree.m; sourceTree = ""; }; + 420952AE185054CF006E904A /* TXBijectiveDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXBijectiveDictionary.h; sourceTree = ""; }; + 420952AF185054CF006E904A /* TXBijectiveDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXBijectiveDictionary.m; sourceTree = ""; }; 420D1A9C165BF5020097EE03 /* TypeExtensions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TypeExtensions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 420D1A9F165BF5020097EE03 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 420D1AA2165BF5020097EE03 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; @@ -144,6 +159,7 @@ 420D1AC5165BF54D0097EE03 /* NSString+plistValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+plistValue.m"; sourceTree = ""; }; 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMapTable+objectForKeyedSubscript.h"; sourceTree = ""; }; 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMapTable+objectForKeyedSubscript.m"; sourceTree = ""; }; + 42352D461877C58A0011CA48 /* NSArrayMutable_NonRetaining_Zeroing+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArrayMutable_NonRetaining_Zeroing+Private.h"; sourceTree = ""; }; 42719C4F17C933AC007AAB83 /* String.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = String.h; sourceTree = ""; }; 42719C5017C933F8007AAB83 /* Protocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Protocol.h; sourceTree = ""; }; 42719C5117C9343C007AAB83 /* Design.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Design.h; sourceTree = ""; }; @@ -152,6 +168,10 @@ 42719C6417C9386A007AAB83 /* Collection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Collection.h; sourceTree = ""; }; 42719C6A17C93B66007AAB83 /* NSString+random.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+random.h"; sourceTree = ""; }; 42719C6B17C93B66007AAB83 /* NSString+random.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+random.m"; sourceTree = ""; }; + 42719C6E17C9450A007AAB83 /* TXMutableWeakArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXMutableWeakArray.h; sourceTree = ""; }; + 42719C6F17C9450A007AAB83 /* TXMutableWeakArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXMutableWeakArray.m; sourceTree = ""; }; + 42719C7717C94F2A007AAB83 /* TXMutableWeakDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXMutableWeakDictionary.h; sourceTree = ""; }; + 42719C7817C94F2A007AAB83 /* TXMutableWeakDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXMutableWeakDictionary.m; sourceTree = ""; }; 427307DA17C932F50045A398 /* NSObject+abstractClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+abstractClass.h"; sourceTree = ""; }; 427307DB17C932F50045A398 /* NSObject+abstractClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+abstractClass.m"; sourceTree = ""; }; 427307DC17C932F50045A398 /* NSObject+abstractProtocolConformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+abstractProtocolConformer.h"; sourceTree = ""; }; @@ -175,6 +195,8 @@ 42877CA4183DAC4100967368 /* Misc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Misc.h; sourceTree = ""; }; 42877CA5183DAC4100967368 /* NSObject+associatedObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+associatedObject.h"; sourceTree = ""; }; 42877CA6183DAC4100967368 /* NSObject+associatedObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+associatedObject.m"; sourceTree = ""; }; + 42877CA7183DAC4100967368 /* NSObject+DeallocListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+DeallocListener.h"; sourceTree = ""; }; + 42877CA8183DAC4100967368 /* NSObject+DeallocListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+DeallocListener.m"; sourceTree = ""; }; 42877CA9183DAC4100967368 /* NSObject+invocationForSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+invocationForSelector.h"; sourceTree = ""; }; 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+invocationForSelector.m"; sourceTree = ""; }; 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+invokeSafely.h"; sourceTree = ""; }; @@ -359,11 +381,24 @@ 42719C5B17C93855007AAB83 /* Collection Extensions */ = { isa = PBXGroup; children = ( + 42352D461877C58A0011CA48 /* NSArrayMutable_NonRetaining_Zeroing+Private.h */, 42719C6417C9386A007AAB83 /* Collection.h */, 42719C5C17C93855007AAB83 /* NSDictionary+entrySet.h */, 42719C5D17C93855007AAB83 /* NSDictionary+entrySet.m */, + 42719C6E17C9450A007AAB83 /* TXMutableWeakArray.h */, + 42719C6F17C9450A007AAB83 /* TXMutableWeakArray.m */, + 42719C7717C94F2A007AAB83 /* TXMutableWeakDictionary.h */, + 42719C7817C94F2A007AAB83 /* TXMutableWeakDictionary.m */, 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */, 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */, + 42719C6E17C9450A007AAB83 /* TXMutableWeakArray.h */, + 42719C6F17C9450A007AAB83 /* TXMutableWeakArray.m */, + 42719C7717C94F2A007AAB83 /* TXMutableWeakDictionary.h */, + 42719C7817C94F2A007AAB83 /* TXMutableWeakDictionary.m */, + 420952AE185054CF006E904A /* TXBijectiveDictionary.h */, + 420952AF185054CF006E904A /* TXBijectiveDictionary.m */, + 4205F9F81851329100051E68 /* TXBTree.h */, + 4205F9F91851329100051E68 /* TXBTree.m */, ); path = "Collection Extensions"; sourceTree = ""; @@ -450,6 +485,8 @@ 42877CA4183DAC4100967368 /* Misc.h */, 42877CA5183DAC4100967368 /* NSObject+associatedObject.h */, 42877CA6183DAC4100967368 /* NSObject+associatedObject.m */, + 42877CA7183DAC4100967368 /* NSObject+DeallocListener.h */, + 42877CA8183DAC4100967368 /* NSObject+DeallocListener.m */, 42877CA9183DAC4100967368 /* NSObject+invocationForSelector.h */, 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */, 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */, @@ -490,6 +527,11 @@ 42AC0B1B165CA111002E846E /* TypeExtensions.h in Headers */, 42719C6517C9386A007AAB83 /* Collection.h in Headers */, 42719C6017C93855007AAB83 /* NSDictionary+entrySet.h in Headers */, + 42719C7017C9450A007AAB83 /* TXMutableWeakArray.h in Headers */, + 42719C7917C94F2A007AAB83 /* TXMutableWeakDictionary.h in Headers */, + 42719C7017C9450A007AAB83 /* TXMutableWeakArray.h in Headers */, + 4205F9FA1851329100051E68 /* TXBTree.h in Headers */, + 42719C7917C94F2A007AAB83 /* TXMutableWeakDictionary.h in Headers */, 42719C5317C935A6007AAB83 /* Design.h in Headers */, 427307F017C932F50045A398 /* NSObject+abstractClass.h in Headers */, 427307F217C932F50045A398 /* NSObject+abstractProtocolConformer.h in Headers */, @@ -507,6 +549,7 @@ 428D034118482D9500303ED4 /* Notification.h in Headers */, 428D034218482D9500303ED4 /* NSNotificationCenter+errorCenter.h in Headers */, 42AC0B19165CA0B2002E846E /* Null.h in Headers */, + 42352D471877C58A0011CA48 /* NSArrayMutable_NonRetaining_Zeroing+Private.h in Headers */, 420D1AC8165BF54D0097EE03 /* NSObject+isNull.h in Headers */, 420D1ACA165BF54D0097EE03 /* NSString+isEmpty.h in Headers */, 420D1AC6165BF54D0097EE03 /* NSArray+orNull.h in Headers */, @@ -521,11 +564,13 @@ 420D1ACE165BF54D0097EE03 /* NSString+dataValue.h in Headers */, 42DFF307165DFBE6003F26DA /* NSData+stringValue.h in Headers */, 420D1AD4165BF54D0097EE03 /* NSString+plistValue.h in Headers */, + 420952B0185054CF006E904A /* TXBijectiveDictionary.h in Headers */, 420D1ACC165BF54D0097EE03 /* NSDictionary+plistValue.h in Headers */, 4202873316CC241600F2C92A /* NSString+dateValue.h in Headers */, 4202873716CC245E00F2C92A /* NSDate+stringValue.h in Headers */, 42877CAF183DAC4100967368 /* Misc.h in Headers */, 42877CB0183DAC4100967368 /* NSObject+associatedObject.h in Headers */, + 42877CB2183DAC4100967368 /* NSObject+DeallocListener.h in Headers */, 42877CB4183DAC4100967368 /* NSObject+invocationForSelector.h in Headers */, 42352D3518765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h in Headers */, 42877CBA183DB08900967368 /* NSObject+invokeSafely.h in Headers */, @@ -666,6 +711,10 @@ buildActionMask = 2147483647; files = ( 42719C6117C93855007AAB83 /* NSDictionary+entrySet.m in Sources */, + 42719C7117C9450A007AAB83 /* TXMutableWeakArray.m in Sources */, + 42719C7A17C94F2A007AAB83 /* TXMutableWeakDictionary.m in Sources */, + 42719C7117C9450A007AAB83 /* TXMutableWeakArray.m in Sources */, + 42719C7A17C94F2A007AAB83 /* TXMutableWeakDictionary.m in Sources */, 427307F117C932F50045A398 /* NSObject+abstractClass.m in Sources */, 427307F317C932F50045A398 /* NSObject+abstractProtocolConformer.m in Sources */, 427307F517C932F50045A398 /* NSObject+supersequentImplementation.m in Sources */, @@ -676,6 +725,7 @@ 427307FF17C932F50045A398 /* NSString+characterAtIndexSubscript.m in Sources */, 4273080117C932F50045A398 /* NSString+firstLetterCaseString.m in Sources */, 42352D3618765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m in Sources */, + 420952B1185054CF006E904A /* TXBijectiveDictionary.m in Sources */, 4273080317C932F50045A398 /* NSString+isEqualToStringIgnoreCase.m in Sources */, 42719C6D17C93B66007AAB83 /* NSString+random.m in Sources */, 428D034318482D9500303ED4 /* NSNotificationCenter+errorCenter.m in Sources */, @@ -695,6 +745,8 @@ 4202873416CC241600F2C92A /* NSString+dateValue.m in Sources */, 4202873816CC245E00F2C92A /* NSDate+stringValue.m in Sources */, 42877CB1183DAC4100967368 /* NSObject+associatedObject.m in Sources */, + 42877CB3183DAC4100967368 /* NSObject+DeallocListener.m in Sources */, + 4205F9FB1851329100051E68 /* TXBTree.m in Sources */, 42877CB5183DAC4100967368 /* NSObject+invocationForSelector.m in Sources */, 42877CBB183DB08900967368 /* NSObject+invokeSafely.m in Sources */, ); diff --git a/TypeExtensions/Collection Extensions/Collection.h b/TypeExtensions/Collection Extensions/Collection.h index be4fa52..0635047 100644 --- a/TypeExtensions/Collection Extensions/Collection.h +++ b/TypeExtensions/Collection Extensions/Collection.h @@ -7,4 +7,10 @@ // #import "NSDictionary+entrySet.h" -#import "NSMapTable+objectForKeyedSubscript.h" \ No newline at end of file +#import "NSDictionaryEntrySetEntry.h" +#import "NSMapTable+objectForKeyedSubscript.h" +#import "NSMutableArray_NonRetaining_Zeroing.h" +#import "NSMutableDictionary_NonRetaining_Zeroing.h" +#import "NSDictionary_BinarySearchTree.h"#import "TXMutableWeakArray.h" +#import "TXMutableWeakDictionary.h" +#import "TXMutableBTreeDictionary.h" \ No newline at end of file diff --git a/TypeExtensions/Collection Extensions/NSArrayMutable_NonRetaining_Zeroing+Private.h b/TypeExtensions/Collection Extensions/NSArrayMutable_NonRetaining_Zeroing+Private.h new file mode 100644 index 0000000..1215200 --- /dev/null +++ b/TypeExtensions/Collection Extensions/NSArrayMutable_NonRetaining_Zeroing+Private.h @@ -0,0 +1,22 @@ +// +// NSArray_NonRetaining_Zeroing_Private.h +// TypeExtensions +// +// Created by Ethan Reesor on 8/24/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import "NSArray_NonRetaining_Zeroing.h" + +@protocol __NSArray_NonRetaining_Zeroing__Container + +- (id)object; + +@end + +@interface NSArray_NonRetaining_Zeroing () + ++ (id)nonRetainingZeroingEntityForObject:(id)object; ++ (void)nonRetainingZeroingEntities:(id **)entities forObjects:(const id [])objects count:(NSUInteger)cnt; + +@end diff --git a/TypeExtensions/Collection Extensions/TXBTree.h b/TypeExtensions/Collection Extensions/TXBTree.h new file mode 100644 index 0000000..743be02 --- /dev/null +++ b/TypeExtensions/Collection Extensions/TXBTree.h @@ -0,0 +1,24 @@ +// +// TXBTree.h +// TypeExtensions +// +// Created by Ethan Reesor on 12/5/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import + +@interface TXBTree : NSDictionary + +@property (retain) id key, + object; +@property (readonly) NSUInteger count; +@property (copy) NSComparator comparator; +@property (retain) TXBTree * parent, + * left, + * right; + ++ (instancetype)treeWithComparator:(NSComparator)comparator forObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt; +- (id)initWithComparator:(NSComparator)comparator forObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt; + +@end diff --git a/TypeExtensions/Collection Extensions/TXBTree.m b/TypeExtensions/Collection Extensions/TXBTree.m new file mode 100644 index 0000000..94ba27d --- /dev/null +++ b/TypeExtensions/Collection Extensions/TXBTree.m @@ -0,0 +1,77 @@ +// +// TXBTree.m +// TypeExtensions +// +// Created by Ethan Reesor on 12/5/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import "TXBTree.h" + +@implementation TXBTree + ++ (instancetype)treeWithComparator:(NSComparator)comparator forObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt +{ + return [[[self alloc] initWithComparator:comparator forObjects:objects forKeys:keys count:cnt] autorelease]; +} + +- (id)initWithComparator:(NSComparator)comparator forObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt +{ + comparator = Block_copy(comparator); + self = [self initWithParent:nil andComparator:comparator forObjects:objects forKeys:keys count:cnt]; + Block_release(comparator); + return self; +} + +- (id)initWithParent:(TXBTree *)parent andComparator:(NSComparator)comparator forObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt +{ + if (!(self = [super init])) + return nil; + + if (!cnt) + return nil; + + _comparator = [comparator retain]; + _parent = [parent retain]; + _count = cnt; + + NSUInteger count = cnt / 2; + if (count) { + _left = [[self.class alloc] initWithParent:self andComparator:comparator forObjects:objects forKeys:keys count:count]; + objects += count; + keys += count; + cnt -= count; + } + + _object = [objects++[0] retain]; + _key = [keys++[0] retain]; + cnt--; + + if (cnt) + _right = [[self.class alloc] initWithParent:self andComparator:comparator forObjects:objects forKeys:keys count:cnt]; + + [self.parent addObserver:self forKeyPath:@"comparator" options:NSKeyValueObservingOptionNew context:nil]; + [self.left addObserver:self forKeyPath:@"count" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; + [self.right addObserver:self forKeyPath:@"count" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; + + return self; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if ([@"comparator" isEqualToString:keyPath]) { + [self willChangeValueForKey:@"comparator"]; + _comparator = change[NSKeyValueChangeNewKey]; + [self didChangeValueForKey:@"comparator"]; + return; + } + + if ([@"count" isEqualToString:keyPath]) { + [self willChangeValueForKey:@"count"]; + _count = [change[NSKeyValueChangeNewKey] unsignedIntegerValue] - [change[NSKeyValueChangeOldKey] unsignedIntegerValue]; + [self didChangeValueForKey:@"count"]; + return; + } +} + +@end diff --git a/TypeExtensions/Collection Extensions/TXBijectiveDictionary.h b/TypeExtensions/Collection Extensions/TXBijectiveDictionary.h new file mode 100644 index 0000000..0cc85c4 --- /dev/null +++ b/TypeExtensions/Collection Extensions/TXBijectiveDictionary.h @@ -0,0 +1,13 @@ +// +// TXBijectiveDictionary.h +// TypeExtensions +// +// Created by Ethan Reesor on 12/5/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import + +@interface TXBijectiveDictionary : NSDictionary + +@end diff --git a/TypeExtensions/Collection Extensions/TXBijectiveDictionary.m b/TypeExtensions/Collection Extensions/TXBijectiveDictionary.m new file mode 100644 index 0000000..61b6fc0 --- /dev/null +++ b/TypeExtensions/Collection Extensions/TXBijectiveDictionary.m @@ -0,0 +1,13 @@ +// +// TXBijectiveDictionary.m +// TypeExtensions +// +// Created by Ethan Reesor on 12/5/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import "TXBijectiveDictionary.h" + +@implementation TXBijectiveDictionary + +@end diff --git a/TypeExtensions/Collection Extensions/TXMutableWeakArray.h b/TypeExtensions/Collection Extensions/TXMutableWeakArray.h new file mode 100644 index 0000000..0f076bf --- /dev/null +++ b/TypeExtensions/Collection Extensions/TXMutableWeakArray.h @@ -0,0 +1,15 @@ +// +// NSArray_NonRetaining_Zeroing.h +// TypeExtensions +// +// Created by Ethan Reesor on 8/24/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import + +#import "NSObject+DeallocListener.h" + +@interface TXMutableWeakArray : NSMutableArray + +@end diff --git a/TypeExtensions/Collection Extensions/TXMutableWeakArray.m b/TypeExtensions/Collection Extensions/TXMutableWeakArray.m new file mode 100644 index 0000000..9fdc185 --- /dev/null +++ b/TypeExtensions/Collection Extensions/TXMutableWeakArray.m @@ -0,0 +1,97 @@ +// +// NSArray_NonRetaining_Zeroing.m +// TypeExtensions +// +// Created by Ethan Reesor on 8/24/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import "TXMutableWeakArray.h" + +@implementation TXMutableWeakArray { + NSMutableArray * _backing; +} + +- (id)initWithObjects:(const id [])objects count:(NSUInteger)cnt +{ + if (!(self = [super init])) + return nil; + + id entries[cnt]; + for (int i = 0; i < cnt; i++) + entries[i] = [NSValue valueWithNonretainedObject:objects[i]]; + _backing = [[NSMutableArray alloc] initWithObjects:entries count:cnt]; + + return self; +} + +- (void)dealloc +{ + [_backing release]; + + [super dealloc]; +} + +- (id)wrapAndStartNotification:(id)object +{ + if (![object isKindOfClass:NSObject.class]) + return nil; + + [(NSObject *)object addDeallocListener:self]; + return [self wrap:object]; +} + +- (id)wrap:(id)object +{ + return [NSValue valueWithNonretainedObject:object]; +} + +- (id)unwrap:(id)object +{ + if (![object isKindOfClass:NSValue.class]) + return nil; + + return ((NSValue *)object).nonretainedObjectValue; +} + +- (void)objectDidDeallocate:(id)obj +{ + [_backing removeObject:[self wrap:obj]]; +} + +- (NSUInteger)count +{ + return _backing.count; +} + +- (id)objectAtIndex:(NSUInteger)index +{ + return [self unwrap:[_backing objectAtIndex:index]]; +} + +- (void)insertObject:(id)anObject atIndex:(NSUInteger)index +{ + [_backing insertObject:[self wrapAndStartNotification:anObject] atIndex:index]; +} + +- (void)removeObjectAtIndex:(NSUInteger)index +{ + [_backing removeObjectAtIndex:index]; +} + +- (void)addObject:(id)anObject +{ + [_backing addObject:[self wrapAndStartNotification:anObject]]; +} + +- (void)removeLastObject +{ + [self removeObjectAtIndex:self.count - 1]; +} + +- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject +{ + [_backing replaceObjectAtIndex:index withObject:[self wrapAndStartNotification:anObject]]; +} + +@end diff --git a/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.h b/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.h new file mode 100644 index 0000000..029e808 --- /dev/null +++ b/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.h @@ -0,0 +1,13 @@ +// +// NSMutableDictionary_NonRetaining_Zeroing.h +// TypeExtensions +// +// Created by Ethan Reesor on 8/24/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import + +@interface TXMutableWeakDictionary : NSMutableDictionary + +@end diff --git a/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.m b/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.m new file mode 100644 index 0000000..7c9d53e --- /dev/null +++ b/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.m @@ -0,0 +1,150 @@ +// +// NSMutableDictionary_NonRetaining_Zeroing.m +// TypeExtensions +// +// Created by Ethan Reesor on 8/24/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import "TXMutableWeakDictionary.h" + +#import "NSObject+DeallocListener.h" + + +@interface TXMutableWeakDictionary () + +- (void)objectDidDeallocateForKey:(id)key; + +@end + + +@interface __NSMutableDictionary_NonRetaining_Zeroing__Listener : NSObject + +@property (readonly) TXMutableWeakDictionary * dictionary; +@property (readonly) id key; +@property (readonly) id obj; + ++ (__NSMutableDictionary_NonRetaining_Zeroing__Listener *)listenerWithDictionary:(TXMutableWeakDictionary *)dict forObject:(id)obj withKey:(id)key; +- (id)initWithDictionary:(TXMutableWeakDictionary *)dict forObject:(id)obj withKey:(id)key; + +@end + + +@implementation __NSMutableDictionary_NonRetaining_Zeroing__Listener + ++ (__NSMutableDictionary_NonRetaining_Zeroing__Listener *)listenerWithDictionary:(TXMutableWeakDictionary *)dict forObject:(id)obj withKey:(id)key +{ + return [[[self alloc] initWithDictionary:dict forObject:obj withKey:key] autorelease]; +} + +- (id)initWithDictionary:(TXMutableWeakDictionary *)dict forObject:(id)obj withKey:(id)key +{ + if (!(self = [super init])) + return nil; + + if (![obj isKindOfClass:NSObject.class]) + return nil; + + _dictionary = dict.retain; + _obj = obj; + _key = key.retain; + + [self.obj addDeallocListener:self]; + + return self; +} + +- (id)copyWithZone:(NSZone *)zone +{ + [NSException raise:@"Unsupported functionality" format:@"This object should not be copied"]; + return nil; +} + +- (void)dealloc +{ +// [(NSObject *)_obj stopDeallocationNotification]; + [_obj removeDeallocListener:self]; + [_dictionary release]; + [_key release]; + + [super dealloc]; +} + +- (void)objectDidDeallocate:(id)obj +{ + _obj = nil; + [self.dictionary objectDidDeallocateForKey:self.key]; +} + +@end + + +@implementation TXMutableWeakDictionary { + NSMutableDictionary * _backing; +} + +- (id)initWithObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt +{ + if (!(self = [super init])) + return nil; + + id entries[cnt]; + for (int i = 0; i < cnt; i++) + entries[i] = [__NSMutableDictionary_NonRetaining_Zeroing__Listener listenerWithDictionary:self forObject:objects[i] withKey:(id)keys[i]]; + + _backing = [[NSMutableDictionary alloc] initWithObjects:entries forKeys:keys count:cnt]; + + return self; +} + +- (void)dealloc +{ + [_backing release]; + + [super dealloc]; +} + +- (id)wrap:(id)object key:(id)key +{ + return [__NSMutableDictionary_NonRetaining_Zeroing__Listener listenerWithDictionary:self forObject:object withKey:key]; +} + +- (id)unwrap:(id)object +{ + if (![object isKindOfClass:__NSMutableDictionary_NonRetaining_Zeroing__Listener.class]) + return nil; + + return ((__NSMutableDictionary_NonRetaining_Zeroing__Listener *)object).obj; +} + +- (void)objectDidDeallocateForKey:(id)key +{ + [_backing removeObjectForKey:key]; +} + +- (NSUInteger)count +{ + return _backing.count; +} + +- (id)objectForKey:(id)aKey +{ + return [self unwrap:[_backing objectForKey:aKey]]; +} + +- (NSEnumerator *)keyEnumerator +{ + return _backing.keyEnumerator; +} + +- (void)setObject:(id)anObject forKey:(id)aKey +{ + [_backing setObject:[self wrap:anObject key:(id)aKey] forKey:aKey]; +} + +- (void)removeObjectForKey:(id)aKey +{ + [_backing removeObjectForKey:aKey]; +} + +@end diff --git a/TypeExtensions/Other Extensions/Misc.h b/TypeExtensions/Other Extensions/Misc.h index 12d7839..a7eabac 100644 --- a/TypeExtensions/Other Extensions/Misc.h +++ b/TypeExtensions/Other Extensions/Misc.h @@ -8,4 +8,6 @@ #import "NSObject+associatedObject.h" #import "NSObject+invocationForSelector.h" +#import "NSObject+DeallocListener.h" +#import "NSObject+zeroingWeakReferenceProxy.h" #import "NSObject+invokeSafely.h" \ No newline at end of file diff --git a/TypeExtensions/Other Extensions/NSObject+DeallocListener.h b/TypeExtensions/Other Extensions/NSObject+DeallocListener.h new file mode 100644 index 0000000..6705ceb --- /dev/null +++ b/TypeExtensions/Other Extensions/NSObject+DeallocListener.h @@ -0,0 +1,29 @@ +// +// NSObject+DeallocListener.h +// TypeExtensions +// +// Created by Ethan Reesor on 8/24/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import + +@protocol DeallocListener + +- (void)objectDidDeallocate:(id)obj; + +@end + +@protocol DeallocNotifier + +- (void)addDeallocListener:(id)listener; +- (void)removeDeallocListener:(id)listener; + +@end + +@interface NSObject (DeallocListener) + +- (void)addDeallocListener:(id)listener; +- (void)removeDeallocListener:(id)listener; + +@end diff --git a/TypeExtensions/Other Extensions/NSObject+DeallocListener.m b/TypeExtensions/Other Extensions/NSObject+DeallocListener.m new file mode 100644 index 0000000..b835269 --- /dev/null +++ b/TypeExtensions/Other Extensions/NSObject+DeallocListener.m @@ -0,0 +1,195 @@ +// +// NSObject+DeallocListener.m +// TypeExtensions +// +// Created by Ethan Reesor on 8/24/13. +// Copyright (c) 2013 Lens Flare. All rights reserved. +// + +#import "NSObject+DeallocListener.h" + +#import "NSObject+associatedObject.h" +#import "NSString+random.h" + +#import +#import + +#define kDeallocListenerAssociatedClassKey "__DeallocListener__AssociatedClass__" +#define kDeallocListenerOriginalClassKey "__DeallocListener__OriginalClass__" +#define kDeallocListenerArrayKey "com.firelizzard.TypeExtensions.DeallocListener.listeners" +#define kDeallocListenerSubclassFailureExceptionKey @"com.firelizzard.TypeExtensions.DeallocListener.exceptions.subclassFailure" + +#define MAX_RETAIN_COUNT 0x7fffffffffffffff + +#pragma mark - + +@interface NSObject (DeallocListenerPrivate) + +- (void)_revert; + +@end + +#pragma mark - + +void DeallocNotifier_addDeallocListener(id self, SEL _cmd, id listener) { + NSMutableArray * arr = objc_getAssociatedObject(self, kDeallocListenerArrayKey); + + if (!arr) { + arr = [NSMutableArray array]; + objc_setAssociatedObject(self, kDeallocListenerArrayKey, arr, OBJC_ASSOCIATION_RETAIN); + } + + [arr addObject:listener]; +} + +void DeallocNotifier_removeDeallocListener(id self, SEL _cmd, id listener) { + NSMutableArray * arr = objc_getAssociatedObject(self, kDeallocListenerArrayKey); + + if (!arr) + return; + + [arr removeObject:listener]; +} + +void DeallocNotifier_dealloc(id self, SEL _cmd) { + if ([self respondsToSelector:@selector(invalidate)]) + [self invalidate]; + + for (id listener in objc_getAssociatedObject(self, kDeallocListenerArrayKey)) + [listener objectDidDeallocate:self]; + + objc_setAssociatedObject(self, kDeallocListenerArrayKey, nil, OBJC_ASSOCIATION_RETAIN); + + [self _revert]; + [self dealloc]; +} + +Class DeallocNotifier_class(id self, SEL _cmd) { + Class realClass = object_getClass(self); + Class superClass = class_getSuperclass(realClass); + + object_setClass(self, superClass); + Class class = [self class]; + object_setClass(self, realClass); + return class; +} + +#pragma mark - + +id associatedObject_associatedObjectForKey(Class self, SEL _cmd, const char * key) { + return objc_getAssociatedObject(objc_getAssociatedObject(self, kDeallocListenerOriginalClassKey), key); +} + +void associatedObject_setAssociatedObject_forKey(Class self, SEL _cmd, id obj, const char * key) { + objc_setAssociatedObject(objc_getAssociatedObject(self, kDeallocListenerOriginalClassKey), key, obj, OBJC_ASSOCIATION_RETAIN); +} + +#pragma mark - + +void KVOBug_addObserver_forKeyPath_options_context(id self, SEL _cmd, NSObject * observer, NSString * keyPath, NSKeyValueObservingOptions options, void * context) { + Class realClass = object_getClass(self); + Class superClass = class_getSuperclass(realClass); + + object_setClass(self, superClass); + [self addObserver:observer forKeyPath:keyPath options:options context:context]; + object_setClass(self, realClass); +} + +void KVOBug_removeObserver_forKeyPath_context(id self, SEL _cmd, NSObject * observer, NSString * keyPath, void * context) { + Class realClass = object_getClass(self); + Class superClass = class_getSuperclass(realClass); + + object_setClass(self, superClass); + [self removeObserver:observer forKeyPath:keyPath context:context]; + object_setClass(self, realClass); +} + +void KVOBug_setValue_forKey(id self, SEL _cmd, id object, NSString * key) { + Class realClass = object_getClass(self); + Class superClass = class_getSuperclass(realClass); + + object_setClass(self, superClass); + [self setValue:object forKey:key]; + object_setClass(self, realClass); +} + +#pragma mark - + +@implementation NSObject (DeallocListener) + +- (void)addDeallocListener:(id)listener { + Class original = objc_getAssociatedObject(self.class, kDeallocListenerOriginalClassKey); + if (original || [self conformsToProtocol:@protocol(DeallocNotifier)]) + goto _addListener; + + if ([self isMemberOfClass:NSObject.class]) + goto _classException; + + if ([self isKindOfClass:NSString.class]) + goto _classException; + + if ([self isKindOfClass:NSNumber.class]) + goto _classException; + + if (self.retainCount == @(0).retainCount || self.retainCount == @"".retainCount) + goto _classException; + + [self addObserver:self forKeyPath:@"self" options:0 context:nil]; + + original = object_getClass(self); + Class proxyClass = [(NSObject *)original associatedObjectForKey:kDeallocListenerAssociatedClassKey]; + + if (!proxyClass) { + NSString * newName = [NSString stringWithFormat:@"DeallocNotifying_%@", original]; + proxyClass = objc_allocateClassPair(original, [newName cStringUsingEncoding:NSASCIIStringEncoding], 0); + Class proxyClassClass = object_getClass(proxyClass); + + objc_registerClassPair(proxyClass); + + class_addProtocol(proxyClass, @protocol(DeallocNotifier)); + + class_addMethod(proxyClass, @selector(addDeallocListener:), (IMP)&DeallocNotifier_addDeallocListener, "v@:@@"); + class_addMethod(proxyClass, @selector(removeDeallocListener:), (IMP)&DeallocNotifier_removeDeallocListener, "v@:@"); + class_addMethod(proxyClass, @selector(dealloc), (IMP)&DeallocNotifier_dealloc, "v@:"); + class_addMethod(proxyClass, @selector(class), (IMP)&DeallocNotifier_class, "@@:"); + + class_addMethod(proxyClassClass, @selector(associatedObjectForKey:), (IMP)&associatedObject_associatedObjectForKey, "@@:*"); + class_addMethod(proxyClassClass, @selector(setAssociatedObject:forKey:), (IMP)&associatedObject_setAssociatedObject_forKey, "v@:@*"); + + class_addMethod(proxyClass, @selector(addObserver:forKeyPath:options:context:), (IMP)&KVOBug_addObserver_forKeyPath_options_context, "v@:@@i*"); + class_addMethod(proxyClass, @selector(removeObserver:forKeyPath:context:), (IMP)&KVOBug_removeObserver_forKeyPath_context, "v@:@@*"); + class_addMethod(proxyClass, @selector(setValue:forKey:), (IMP)&KVOBug_setValue_forKey, "v@:@@"); + + objc_setAssociatedObject(proxyClass, kDeallocListenerOriginalClassKey, original, OBJC_ASSOCIATION_RETAIN); + objc_setAssociatedObject(original, kDeallocListenerAssociatedClassKey, proxyClass, OBJC_ASSOCIATION_RETAIN); + } + + object_setClass(self, proxyClass); + +_addListener: + [self addDeallocListener:listener]; + return; + +_classException: + @throw [NSException exceptionWithName:kDeallocListenerSubclassFailureExceptionKey reason:[NSString stringWithFormat:@"%@ cannot be converted to a DeallocNotifier", self] userInfo:0]; +} + +- (void)removeDeallocListener:(id)listener +{ + // nothing to do +} + +@end + +@implementation NSObject (DeallocListenerPrivate) + +- (void)_revert +{ + Class original = objc_getAssociatedObject(object_getClass(self), kDeallocListenerOriginalClassKey); + if (original) + object_setClass(self, original); + + [self removeObserver:self forKeyPath:@"self" context:nil]; +} + +@end From fa21cb71c382deafba7051485deb4a2e96843838 Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 21:38:08 -0500 Subject: [PATCH 03/13] saving work --- TypeExtensions.xcodeproj/project.pbxproj | 192 +++++++++--------- .../Collection Extensions/Collection.h | 8 +- ...rrayMutable_NonRetaining_Zeroing+Private.h | 22 -- .../NSObject+abstractProtocolConformer.m | 22 +- .../NSObject_Singleton.m | 26 +-- TypeExtensions/Other Extensions/Misc.h | 5 +- .../Other Extensions/TXZeroingWeakProxy.h | 19 ++ .../Other Extensions/TXZeroingWeakProxy.m | 18 ++ TypeExtensions/TypeExtensions-Info.plist | 2 +- TypeExtensionsTests/TECollectionTests.m | 120 ++++++----- TypeExtensionsTests/TEMiscTests.m | 10 + 11 files changed, 233 insertions(+), 211 deletions(-) delete mode 100644 TypeExtensions/Collection Extensions/NSArrayMutable_NonRetaining_Zeroing+Private.h create mode 100644 TypeExtensions/Other Extensions/TXZeroingWeakProxy.h create mode 100644 TypeExtensions/Other Extensions/TXZeroingWeakProxy.m diff --git a/TypeExtensions.xcodeproj/project.pbxproj b/TypeExtensions.xcodeproj/project.pbxproj index 92afc27..045ab03 100644 --- a/TypeExtensions.xcodeproj/project.pbxproj +++ b/TypeExtensions.xcodeproj/project.pbxproj @@ -20,94 +20,95 @@ 42026AEB183EA07900B1F530 /* TypeExtensionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CC9183E8EA400967368 /* TypeExtensionsTests.m */; }; 42026AEC183EA16500B1F530 /* TypeExtensions.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 420D1A9C165BF5020097EE03 /* TypeExtensions.framework */; }; 4202873316CC241600F2C92A /* NSString+dateValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4202873116CC241600F2C92A /* NSString+dateValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4202873416CC241600F2C92A /* NSString+dateValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4202873216CC241600F2C92A /* NSString+dateValue.m */; }; 4202873716CC245E00F2C92A /* NSDate+stringValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4202873516CC245E00F2C92A /* NSDate+stringValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4202873816CC245E00F2C92A /* NSDate+stringValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4202873616CC245E00F2C92A /* NSDate+stringValue.m */; }; 4205F9FA1851329100051E68 /* TXBTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 4205F9F81851329100051E68 /* TXBTree.h */; }; - 4205F9FB1851329100051E68 /* TXBTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 4205F9F91851329100051E68 /* TXBTree.m */; }; 420952B0185054CF006E904A /* TXBijectiveDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 420952AE185054CF006E904A /* TXBijectiveDictionary.h */; }; - 420952B1185054CF006E904A /* TXBijectiveDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 420952AF185054CF006E904A /* TXBijectiveDictionary.m */; }; 420D1AA0165BF5020097EE03 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 420D1A9F165BF5020097EE03 /* Cocoa.framework */; }; 420D1AAA165BF5020097EE03 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 420D1AA8165BF5020097EE03 /* InfoPlist.strings */; }; 420D1AC6165BF54D0097EE03 /* NSArray+orNull.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AB5165BF54D0097EE03 /* NSArray+orNull.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 420D1AC7165BF54D0097EE03 /* NSArray+orNull.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AB6165BF54D0097EE03 /* NSArray+orNull.m */; }; 420D1AC8165BF54D0097EE03 /* NSObject+isNull.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AB7165BF54D0097EE03 /* NSObject+isNull.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 420D1AC9165BF54D0097EE03 /* NSObject+isNull.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AB8165BF54D0097EE03 /* NSObject+isNull.m */; }; 420D1ACA165BF54D0097EE03 /* NSString+isEmpty.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AB9165BF54D0097EE03 /* NSString+isEmpty.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 420D1ACB165BF54D0097EE03 /* NSString+isEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1ABA165BF54D0097EE03 /* NSString+isEmpty.m */; }; 420D1ACC165BF54D0097EE03 /* NSDictionary+plistValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1ABC165BF54D0097EE03 /* NSDictionary+plistValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 420D1ACD165BF54D0097EE03 /* NSDictionary+plistValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1ABD165BF54D0097EE03 /* NSDictionary+plistValue.m */; }; 420D1ACE165BF54D0097EE03 /* NSString+dataValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1ABE165BF54D0097EE03 /* NSString+dataValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 420D1ACF165BF54D0097EE03 /* NSString+dataValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1ABF165BF54D0097EE03 /* NSString+dataValue.m */; }; 420D1AD0165BF54D0097EE03 /* NSString+isNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AC0165BF54D0097EE03 /* NSString+isNumber.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 420D1AD1165BF54D0097EE03 /* NSString+isNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AC1165BF54D0097EE03 /* NSString+isNumber.m */; }; 420D1AD2165BF54D0097EE03 /* NSString+numberValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AC2165BF54D0097EE03 /* NSString+numberValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 420D1AD3165BF54D0097EE03 /* NSString+numberValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AC3165BF54D0097EE03 /* NSString+numberValue.m */; }; 420D1AD4165BF54D0097EE03 /* NSString+plistValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AC4165BF54D0097EE03 /* NSString+plistValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 420D1AD5165BF54D0097EE03 /* NSString+plistValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AC5165BF54D0097EE03 /* NSString+plistValue.m */; }; 42352D3518765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42352D3618765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */; }; - 42352D471877C58A0011CA48 /* NSArrayMutable_NonRetaining_Zeroing+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D461877C58A0011CA48 /* NSArrayMutable_NonRetaining_Zeroing+Private.h */; }; + 42352D601877DC700011CA48 /* TXZeroingWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D5E1877DC700011CA48 /* TXZeroingWeakProxy.h */; }; + 42352D661877E46C0011CA48 /* TXMutableWeakArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D621877E46C0011CA48 /* TXMutableWeakArray.h */; }; + 42352D671877E46C0011CA48 /* TXMutableWeakArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D631877E46C0011CA48 /* TXMutableWeakArray.m */; }; + 42352D681877E46C0011CA48 /* TXMutableWeakDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D641877E46C0011CA48 /* TXMutableWeakDictionary.h */; }; + 42352D691877E46C0011CA48 /* TXMutableWeakDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D651877E46C0011CA48 /* TXMutableWeakDictionary.m */; }; + 42352D6A1877E4AF0011CA48 /* NSDictionary+entrySet.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C5D17C93855007AAB83 /* NSDictionary+entrySet.m */; }; + 42352D6B1877E4AF0011CA48 /* NSMapTable+objectForKeyedSubscript.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */; }; + 42352D6C1877E4AF0011CA48 /* TXBijectiveDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 420952AF185054CF006E904A /* TXBijectiveDictionary.m */; }; + 42352D6D1877E4AF0011CA48 /* TXBTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 4205F9F91851329100051E68 /* TXBTree.m */; }; + 42352D6E1877E4AF0011CA48 /* NSObject+abstractClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DB17C932F50045A398 /* NSObject+abstractClass.m */; }; + 42352D6F1877E4AF0011CA48 /* NSObject+abstractProtocolConformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DD17C932F50045A398 /* NSObject+abstractProtocolConformer.m */; }; + 42352D701877E4AF0011CA48 /* NSObject+supersequentImplementation.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DF17C932F50045A398 /* NSObject+supersequentImplementation.m */; }; + 42352D711877E4AF0011CA48 /* NSObject_Singleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307E117C932F50045A398 /* NSObject_Singleton.m */; }; + 42352D721877E4AF0011CA48 /* NSNull+nullForProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307E417C932F50045A398 /* NSNull+nullForProtocol.m */; }; + 42352D731877E4AF0011CA48 /* NSObject+methodDescriptionForSelectorInProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307E617C932F50045A398 /* NSObject+methodDescriptionForSelectorInProtocol.m */; }; + 42352D741877E4AF0011CA48 /* NSObject_ProtocolConformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307E817C932F50045A398 /* NSObject_ProtocolConformer.m */; }; + 42352D751877E4AF0011CA48 /* NSString+characterAtIndexSubscript.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307EB17C932F50045A398 /* NSString+characterAtIndexSubscript.m */; }; + 42352D761877E4AF0011CA48 /* NSString+firstLetterCaseString.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307ED17C932F50045A398 /* NSString+firstLetterCaseString.m */; }; + 42352D771877E4AF0011CA48 /* NSString+isEqualToStringIgnoreCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307EF17C932F50045A398 /* NSString+isEqualToStringIgnoreCase.m */; }; + 42352D781877E4AF0011CA48 /* NSString+random.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C6B17C93B66007AAB83 /* NSString+random.m */; }; + 42352D791877E4AF0011CA48 /* NSNotificationCenter+errorCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 428D034018482D9500303ED4 /* NSNotificationCenter+errorCenter.m */; }; + 42352D7A1877E4AF0011CA48 /* NSObject+isNull.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AB8165BF54D0097EE03 /* NSObject+isNull.m */; }; + 42352D7B1877E4AF0011CA48 /* NSString+isEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1ABA165BF54D0097EE03 /* NSString+isEmpty.m */; }; + 42352D7C1877E4AF0011CA48 /* NSArray+orNull.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AB6165BF54D0097EE03 /* NSArray+orNull.m */; }; + 42352D7D1877E4AF0011CA48 /* NSString+orNull.m in Sources */ = {isa = PBXBuildFile; fileRef = 4291FF3716C57EA4000538EF /* NSString+orNull.m */; }; + 42352D7E1877E4AF0011CA48 /* NSObject_KVCArrayForwarding.m in Sources */ = {isa = PBXBuildFile; fileRef = 428D034618482DA700303ED4 /* NSObject_KVCArrayForwarding.m */; }; + 42352D7F1877E4AF0011CA48 /* NSObject_KVCUndefined.m in Sources */ = {isa = PBXBuildFile; fileRef = 428D034818482DA700303ED4 /* NSObject_KVCUndefined.m */; }; + 42352D801877E4AF0011CA48 /* NSString+isNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AC1165BF54D0097EE03 /* NSString+isNumber.m */; }; + 42352D811877E4AF0011CA48 /* NSString+urlValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BA0C3416707B2C0066DD1A /* NSString+urlValue.m */; }; + 42352D821877E4AF0011CA48 /* NSString+numberValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AC3165BF54D0097EE03 /* NSString+numberValue.m */; }; + 42352D831877E4AF0011CA48 /* NSString+dataValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1ABF165BF54D0097EE03 /* NSString+dataValue.m */; }; + 42352D841877E4AF0011CA48 /* NSData+stringValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 42DFF306165DFBE6003F26DA /* NSData+stringValue.m */; }; + 42352D851877E4AF0011CA48 /* NSString+plistValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1AC5165BF54D0097EE03 /* NSString+plistValue.m */; }; + 42352D861877E4AF0011CA48 /* NSDictionary+plistValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 420D1ABD165BF54D0097EE03 /* NSDictionary+plistValue.m */; }; + 42352D871877E4AF0011CA48 /* NSString+dateValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4202873216CC241600F2C92A /* NSString+dateValue.m */; }; + 42352D881877E4AF0011CA48 /* NSDate+stringValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4202873616CC245E00F2C92A /* NSDate+stringValue.m */; }; + 42352D891877E4AF0011CA48 /* NSObject+associatedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CA6183DAC4100967368 /* NSObject+associatedObject.m */; }; + 42352D8A1877E4AF0011CA48 /* NSObject+DeallocListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CA8183DAC4100967368 /* NSObject+DeallocListener.m */; }; + 42352D8B1877E4AF0011CA48 /* NSObject+invocationForSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */; }; + 42352D8C1877E4AF0011CA48 /* NSObject+invokeSafely.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CB9183DB08900967368 /* NSObject+invokeSafely.m */; }; + 42352D8D1877E4AF0011CA48 /* TXZeroingWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D5F1877DC700011CA48 /* TXZeroingWeakProxy.m */; }; 42719C5317C935A6007AAB83 /* Design.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C5117C9343C007AAB83 /* Design.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42719C5417C935A9007AAB83 /* Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C5017C933F8007AAB83 /* Protocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42719C5517C935AB007AAB83 /* String.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C4F17C933AC007AAB83 /* String.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42719C6017C93855007AAB83 /* NSDictionary+entrySet.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C5C17C93855007AAB83 /* NSDictionary+entrySet.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42719C6117C93855007AAB83 /* NSDictionary+entrySet.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C5D17C93855007AAB83 /* NSDictionary+entrySet.m */; }; 42719C6517C9386A007AAB83 /* Collection.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C6417C9386A007AAB83 /* Collection.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42719C6C17C93B66007AAB83 /* NSString+random.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C6A17C93B66007AAB83 /* NSString+random.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42719C6D17C93B66007AAB83 /* NSString+random.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C6B17C93B66007AAB83 /* NSString+random.m */; }; - 42719C7017C9450A007AAB83 /* TXMutableWeakArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C6E17C9450A007AAB83 /* TXMutableWeakArray.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42719C7117C9450A007AAB83 /* TXMutableWeakArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C6F17C9450A007AAB83 /* TXMutableWeakArray.m */; }; - 42719C7917C94F2A007AAB83 /* TXMutableWeakDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C7717C94F2A007AAB83 /* TXMutableWeakDictionary.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42719C7A17C94F2A007AAB83 /* TXMutableWeakDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C7817C94F2A007AAB83 /* TXMutableWeakDictionary.m */; }; 427307F017C932F50045A398 /* NSObject+abstractClass.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307DA17C932F50045A398 /* NSObject+abstractClass.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 427307F117C932F50045A398 /* NSObject+abstractClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DB17C932F50045A398 /* NSObject+abstractClass.m */; }; 427307F217C932F50045A398 /* NSObject+abstractProtocolConformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307DC17C932F50045A398 /* NSObject+abstractProtocolConformer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 427307F317C932F50045A398 /* NSObject+abstractProtocolConformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DD17C932F50045A398 /* NSObject+abstractProtocolConformer.m */; }; 427307F417C932F50045A398 /* NSObject+supersequentImplementation.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307DE17C932F50045A398 /* NSObject+supersequentImplementation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 427307F517C932F50045A398 /* NSObject+supersequentImplementation.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DF17C932F50045A398 /* NSObject+supersequentImplementation.m */; }; 427307F617C932F50045A398 /* NSObject_Singleton.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307E017C932F50045A398 /* NSObject_Singleton.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 427307F717C932F50045A398 /* NSObject_Singleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307E117C932F50045A398 /* NSObject_Singleton.m */; }; 427307F817C932F50045A398 /* NSNull+nullForProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307E317C932F50045A398 /* NSNull+nullForProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 427307F917C932F50045A398 /* NSNull+nullForProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307E417C932F50045A398 /* NSNull+nullForProtocol.m */; }; 427307FA17C932F50045A398 /* NSObject+methodDescriptionForSelectorInProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307E517C932F50045A398 /* NSObject+methodDescriptionForSelectorInProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 427307FB17C932F50045A398 /* NSObject+methodDescriptionForSelectorInProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307E617C932F50045A398 /* NSObject+methodDescriptionForSelectorInProtocol.m */; }; 427307FC17C932F50045A398 /* NSObject_ProtocolConformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307E717C932F50045A398 /* NSObject_ProtocolConformer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 427307FD17C932F50045A398 /* NSObject_ProtocolConformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307E817C932F50045A398 /* NSObject_ProtocolConformer.m */; }; 427307FE17C932F50045A398 /* NSString+characterAtIndexSubscript.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307EA17C932F50045A398 /* NSString+characterAtIndexSubscript.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 427307FF17C932F50045A398 /* NSString+characterAtIndexSubscript.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307EB17C932F50045A398 /* NSString+characterAtIndexSubscript.m */; }; 4273080017C932F50045A398 /* NSString+firstLetterCaseString.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307EC17C932F50045A398 /* NSString+firstLetterCaseString.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4273080117C932F50045A398 /* NSString+firstLetterCaseString.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307ED17C932F50045A398 /* NSString+firstLetterCaseString.m */; }; 4273080217C932F50045A398 /* NSString+isEqualToStringIgnoreCase.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307EE17C932F50045A398 /* NSString+isEqualToStringIgnoreCase.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4273080317C932F50045A398 /* NSString+isEqualToStringIgnoreCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307EF17C932F50045A398 /* NSString+isEqualToStringIgnoreCase.m */; }; 42877CAF183DAC4100967368 /* Misc.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA4183DAC4100967368 /* Misc.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42877CB0183DAC4100967368 /* NSObject+associatedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA5183DAC4100967368 /* NSObject+associatedObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42877CB1183DAC4100967368 /* NSObject+associatedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CA6183DAC4100967368 /* NSObject+associatedObject.m */; }; 42877CB2183DAC4100967368 /* NSObject+DeallocListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA7183DAC4100967368 /* NSObject+DeallocListener.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42877CB3183DAC4100967368 /* NSObject+DeallocListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CA8183DAC4100967368 /* NSObject+DeallocListener.m */; }; 42877CB4183DAC4100967368 /* NSObject+invocationForSelector.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA9183DAC4100967368 /* NSObject+invocationForSelector.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42877CB5183DAC4100967368 /* NSObject+invocationForSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */; }; 42877CBA183DB08900967368 /* NSObject+invokeSafely.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42877CBB183DB08900967368 /* NSObject+invokeSafely.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CB9183DB08900967368 /* NSObject+invokeSafely.m */; }; 428D034118482D9500303ED4 /* Notification.h in Headers */ = {isa = PBXBuildFile; fileRef = 428D033E18482D9500303ED4 /* Notification.h */; settings = {ATTRIBUTES = (Public, ); }; }; 428D034218482D9500303ED4 /* NSNotificationCenter+errorCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 428D033F18482D9500303ED4 /* NSNotificationCenter+errorCenter.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 428D034318482D9500303ED4 /* NSNotificationCenter+errorCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 428D034018482D9500303ED4 /* NSNotificationCenter+errorCenter.m */; }; 428D034918482DA700303ED4 /* KVC.h in Headers */ = {isa = PBXBuildFile; fileRef = 428D034418482DA700303ED4 /* KVC.h */; settings = {ATTRIBUTES = (Public, ); }; }; 428D034A18482DA700303ED4 /* NSObject_KVCArrayForwarding.h in Headers */ = {isa = PBXBuildFile; fileRef = 428D034518482DA700303ED4 /* NSObject_KVCArrayForwarding.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 428D034B18482DA700303ED4 /* NSObject_KVCArrayForwarding.m in Sources */ = {isa = PBXBuildFile; fileRef = 428D034618482DA700303ED4 /* NSObject_KVCArrayForwarding.m */; }; 428D034C18482DA700303ED4 /* NSObject_KVCUndefined.h in Headers */ = {isa = PBXBuildFile; fileRef = 428D034718482DA700303ED4 /* NSObject_KVCUndefined.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 428D034D18482DA700303ED4 /* NSObject_KVCUndefined.m in Sources */ = {isa = PBXBuildFile; fileRef = 428D034818482DA700303ED4 /* NSObject_KVCUndefined.m */; }; 4290F08C1849A31400C67769 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 4290F08A1849A31400C67769 /* LICENSE */; }; 4290F08D1849A31400C67769 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 4290F08B1849A31400C67769 /* README.md */; }; 4291FF3816C57EA4000538EF /* NSString+orNull.h in Headers */ = {isa = PBXBuildFile; fileRef = 4291FF3616C57EA4000538EF /* NSString+orNull.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4291FF3916C57EA4000538EF /* NSString+orNull.m in Sources */ = {isa = PBXBuildFile; fileRef = 4291FF3716C57EA4000538EF /* NSString+orNull.m */; }; 42AC0B19165CA0B2002E846E /* Null.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AC0B16165C9FBB002E846E /* Null.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42AC0B1B165CA111002E846E /* TypeExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AAC165BF5020097EE03 /* TypeExtensions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42BA0C3516707B2C0066DD1A /* NSString+urlValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 42BA0C3316707B2C0066DD1A /* NSString+urlValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42BA0C3616707B2C0066DD1A /* NSString+urlValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BA0C3416707B2C0066DD1A /* NSString+urlValue.m */; }; 42D8076016CE206A002885D0 /* Value.h in Headers */ = {isa = PBXBuildFile; fileRef = 4202873016CC23F900F2C92A /* Value.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42DFF307165DFBE6003F26DA /* NSData+stringValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 42DFF305165DFBE6003F26DA /* NSData+stringValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42DFF308165DFBE6003F26DA /* NSData+stringValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 42DFF306165DFBE6003F26DA /* NSData+stringValue.m */; }; 42EC2955183F115800AA5BDA /* Dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 42EC2954183F115800AA5BDA /* Dummy.m */; }; /* End PBXBuildFile section */ @@ -159,7 +160,12 @@ 420D1AC5165BF54D0097EE03 /* NSString+plistValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+plistValue.m"; sourceTree = ""; }; 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMapTable+objectForKeyedSubscript.h"; sourceTree = ""; }; 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMapTable+objectForKeyedSubscript.m"; sourceTree = ""; }; - 42352D461877C58A0011CA48 /* NSArrayMutable_NonRetaining_Zeroing+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArrayMutable_NonRetaining_Zeroing+Private.h"; sourceTree = ""; }; + 42352D5E1877DC700011CA48 /* TXZeroingWeakProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXZeroingWeakProxy.h; sourceTree = ""; }; + 42352D5F1877DC700011CA48 /* TXZeroingWeakProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXZeroingWeakProxy.m; sourceTree = ""; }; + 42352D621877E46C0011CA48 /* TXMutableWeakArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXMutableWeakArray.h; sourceTree = ""; }; + 42352D631877E46C0011CA48 /* TXMutableWeakArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXMutableWeakArray.m; sourceTree = ""; }; + 42352D641877E46C0011CA48 /* TXMutableWeakDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXMutableWeakDictionary.h; sourceTree = ""; }; + 42352D651877E46C0011CA48 /* TXMutableWeakDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXMutableWeakDictionary.m; sourceTree = ""; }; 42719C4F17C933AC007AAB83 /* String.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = String.h; sourceTree = ""; }; 42719C5017C933F8007AAB83 /* Protocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Protocol.h; sourceTree = ""; }; 42719C5117C9343C007AAB83 /* Design.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Design.h; sourceTree = ""; }; @@ -168,10 +174,6 @@ 42719C6417C9386A007AAB83 /* Collection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Collection.h; sourceTree = ""; }; 42719C6A17C93B66007AAB83 /* NSString+random.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+random.h"; sourceTree = ""; }; 42719C6B17C93B66007AAB83 /* NSString+random.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+random.m"; sourceTree = ""; }; - 42719C6E17C9450A007AAB83 /* TXMutableWeakArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXMutableWeakArray.h; sourceTree = ""; }; - 42719C6F17C9450A007AAB83 /* TXMutableWeakArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXMutableWeakArray.m; sourceTree = ""; }; - 42719C7717C94F2A007AAB83 /* TXMutableWeakDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXMutableWeakDictionary.h; sourceTree = ""; }; - 42719C7817C94F2A007AAB83 /* TXMutableWeakDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXMutableWeakDictionary.m; sourceTree = ""; }; 427307DA17C932F50045A398 /* NSObject+abstractClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+abstractClass.h"; sourceTree = ""; }; 427307DB17C932F50045A398 /* NSObject+abstractClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+abstractClass.m"; sourceTree = ""; }; 427307DC17C932F50045A398 /* NSObject+abstractProtocolConformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+abstractProtocolConformer.h"; sourceTree = ""; }; @@ -381,20 +383,15 @@ 42719C5B17C93855007AAB83 /* Collection Extensions */ = { isa = PBXGroup; children = ( - 42352D461877C58A0011CA48 /* NSArrayMutable_NonRetaining_Zeroing+Private.h */, 42719C6417C9386A007AAB83 /* Collection.h */, 42719C5C17C93855007AAB83 /* NSDictionary+entrySet.h */, 42719C5D17C93855007AAB83 /* NSDictionary+entrySet.m */, - 42719C6E17C9450A007AAB83 /* TXMutableWeakArray.h */, - 42719C6F17C9450A007AAB83 /* TXMutableWeakArray.m */, - 42719C7717C94F2A007AAB83 /* TXMutableWeakDictionary.h */, - 42719C7817C94F2A007AAB83 /* TXMutableWeakDictionary.m */, 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */, 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */, - 42719C6E17C9450A007AAB83 /* TXMutableWeakArray.h */, - 42719C6F17C9450A007AAB83 /* TXMutableWeakArray.m */, - 42719C7717C94F2A007AAB83 /* TXMutableWeakDictionary.h */, - 42719C7817C94F2A007AAB83 /* TXMutableWeakDictionary.m */, + 42352D621877E46C0011CA48 /* TXMutableWeakArray.h */, + 42352D631877E46C0011CA48 /* TXMutableWeakArray.m */, + 42352D641877E46C0011CA48 /* TXMutableWeakDictionary.h */, + 42352D651877E46C0011CA48 /* TXMutableWeakDictionary.m */, 420952AE185054CF006E904A /* TXBijectiveDictionary.h */, 420952AF185054CF006E904A /* TXBijectiveDictionary.m */, 4205F9F81851329100051E68 /* TXBTree.h */, @@ -491,6 +488,8 @@ 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */, 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */, 42877CB9183DB08900967368 /* NSObject+invokeSafely.m */, + 42352D5E1877DC700011CA48 /* TXZeroingWeakProxy.h */, + 42352D5F1877DC700011CA48 /* TXZeroingWeakProxy.m */, ); path = "Other Extensions"; sourceTree = ""; @@ -524,14 +523,11 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 42352D601877DC700011CA48 /* TXZeroingWeakProxy.h in Headers */, 42AC0B1B165CA111002E846E /* TypeExtensions.h in Headers */, 42719C6517C9386A007AAB83 /* Collection.h in Headers */, 42719C6017C93855007AAB83 /* NSDictionary+entrySet.h in Headers */, - 42719C7017C9450A007AAB83 /* TXMutableWeakArray.h in Headers */, - 42719C7917C94F2A007AAB83 /* TXMutableWeakDictionary.h in Headers */, - 42719C7017C9450A007AAB83 /* TXMutableWeakArray.h in Headers */, 4205F9FA1851329100051E68 /* TXBTree.h in Headers */, - 42719C7917C94F2A007AAB83 /* TXMutableWeakDictionary.h in Headers */, 42719C5317C935A6007AAB83 /* Design.h in Headers */, 427307F017C932F50045A398 /* NSObject+abstractClass.h in Headers */, 427307F217C932F50045A398 /* NSObject+abstractProtocolConformer.h in Headers */, @@ -548,8 +544,9 @@ 42719C6C17C93B66007AAB83 /* NSString+random.h in Headers */, 428D034118482D9500303ED4 /* Notification.h in Headers */, 428D034218482D9500303ED4 /* NSNotificationCenter+errorCenter.h in Headers */, + 42352D681877E46C0011CA48 /* TXMutableWeakDictionary.h in Headers */, 42AC0B19165CA0B2002E846E /* Null.h in Headers */, - 42352D471877C58A0011CA48 /* NSArrayMutable_NonRetaining_Zeroing+Private.h in Headers */, + 42352D661877E46C0011CA48 /* TXMutableWeakArray.h in Headers */, 420D1AC8165BF54D0097EE03 /* NSObject+isNull.h in Headers */, 420D1ACA165BF54D0097EE03 /* NSString+isEmpty.h in Headers */, 420D1AC6165BF54D0097EE03 /* NSArray+orNull.h in Headers */, @@ -710,45 +707,44 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 42719C6117C93855007AAB83 /* NSDictionary+entrySet.m in Sources */, - 42719C7117C9450A007AAB83 /* TXMutableWeakArray.m in Sources */, - 42719C7A17C94F2A007AAB83 /* TXMutableWeakDictionary.m in Sources */, - 42719C7117C9450A007AAB83 /* TXMutableWeakArray.m in Sources */, - 42719C7A17C94F2A007AAB83 /* TXMutableWeakDictionary.m in Sources */, - 427307F117C932F50045A398 /* NSObject+abstractClass.m in Sources */, - 427307F317C932F50045A398 /* NSObject+abstractProtocolConformer.m in Sources */, - 427307F517C932F50045A398 /* NSObject+supersequentImplementation.m in Sources */, - 427307F717C932F50045A398 /* NSObject_Singleton.m in Sources */, - 427307F917C932F50045A398 /* NSNull+nullForProtocol.m in Sources */, - 427307FB17C932F50045A398 /* NSObject+methodDescriptionForSelectorInProtocol.m in Sources */, - 427307FD17C932F50045A398 /* NSObject_ProtocolConformer.m in Sources */, - 427307FF17C932F50045A398 /* NSString+characterAtIndexSubscript.m in Sources */, - 4273080117C932F50045A398 /* NSString+firstLetterCaseString.m in Sources */, - 42352D3618765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m in Sources */, - 420952B1185054CF006E904A /* TXBijectiveDictionary.m in Sources */, - 4273080317C932F50045A398 /* NSString+isEqualToStringIgnoreCase.m in Sources */, - 42719C6D17C93B66007AAB83 /* NSString+random.m in Sources */, - 428D034318482D9500303ED4 /* NSNotificationCenter+errorCenter.m in Sources */, - 420D1AC9165BF54D0097EE03 /* NSObject+isNull.m in Sources */, - 420D1ACB165BF54D0097EE03 /* NSString+isEmpty.m in Sources */, - 420D1AC7165BF54D0097EE03 /* NSArray+orNull.m in Sources */, - 4291FF3916C57EA4000538EF /* NSString+orNull.m in Sources */, - 428D034B18482DA700303ED4 /* NSObject_KVCArrayForwarding.m in Sources */, - 428D034D18482DA700303ED4 /* NSObject_KVCUndefined.m in Sources */, - 420D1AD1165BF54D0097EE03 /* NSString+isNumber.m in Sources */, - 42BA0C3616707B2C0066DD1A /* NSString+urlValue.m in Sources */, - 420D1AD3165BF54D0097EE03 /* NSString+numberValue.m in Sources */, - 420D1ACF165BF54D0097EE03 /* NSString+dataValue.m in Sources */, - 42DFF308165DFBE6003F26DA /* NSData+stringValue.m in Sources */, - 420D1AD5165BF54D0097EE03 /* NSString+plistValue.m in Sources */, - 420D1ACD165BF54D0097EE03 /* NSDictionary+plistValue.m in Sources */, - 4202873416CC241600F2C92A /* NSString+dateValue.m in Sources */, - 4202873816CC245E00F2C92A /* NSDate+stringValue.m in Sources */, - 42877CB1183DAC4100967368 /* NSObject+associatedObject.m in Sources */, - 42877CB3183DAC4100967368 /* NSObject+DeallocListener.m in Sources */, - 4205F9FB1851329100051E68 /* TXBTree.m in Sources */, - 42877CB5183DAC4100967368 /* NSObject+invocationForSelector.m in Sources */, - 42877CBB183DB08900967368 /* NSObject+invokeSafely.m in Sources */, + 42352D671877E46C0011CA48 /* TXMutableWeakArray.m in Sources */, + 42352D691877E46C0011CA48 /* TXMutableWeakDictionary.m in Sources */, + 42352D6A1877E4AF0011CA48 /* NSDictionary+entrySet.m in Sources */, + 42352D6B1877E4AF0011CA48 /* NSMapTable+objectForKeyedSubscript.m in Sources */, + 42352D6C1877E4AF0011CA48 /* TXBijectiveDictionary.m in Sources */, + 42352D6D1877E4AF0011CA48 /* TXBTree.m in Sources */, + 42352D6E1877E4AF0011CA48 /* NSObject+abstractClass.m in Sources */, + 42352D6F1877E4AF0011CA48 /* NSObject+abstractProtocolConformer.m in Sources */, + 42352D701877E4AF0011CA48 /* NSObject+supersequentImplementation.m in Sources */, + 42352D711877E4AF0011CA48 /* NSObject_Singleton.m in Sources */, + 42352D721877E4AF0011CA48 /* NSNull+nullForProtocol.m in Sources */, + 42352D731877E4AF0011CA48 /* NSObject+methodDescriptionForSelectorInProtocol.m in Sources */, + 42352D741877E4AF0011CA48 /* NSObject_ProtocolConformer.m in Sources */, + 42352D751877E4AF0011CA48 /* NSString+characterAtIndexSubscript.m in Sources */, + 42352D761877E4AF0011CA48 /* NSString+firstLetterCaseString.m in Sources */, + 42352D771877E4AF0011CA48 /* NSString+isEqualToStringIgnoreCase.m in Sources */, + 42352D781877E4AF0011CA48 /* NSString+random.m in Sources */, + 42352D791877E4AF0011CA48 /* NSNotificationCenter+errorCenter.m in Sources */, + 42352D7A1877E4AF0011CA48 /* NSObject+isNull.m in Sources */, + 42352D7B1877E4AF0011CA48 /* NSString+isEmpty.m in Sources */, + 42352D7C1877E4AF0011CA48 /* NSArray+orNull.m in Sources */, + 42352D7D1877E4AF0011CA48 /* NSString+orNull.m in Sources */, + 42352D7E1877E4AF0011CA48 /* NSObject_KVCArrayForwarding.m in Sources */, + 42352D7F1877E4AF0011CA48 /* NSObject_KVCUndefined.m in Sources */, + 42352D801877E4AF0011CA48 /* NSString+isNumber.m in Sources */, + 42352D811877E4AF0011CA48 /* NSString+urlValue.m in Sources */, + 42352D821877E4AF0011CA48 /* NSString+numberValue.m in Sources */, + 42352D831877E4AF0011CA48 /* NSString+dataValue.m in Sources */, + 42352D841877E4AF0011CA48 /* NSData+stringValue.m in Sources */, + 42352D851877E4AF0011CA48 /* NSString+plistValue.m in Sources */, + 42352D861877E4AF0011CA48 /* NSDictionary+plistValue.m in Sources */, + 42352D871877E4AF0011CA48 /* NSString+dateValue.m in Sources */, + 42352D881877E4AF0011CA48 /* NSDate+stringValue.m in Sources */, + 42352D891877E4AF0011CA48 /* NSObject+associatedObject.m in Sources */, + 42352D8A1877E4AF0011CA48 /* NSObject+DeallocListener.m in Sources */, + 42352D8B1877E4AF0011CA48 /* NSObject+invocationForSelector.m in Sources */, + 42352D8C1877E4AF0011CA48 /* NSObject+invokeSafely.m in Sources */, + 42352D8D1877E4AF0011CA48 /* TXZeroingWeakProxy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/TypeExtensions/Collection Extensions/Collection.h b/TypeExtensions/Collection Extensions/Collection.h index 0635047..927be10 100644 --- a/TypeExtensions/Collection Extensions/Collection.h +++ b/TypeExtensions/Collection Extensions/Collection.h @@ -7,10 +7,6 @@ // #import "NSDictionary+entrySet.h" -#import "NSDictionaryEntrySetEntry.h" #import "NSMapTable+objectForKeyedSubscript.h" -#import "NSMutableArray_NonRetaining_Zeroing.h" -#import "NSMutableDictionary_NonRetaining_Zeroing.h" -#import "NSDictionary_BinarySearchTree.h"#import "TXMutableWeakArray.h" -#import "TXMutableWeakDictionary.h" -#import "TXMutableBTreeDictionary.h" \ No newline at end of file +#import "TXMutableWeakArray.h" +#import "TXMutableWeakDictionary.h" \ No newline at end of file diff --git a/TypeExtensions/Collection Extensions/NSArrayMutable_NonRetaining_Zeroing+Private.h b/TypeExtensions/Collection Extensions/NSArrayMutable_NonRetaining_Zeroing+Private.h deleted file mode 100644 index 1215200..0000000 --- a/TypeExtensions/Collection Extensions/NSArrayMutable_NonRetaining_Zeroing+Private.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// NSArray_NonRetaining_Zeroing_Private.h -// TypeExtensions -// -// Created by Ethan Reesor on 8/24/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import "NSArray_NonRetaining_Zeroing.h" - -@protocol __NSArray_NonRetaining_Zeroing__Container - -- (id)object; - -@end - -@interface NSArray_NonRetaining_Zeroing () - -+ (id)nonRetainingZeroingEntityForObject:(id)object; -+ (void)nonRetainingZeroingEntities:(id **)entities forObjects:(const id [])objects count:(NSUInteger)cnt; - -@end diff --git a/TypeExtensions/Design Pattern Extensions/NSObject+abstractProtocolConformer.m b/TypeExtensions/Design Pattern Extensions/NSObject+abstractProtocolConformer.m index 901776f..9f8a1bd 100644 --- a/TypeExtensions/Design Pattern Extensions/NSObject+abstractProtocolConformer.m +++ b/TypeExtensions/Design Pattern Extensions/NSObject+abstractProtocolConformer.m @@ -15,14 +15,26 @@ #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation" @implementation NSObject (abstractProtocolConformer) + - (void)doesNotRecognizeSelector:(SEL)aSelector { - unsigned int count = 0; - Protocol ** protocols = class_copyProtocolList([self class], &count); - for (unsigned int i = 0; i < count; i++) - if (!isNullMethodDescription([[self class] methodDescriptionForSelector:aSelector inProtocol:protocols[i]])) - @throw [[self class] _subclassImplementationExceptionFromMethod:aSelector isClassMethod:NO]; + Class class = self.class; + + do { + unsigned int count = 0, i; + Protocol * __unsafe_unretained * list = class_copyProtocolList(class, &count); + + for (i = 0; i < count; i++) + if (!isNullMethodDescription([class methodDescriptionForSelector:aSelector inProtocol:list[i]])) + goto throw; + + free(list); + } while ((class = class.superclass)); + __supersInvoke(aSelector); + +throw: + @throw [[self class] _subclassImplementationExceptionFromMethod:aSelector isClassMethod:NO]; } @end diff --git a/TypeExtensions/Design Pattern Extensions/NSObject_Singleton.m b/TypeExtensions/Design Pattern Extensions/NSObject_Singleton.m index 5e88a2b..d035528 100644 --- a/TypeExtensions/Design Pattern Extensions/NSObject_Singleton.m +++ b/TypeExtensions/Design Pattern Extensions/NSObject_Singleton.m @@ -8,11 +8,20 @@ #import "NSObject_Singleton.h" +#import "NSObject+associatedObject.h" + +#define kSingletonKey "com.firelizzard.TypeExtensions.Misc.Singleton.key" + @implementation NSObject_Singleton + (id)sharedInstance { - return [[super allocWithZone:NULL] init]; + id shared = [self associatedObjectForKey:kSingletonKey]; + + if (!shared) + [self setAssociatedObject:(shared = [[super allocWithZone:NULL] init]) forKey:kSingletonKey]; + + return shared; } + (id)allocWithZone:(NSZone *)zone @@ -24,19 +33,4 @@ - (id)copyWithZone:(NSZone *)zone { return self; } -- (id)retain -{ - return self; -} - -- (id)autorelease -{ - return self; -} - -- (oneway void)release -{ - // don't release -} - @end diff --git a/TypeExtensions/Other Extensions/Misc.h b/TypeExtensions/Other Extensions/Misc.h index a7eabac..27f5655 100644 --- a/TypeExtensions/Other Extensions/Misc.h +++ b/TypeExtensions/Other Extensions/Misc.h @@ -9,5 +9,6 @@ #import "NSObject+associatedObject.h" #import "NSObject+invocationForSelector.h" #import "NSObject+DeallocListener.h" -#import "NSObject+zeroingWeakReferenceProxy.h" -#import "NSObject+invokeSafely.h" \ No newline at end of file +#import "TXZeroingWeakProxy.h" +#import "NSObject+invokeSafely.h" +#import "NSObject_Singleton.h" \ No newline at end of file diff --git a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h new file mode 100644 index 0000000..26a8751 --- /dev/null +++ b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h @@ -0,0 +1,19 @@ +// +// TXZeroingWeakProxy.h +// TypeExtensions +// +// Created by Ethan Reesor on 1/4/14. +// Copyright (c) 2014 Lens Flare. All rights reserved. +// + +#import + +@interface TXZeroingWeakProxy : NSProxy + ++ (instancetype)proxyWithReference:(NSObject *)object; +- (id)initWithReference:(NSObject *)object; + +@property (weak, readonly) NSObject * ref; +@property (readonly) Class refClass; + +@end diff --git a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m new file mode 100644 index 0000000..b68724a --- /dev/null +++ b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m @@ -0,0 +1,18 @@ +// +// TXZeroingWeakProxy.m +// TypeExtensions +// +// Created by Ethan Reesor on 1/4/14. +// Copyright (c) 2014 Lens Flare. All rights reserved. +// + +#import "TXZeroingWeakProxy.h" + +@implementation TXZeroingWeakProxy + ++ (instancetype)proxyWithReference:(NSObject *)object +{ + return [[[self alloc] initWithReference:object] autorelease]; +} + +@end diff --git a/TypeExtensions/TypeExtensions-Info.plist b/TypeExtensions/TypeExtensions-Info.plist index 409a09b..315d081 100644 --- a/TypeExtensions/TypeExtensions-Info.plist +++ b/TypeExtensions/TypeExtensions-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 108 + 115 NSHumanReadableCopyright Copyright © 2012 Lens Flare. Some rights reserved, see license. NSPrincipalClass diff --git a/TypeExtensionsTests/TECollectionTests.m b/TypeExtensionsTests/TECollectionTests.m index a06e97d..8b73237 100644 --- a/TypeExtensionsTests/TECollectionTests.m +++ b/TypeExtensionsTests/TECollectionTests.m @@ -8,8 +8,6 @@ #import #import -#import -#import #import "Dummy.h" @@ -19,64 +17,64 @@ @interface TECollectionTests : XCTestCase @implementation TECollectionTests -- (void)testEntrySet -{ - NSDictionary * dictionary = @{ @(1) : @"One", @(2) : @"Two" }; - - NSSet * entries = [dictionary entrySet]; - - NSMutableSet * test = [NSMutableSet setWithCapacity:dictionary.count]; - [test addObject:[NSDictionaryEntrySetEntry dictionaryEntryWithKey:@(1) forDictionary:dictionary]]; - [test addObject:[NSDictionaryEntrySetEntry dictionaryEntryWithKey:@(2) forDictionary:dictionary]]; - - // BUG: for some reason [entries isEqual:test] doesn't work... - for (id obj in test) - if (![entries.allObjects containsObject:obj]) - XCTFail(@"Sets are not equal"); - - for (NSDictionaryEntrySetEntry * entry in entries) { - if ([@(1) isEqual:entry.key]) { - if (![dictionary[@(1)] isEqual:entry.object]) - XCTFail(@"Entry set is bad"); - } else if ([@(2) isEqual:entry.key]) { - if (![dictionary[@(2)] isEqual:entry.object]) - XCTFail(@"Entry set is bad"); - } - } -} - -- (void)testNonRetainingZeroingArray -{ - NSObject * obj = [[Dummy alloc] init]; - - TXMutableWeakArray * arr = [TXMutableWeakArray array]; - - [arr addObject:obj]; - - if (!arr.count) - XCTFail(@"Array does not contain object"); - - [obj release]; - - if (arr.count) - XCTFail(@"Array contains object after it's release"); -} - -- (void)testNonRetainingZeroingDictionary -{ - NSObject * obj = [[Dummy alloc] init]; - - TXMutableWeakDictionary * dict = [TXMutableWeakDictionary dictionary]; - - dict[@(1)] = obj; - - if (!dict.count) - XCTFail(@"Array does not contain object"); - - [obj release]; - - if (dict.count) - XCTFail(@"Array contains object after it's release"); -} +//- (void)testEntrySet +//{ +// NSDictionary * dictionary = @{ @(1) : @"One", @(2) : @"Two" }; +// +// NSSet * entries = [dictionary entrySet]; +// +// NSMutableSet * test = [NSMutableSet setWithCapacity:dictionary.count]; +// [test addObject:[NSDictionaryEntrySetEntry dictionaryEntryWithKey:@(1) forDictionary:dictionary]]; +// [test addObject:[NSDictionaryEntrySetEntry dictionaryEntryWithKey:@(2) forDictionary:dictionary]]; +// +// // BUG: for some reason [entries isEqual:test] doesn't work... +// for (id obj in test) +// if (![entries.allObjects containsObject:obj]) +// XCTFail(@"Sets are not equal"); +// +// for (NSDictionaryEntrySetEntry * entry in entries) { +// if ([@(1) isEqual:entry.key]) { +// if (![dictionary[@(1)] isEqual:entry.object]) +// XCTFail(@"Entry set is bad"); +// } else if ([@(2) isEqual:entry.key]) { +// if (![dictionary[@(2)] isEqual:entry.object]) +// XCTFail(@"Entry set is bad"); +// } +// } +//} +// +//- (void)testNonRetainingZeroingArray +//{ +// NSObject * obj = [[Dummy alloc] init]; +// +// TXMutableWeakArray * arr = [TXMutableWeakArray array]; +// +// [arr addObject:obj]; +// +// if (!arr.count) +// XCTFail(@"Array does not contain object"); +// +// [obj release]; +// +// if (arr.count) +// XCTFail(@"Array contains object after it's release"); +//} +// +//- (void)testNonRetainingZeroingDictionary +//{ +// NSObject * obj = [[Dummy alloc] init]; +// +// TXMutableWeakDictionary * dict = [TXMutableWeakDictionary dictionary]; +// +// dict[@(1)] = obj; +// +// if (!dict.count) +// XCTFail(@"Array does not contain object"); +// +// [obj release]; +// +// if (dict.count) +// XCTFail(@"Array contains object after it's release"); +//} @end diff --git a/TypeExtensionsTests/TEMiscTests.m b/TypeExtensionsTests/TEMiscTests.m index 5b6a978..0e1c2c6 100644 --- a/TypeExtensionsTests/TEMiscTests.m +++ b/TypeExtensionsTests/TEMiscTests.m @@ -141,4 +141,14 @@ - (void)testBadTypes @catch (NSException *exception) { } } +- (void)testSingleton +{ + id s1 = [NSObject_Singleton sharedInstance]; + id s2 = [s1 copyWithZone:[self zone]]; + id s3 = [[NSObject_Singleton allocWithZone:[self zone]] init]; + + if (s1 != s2 || s2 != s3) + XCTFail(@"Sington pattern broken"); +} + @end \ No newline at end of file From 05180ec19457f5d23c5dec813c2eb5e16d1bffc7 Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 21:41:57 -0500 Subject: [PATCH 04/13] Moving BTree stuff to branch (1/2) --- TypeExtensions.xcodeproj/project.pbxproj | 16 ---- .../Collection Extensions/TXBTree.h | 24 ------ .../Collection Extensions/TXBTree.m | 77 ------------------- .../TXBijectiveDictionary.h | 13 ---- .../TXBijectiveDictionary.m | 13 ---- 5 files changed, 143 deletions(-) delete mode 100644 TypeExtensions/Collection Extensions/TXBTree.h delete mode 100644 TypeExtensions/Collection Extensions/TXBTree.m delete mode 100644 TypeExtensions/Collection Extensions/TXBijectiveDictionary.h delete mode 100644 TypeExtensions/Collection Extensions/TXBijectiveDictionary.m diff --git a/TypeExtensions.xcodeproj/project.pbxproj b/TypeExtensions.xcodeproj/project.pbxproj index 045ab03..b21f385 100644 --- a/TypeExtensions.xcodeproj/project.pbxproj +++ b/TypeExtensions.xcodeproj/project.pbxproj @@ -21,8 +21,6 @@ 42026AEC183EA16500B1F530 /* TypeExtensions.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 420D1A9C165BF5020097EE03 /* TypeExtensions.framework */; }; 4202873316CC241600F2C92A /* NSString+dateValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4202873116CC241600F2C92A /* NSString+dateValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4202873716CC245E00F2C92A /* NSDate+stringValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4202873516CC245E00F2C92A /* NSDate+stringValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4205F9FA1851329100051E68 /* TXBTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 4205F9F81851329100051E68 /* TXBTree.h */; }; - 420952B0185054CF006E904A /* TXBijectiveDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 420952AE185054CF006E904A /* TXBijectiveDictionary.h */; }; 420D1AA0165BF5020097EE03 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 420D1A9F165BF5020097EE03 /* Cocoa.framework */; }; 420D1AAA165BF5020097EE03 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 420D1AA8165BF5020097EE03 /* InfoPlist.strings */; }; 420D1AC6165BF54D0097EE03 /* NSArray+orNull.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AB5165BF54D0097EE03 /* NSArray+orNull.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -41,8 +39,6 @@ 42352D691877E46C0011CA48 /* TXMutableWeakDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D651877E46C0011CA48 /* TXMutableWeakDictionary.m */; }; 42352D6A1877E4AF0011CA48 /* NSDictionary+entrySet.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C5D17C93855007AAB83 /* NSDictionary+entrySet.m */; }; 42352D6B1877E4AF0011CA48 /* NSMapTable+objectForKeyedSubscript.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */; }; - 42352D6C1877E4AF0011CA48 /* TXBijectiveDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 420952AF185054CF006E904A /* TXBijectiveDictionary.m */; }; - 42352D6D1877E4AF0011CA48 /* TXBTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 4205F9F91851329100051E68 /* TXBTree.m */; }; 42352D6E1877E4AF0011CA48 /* NSObject+abstractClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DB17C932F50045A398 /* NSObject+abstractClass.m */; }; 42352D6F1877E4AF0011CA48 /* NSObject+abstractProtocolConformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DD17C932F50045A398 /* NSObject+abstractProtocolConformer.m */; }; 42352D701877E4AF0011CA48 /* NSObject+supersequentImplementation.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DF17C932F50045A398 /* NSObject+supersequentImplementation.m */; }; @@ -129,10 +125,6 @@ 4202873216CC241600F2C92A /* NSString+dateValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+dateValue.m"; sourceTree = ""; }; 4202873516CC245E00F2C92A /* NSDate+stringValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+stringValue.h"; sourceTree = ""; }; 4202873616CC245E00F2C92A /* NSDate+stringValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+stringValue.m"; sourceTree = ""; }; - 4205F9F81851329100051E68 /* TXBTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXBTree.h; sourceTree = ""; }; - 4205F9F91851329100051E68 /* TXBTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXBTree.m; sourceTree = ""; }; - 420952AE185054CF006E904A /* TXBijectiveDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXBijectiveDictionary.h; sourceTree = ""; }; - 420952AF185054CF006E904A /* TXBijectiveDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXBijectiveDictionary.m; sourceTree = ""; }; 420D1A9C165BF5020097EE03 /* TypeExtensions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TypeExtensions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 420D1A9F165BF5020097EE03 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 420D1AA2165BF5020097EE03 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; @@ -392,10 +384,6 @@ 42352D631877E46C0011CA48 /* TXMutableWeakArray.m */, 42352D641877E46C0011CA48 /* TXMutableWeakDictionary.h */, 42352D651877E46C0011CA48 /* TXMutableWeakDictionary.m */, - 420952AE185054CF006E904A /* TXBijectiveDictionary.h */, - 420952AF185054CF006E904A /* TXBijectiveDictionary.m */, - 4205F9F81851329100051E68 /* TXBTree.h */, - 4205F9F91851329100051E68 /* TXBTree.m */, ); path = "Collection Extensions"; sourceTree = ""; @@ -527,7 +515,6 @@ 42AC0B1B165CA111002E846E /* TypeExtensions.h in Headers */, 42719C6517C9386A007AAB83 /* Collection.h in Headers */, 42719C6017C93855007AAB83 /* NSDictionary+entrySet.h in Headers */, - 4205F9FA1851329100051E68 /* TXBTree.h in Headers */, 42719C5317C935A6007AAB83 /* Design.h in Headers */, 427307F017C932F50045A398 /* NSObject+abstractClass.h in Headers */, 427307F217C932F50045A398 /* NSObject+abstractProtocolConformer.h in Headers */, @@ -561,7 +548,6 @@ 420D1ACE165BF54D0097EE03 /* NSString+dataValue.h in Headers */, 42DFF307165DFBE6003F26DA /* NSData+stringValue.h in Headers */, 420D1AD4165BF54D0097EE03 /* NSString+plistValue.h in Headers */, - 420952B0185054CF006E904A /* TXBijectiveDictionary.h in Headers */, 420D1ACC165BF54D0097EE03 /* NSDictionary+plistValue.h in Headers */, 4202873316CC241600F2C92A /* NSString+dateValue.h in Headers */, 4202873716CC245E00F2C92A /* NSDate+stringValue.h in Headers */, @@ -711,8 +697,6 @@ 42352D691877E46C0011CA48 /* TXMutableWeakDictionary.m in Sources */, 42352D6A1877E4AF0011CA48 /* NSDictionary+entrySet.m in Sources */, 42352D6B1877E4AF0011CA48 /* NSMapTable+objectForKeyedSubscript.m in Sources */, - 42352D6C1877E4AF0011CA48 /* TXBijectiveDictionary.m in Sources */, - 42352D6D1877E4AF0011CA48 /* TXBTree.m in Sources */, 42352D6E1877E4AF0011CA48 /* NSObject+abstractClass.m in Sources */, 42352D6F1877E4AF0011CA48 /* NSObject+abstractProtocolConformer.m in Sources */, 42352D701877E4AF0011CA48 /* NSObject+supersequentImplementation.m in Sources */, diff --git a/TypeExtensions/Collection Extensions/TXBTree.h b/TypeExtensions/Collection Extensions/TXBTree.h deleted file mode 100644 index 743be02..0000000 --- a/TypeExtensions/Collection Extensions/TXBTree.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// TXBTree.h -// TypeExtensions -// -// Created by Ethan Reesor on 12/5/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import - -@interface TXBTree : NSDictionary - -@property (retain) id key, - object; -@property (readonly) NSUInteger count; -@property (copy) NSComparator comparator; -@property (retain) TXBTree * parent, - * left, - * right; - -+ (instancetype)treeWithComparator:(NSComparator)comparator forObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt; -- (id)initWithComparator:(NSComparator)comparator forObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt; - -@end diff --git a/TypeExtensions/Collection Extensions/TXBTree.m b/TypeExtensions/Collection Extensions/TXBTree.m deleted file mode 100644 index 94ba27d..0000000 --- a/TypeExtensions/Collection Extensions/TXBTree.m +++ /dev/null @@ -1,77 +0,0 @@ -// -// TXBTree.m -// TypeExtensions -// -// Created by Ethan Reesor on 12/5/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import "TXBTree.h" - -@implementation TXBTree - -+ (instancetype)treeWithComparator:(NSComparator)comparator forObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt -{ - return [[[self alloc] initWithComparator:comparator forObjects:objects forKeys:keys count:cnt] autorelease]; -} - -- (id)initWithComparator:(NSComparator)comparator forObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt -{ - comparator = Block_copy(comparator); - self = [self initWithParent:nil andComparator:comparator forObjects:objects forKeys:keys count:cnt]; - Block_release(comparator); - return self; -} - -- (id)initWithParent:(TXBTree *)parent andComparator:(NSComparator)comparator forObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt -{ - if (!(self = [super init])) - return nil; - - if (!cnt) - return nil; - - _comparator = [comparator retain]; - _parent = [parent retain]; - _count = cnt; - - NSUInteger count = cnt / 2; - if (count) { - _left = [[self.class alloc] initWithParent:self andComparator:comparator forObjects:objects forKeys:keys count:count]; - objects += count; - keys += count; - cnt -= count; - } - - _object = [objects++[0] retain]; - _key = [keys++[0] retain]; - cnt--; - - if (cnt) - _right = [[self.class alloc] initWithParent:self andComparator:comparator forObjects:objects forKeys:keys count:cnt]; - - [self.parent addObserver:self forKeyPath:@"comparator" options:NSKeyValueObservingOptionNew context:nil]; - [self.left addObserver:self forKeyPath:@"count" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; - [self.right addObserver:self forKeyPath:@"count" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; - - return self; -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context -{ - if ([@"comparator" isEqualToString:keyPath]) { - [self willChangeValueForKey:@"comparator"]; - _comparator = change[NSKeyValueChangeNewKey]; - [self didChangeValueForKey:@"comparator"]; - return; - } - - if ([@"count" isEqualToString:keyPath]) { - [self willChangeValueForKey:@"count"]; - _count = [change[NSKeyValueChangeNewKey] unsignedIntegerValue] - [change[NSKeyValueChangeOldKey] unsignedIntegerValue]; - [self didChangeValueForKey:@"count"]; - return; - } -} - -@end diff --git a/TypeExtensions/Collection Extensions/TXBijectiveDictionary.h b/TypeExtensions/Collection Extensions/TXBijectiveDictionary.h deleted file mode 100644 index 0cc85c4..0000000 --- a/TypeExtensions/Collection Extensions/TXBijectiveDictionary.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// TXBijectiveDictionary.h -// TypeExtensions -// -// Created by Ethan Reesor on 12/5/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import - -@interface TXBijectiveDictionary : NSDictionary - -@end diff --git a/TypeExtensions/Collection Extensions/TXBijectiveDictionary.m b/TypeExtensions/Collection Extensions/TXBijectiveDictionary.m deleted file mode 100644 index 61b6fc0..0000000 --- a/TypeExtensions/Collection Extensions/TXBijectiveDictionary.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// TXBijectiveDictionary.m -// TypeExtensions -// -// Created by Ethan Reesor on 12/5/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import "TXBijectiveDictionary.h" - -@implementation TXBijectiveDictionary - -@end From fed2d983111a31b55549ed78f256fad5ddb3e1a6 Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 21:44:33 -0500 Subject: [PATCH 05/13] Moving proxy stuff to branch (1/2) --- TypeExtensions.xcodeproj/project.pbxproj | 8 -------- .../Other Extensions/TXZeroingWeakProxy.h | 19 ------------------- .../Other Extensions/TXZeroingWeakProxy.m | 18 ------------------ 3 files changed, 45 deletions(-) delete mode 100644 TypeExtensions/Other Extensions/TXZeroingWeakProxy.h delete mode 100644 TypeExtensions/Other Extensions/TXZeroingWeakProxy.m diff --git a/TypeExtensions.xcodeproj/project.pbxproj b/TypeExtensions.xcodeproj/project.pbxproj index b21f385..d29f05b 100644 --- a/TypeExtensions.xcodeproj/project.pbxproj +++ b/TypeExtensions.xcodeproj/project.pbxproj @@ -32,7 +32,6 @@ 420D1AD2165BF54D0097EE03 /* NSString+numberValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AC2165BF54D0097EE03 /* NSString+numberValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 420D1AD4165BF54D0097EE03 /* NSString+plistValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AC4165BF54D0097EE03 /* NSString+plistValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42352D3518765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42352D601877DC700011CA48 /* TXZeroingWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D5E1877DC700011CA48 /* TXZeroingWeakProxy.h */; }; 42352D661877E46C0011CA48 /* TXMutableWeakArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D621877E46C0011CA48 /* TXMutableWeakArray.h */; }; 42352D671877E46C0011CA48 /* TXMutableWeakArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D631877E46C0011CA48 /* TXMutableWeakArray.m */; }; 42352D681877E46C0011CA48 /* TXMutableWeakDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D641877E46C0011CA48 /* TXMutableWeakDictionary.h */; }; @@ -70,7 +69,6 @@ 42352D8A1877E4AF0011CA48 /* NSObject+DeallocListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CA8183DAC4100967368 /* NSObject+DeallocListener.m */; }; 42352D8B1877E4AF0011CA48 /* NSObject+invocationForSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */; }; 42352D8C1877E4AF0011CA48 /* NSObject+invokeSafely.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CB9183DB08900967368 /* NSObject+invokeSafely.m */; }; - 42352D8D1877E4AF0011CA48 /* TXZeroingWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D5F1877DC700011CA48 /* TXZeroingWeakProxy.m */; }; 42719C5317C935A6007AAB83 /* Design.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C5117C9343C007AAB83 /* Design.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42719C5417C935A9007AAB83 /* Protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C5017C933F8007AAB83 /* Protocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42719C5517C935AB007AAB83 /* String.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C4F17C933AC007AAB83 /* String.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -152,8 +150,6 @@ 420D1AC5165BF54D0097EE03 /* NSString+plistValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+plistValue.m"; sourceTree = ""; }; 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMapTable+objectForKeyedSubscript.h"; sourceTree = ""; }; 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMapTable+objectForKeyedSubscript.m"; sourceTree = ""; }; - 42352D5E1877DC700011CA48 /* TXZeroingWeakProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXZeroingWeakProxy.h; sourceTree = ""; }; - 42352D5F1877DC700011CA48 /* TXZeroingWeakProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXZeroingWeakProxy.m; sourceTree = ""; }; 42352D621877E46C0011CA48 /* TXMutableWeakArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXMutableWeakArray.h; sourceTree = ""; }; 42352D631877E46C0011CA48 /* TXMutableWeakArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXMutableWeakArray.m; sourceTree = ""; }; 42352D641877E46C0011CA48 /* TXMutableWeakDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXMutableWeakDictionary.h; sourceTree = ""; }; @@ -476,8 +472,6 @@ 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */, 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */, 42877CB9183DB08900967368 /* NSObject+invokeSafely.m */, - 42352D5E1877DC700011CA48 /* TXZeroingWeakProxy.h */, - 42352D5F1877DC700011CA48 /* TXZeroingWeakProxy.m */, ); path = "Other Extensions"; sourceTree = ""; @@ -511,7 +505,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 42352D601877DC700011CA48 /* TXZeroingWeakProxy.h in Headers */, 42AC0B1B165CA111002E846E /* TypeExtensions.h in Headers */, 42719C6517C9386A007AAB83 /* Collection.h in Headers */, 42719C6017C93855007AAB83 /* NSDictionary+entrySet.h in Headers */, @@ -728,7 +721,6 @@ 42352D8A1877E4AF0011CA48 /* NSObject+DeallocListener.m in Sources */, 42352D8B1877E4AF0011CA48 /* NSObject+invocationForSelector.m in Sources */, 42352D8C1877E4AF0011CA48 /* NSObject+invokeSafely.m in Sources */, - 42352D8D1877E4AF0011CA48 /* TXZeroingWeakProxy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h deleted file mode 100644 index 26a8751..0000000 --- a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// TXZeroingWeakProxy.h -// TypeExtensions -// -// Created by Ethan Reesor on 1/4/14. -// Copyright (c) 2014 Lens Flare. All rights reserved. -// - -#import - -@interface TXZeroingWeakProxy : NSProxy - -+ (instancetype)proxyWithReference:(NSObject *)object; -- (id)initWithReference:(NSObject *)object; - -@property (weak, readonly) NSObject * ref; -@property (readonly) Class refClass; - -@end diff --git a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m deleted file mode 100644 index b68724a..0000000 --- a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// TXZeroingWeakProxy.m -// TypeExtensions -// -// Created by Ethan Reesor on 1/4/14. -// Copyright (c) 2014 Lens Flare. All rights reserved. -// - -#import "TXZeroingWeakProxy.h" - -@implementation TXZeroingWeakProxy - -+ (instancetype)proxyWithReference:(NSObject *)object -{ - return [[[self alloc] initWithReference:object] autorelease]; -} - -@end From 503c54d7718d55f71cadcef63129aec0c2380e89 Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 21:45:08 -0500 Subject: [PATCH 06/13] Moving proxy stuff to branch (2/2) --- TypeExtensions.xcodeproj/project.pbxproj | 8 ++++++++ .../Other Extensions/TXZeroingWeakProxy.h | 13 +++++++++++++ .../Other Extensions/TXZeroingWeakProxy.m | 13 +++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 TypeExtensions/Other Extensions/TXZeroingWeakProxy.h create mode 100644 TypeExtensions/Other Extensions/TXZeroingWeakProxy.m diff --git a/TypeExtensions.xcodeproj/project.pbxproj b/TypeExtensions.xcodeproj/project.pbxproj index d29f05b..ac8597a 100644 --- a/TypeExtensions.xcodeproj/project.pbxproj +++ b/TypeExtensions.xcodeproj/project.pbxproj @@ -98,6 +98,8 @@ 4290F08C1849A31400C67769 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 4290F08A1849A31400C67769 /* LICENSE */; }; 4290F08D1849A31400C67769 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 4290F08B1849A31400C67769 /* README.md */; }; 4291FF3816C57EA4000538EF /* NSString+orNull.h in Headers */ = {isa = PBXBuildFile; fileRef = 4291FF3616C57EA4000538EF /* NSString+orNull.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 429CE069188F682C00FF0113 /* TXZeroingWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 429CE067188F682C00FF0113 /* TXZeroingWeakProxy.h */; }; + 429CE06A188F682C00FF0113 /* TXZeroingWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 429CE068188F682C00FF0113 /* TXZeroingWeakProxy.m */; }; 42AC0B19165CA0B2002E846E /* Null.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AC0B16165C9FBB002E846E /* Null.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42AC0B1B165CA111002E846E /* TypeExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AAC165BF5020097EE03 /* TypeExtensions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42BA0C3516707B2C0066DD1A /* NSString+urlValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 42BA0C3316707B2C0066DD1A /* NSString+urlValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -218,6 +220,8 @@ 4290F08E1849A32600C67769 /* .travis.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .travis.yml; sourceTree = ""; }; 4291FF3616C57EA4000538EF /* NSString+orNull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+orNull.h"; sourceTree = ""; }; 4291FF3716C57EA4000538EF /* NSString+orNull.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+orNull.m"; sourceTree = ""; }; + 429CE067188F682C00FF0113 /* TXZeroingWeakProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXZeroingWeakProxy.h; sourceTree = ""; }; + 429CE068188F682C00FF0113 /* TXZeroingWeakProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXZeroingWeakProxy.m; sourceTree = ""; }; 42AC0B16165C9FBB002E846E /* Null.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Null.h; sourceTree = ""; }; 42BA0C3316707B2C0066DD1A /* NSString+urlValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+urlValue.h"; sourceTree = ""; }; 42BA0C3416707B2C0066DD1A /* NSString+urlValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+urlValue.m"; sourceTree = ""; }; @@ -472,6 +476,8 @@ 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */, 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */, 42877CB9183DB08900967368 /* NSObject+invokeSafely.m */, + 429CE067188F682C00FF0113 /* TXZeroingWeakProxy.h */, + 429CE068188F682C00FF0113 /* TXZeroingWeakProxy.m */, ); path = "Other Extensions"; sourceTree = ""; @@ -549,6 +555,7 @@ 42877CB2183DAC4100967368 /* NSObject+DeallocListener.h in Headers */, 42877CB4183DAC4100967368 /* NSObject+invocationForSelector.h in Headers */, 42352D3518765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h in Headers */, + 429CE069188F682C00FF0113 /* TXZeroingWeakProxy.h in Headers */, 42877CBA183DB08900967368 /* NSObject+invokeSafely.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -705,6 +712,7 @@ 42352D7A1877E4AF0011CA48 /* NSObject+isNull.m in Sources */, 42352D7B1877E4AF0011CA48 /* NSString+isEmpty.m in Sources */, 42352D7C1877E4AF0011CA48 /* NSArray+orNull.m in Sources */, + 429CE06A188F682C00FF0113 /* TXZeroingWeakProxy.m in Sources */, 42352D7D1877E4AF0011CA48 /* NSString+orNull.m in Sources */, 42352D7E1877E4AF0011CA48 /* NSObject_KVCArrayForwarding.m in Sources */, 42352D7F1877E4AF0011CA48 /* NSObject_KVCUndefined.m in Sources */, diff --git a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h new file mode 100644 index 0000000..3e2aebe --- /dev/null +++ b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h @@ -0,0 +1,13 @@ +// +// TXZeroingWeakProxy.h +// TypeExtensions +// +// Created by Ethan Reesor on 1/21/14. +// Copyright (c) 2014 Lens Flare. All rights reserved. +// + +#import + +@interface TXZeroingWeakProxy : NSProxy + +@end diff --git a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m new file mode 100644 index 0000000..c1ddb05 --- /dev/null +++ b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m @@ -0,0 +1,13 @@ +// +// TXZeroingWeakProxy.m +// TypeExtensions +// +// Created by Ethan Reesor on 1/21/14. +// Copyright (c) 2014 Lens Flare. All rights reserved. +// + +#import "TXZeroingWeakProxy.h" + +@implementation TXZeroingWeakProxy + +@end From 75087500036295fed56cea802852fe0762bea5a6 Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 21:46:37 -0500 Subject: [PATCH 07/13] Moving weak collection stuff to branch (1/2) --- TypeExtensions.xcodeproj/project.pbxproj | 16 -- .../TXMutableWeakArray.h | 15 -- .../TXMutableWeakArray.m | 97 ----------- .../TXMutableWeakDictionary.h | 13 -- .../TXMutableWeakDictionary.m | 150 ------------------ 5 files changed, 291 deletions(-) delete mode 100644 TypeExtensions/Collection Extensions/TXMutableWeakArray.h delete mode 100644 TypeExtensions/Collection Extensions/TXMutableWeakArray.m delete mode 100644 TypeExtensions/Collection Extensions/TXMutableWeakDictionary.h delete mode 100644 TypeExtensions/Collection Extensions/TXMutableWeakDictionary.m diff --git a/TypeExtensions.xcodeproj/project.pbxproj b/TypeExtensions.xcodeproj/project.pbxproj index d29f05b..5389d34 100644 --- a/TypeExtensions.xcodeproj/project.pbxproj +++ b/TypeExtensions.xcodeproj/project.pbxproj @@ -32,10 +32,6 @@ 420D1AD2165BF54D0097EE03 /* NSString+numberValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AC2165BF54D0097EE03 /* NSString+numberValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 420D1AD4165BF54D0097EE03 /* NSString+plistValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AC4165BF54D0097EE03 /* NSString+plistValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42352D3518765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42352D661877E46C0011CA48 /* TXMutableWeakArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D621877E46C0011CA48 /* TXMutableWeakArray.h */; }; - 42352D671877E46C0011CA48 /* TXMutableWeakArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D631877E46C0011CA48 /* TXMutableWeakArray.m */; }; - 42352D681877E46C0011CA48 /* TXMutableWeakDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 42352D641877E46C0011CA48 /* TXMutableWeakDictionary.h */; }; - 42352D691877E46C0011CA48 /* TXMutableWeakDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D651877E46C0011CA48 /* TXMutableWeakDictionary.m */; }; 42352D6A1877E4AF0011CA48 /* NSDictionary+entrySet.m in Sources */ = {isa = PBXBuildFile; fileRef = 42719C5D17C93855007AAB83 /* NSDictionary+entrySet.m */; }; 42352D6B1877E4AF0011CA48 /* NSMapTable+objectForKeyedSubscript.m in Sources */ = {isa = PBXBuildFile; fileRef = 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */; }; 42352D6E1877E4AF0011CA48 /* NSObject+abstractClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 427307DB17C932F50045A398 /* NSObject+abstractClass.m */; }; @@ -150,10 +146,6 @@ 420D1AC5165BF54D0097EE03 /* NSString+plistValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+plistValue.m"; sourceTree = ""; }; 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMapTable+objectForKeyedSubscript.h"; sourceTree = ""; }; 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMapTable+objectForKeyedSubscript.m"; sourceTree = ""; }; - 42352D621877E46C0011CA48 /* TXMutableWeakArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXMutableWeakArray.h; sourceTree = ""; }; - 42352D631877E46C0011CA48 /* TXMutableWeakArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXMutableWeakArray.m; sourceTree = ""; }; - 42352D641877E46C0011CA48 /* TXMutableWeakDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXMutableWeakDictionary.h; sourceTree = ""; }; - 42352D651877E46C0011CA48 /* TXMutableWeakDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXMutableWeakDictionary.m; sourceTree = ""; }; 42719C4F17C933AC007AAB83 /* String.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = String.h; sourceTree = ""; }; 42719C5017C933F8007AAB83 /* Protocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Protocol.h; sourceTree = ""; }; 42719C5117C9343C007AAB83 /* Design.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Design.h; sourceTree = ""; }; @@ -376,10 +368,6 @@ 42719C5D17C93855007AAB83 /* NSDictionary+entrySet.m */, 42352D3318765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h */, 42352D3418765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.m */, - 42352D621877E46C0011CA48 /* TXMutableWeakArray.h */, - 42352D631877E46C0011CA48 /* TXMutableWeakArray.m */, - 42352D641877E46C0011CA48 /* TXMutableWeakDictionary.h */, - 42352D651877E46C0011CA48 /* TXMutableWeakDictionary.m */, ); path = "Collection Extensions"; sourceTree = ""; @@ -524,9 +512,7 @@ 42719C6C17C93B66007AAB83 /* NSString+random.h in Headers */, 428D034118482D9500303ED4 /* Notification.h in Headers */, 428D034218482D9500303ED4 /* NSNotificationCenter+errorCenter.h in Headers */, - 42352D681877E46C0011CA48 /* TXMutableWeakDictionary.h in Headers */, 42AC0B19165CA0B2002E846E /* Null.h in Headers */, - 42352D661877E46C0011CA48 /* TXMutableWeakArray.h in Headers */, 420D1AC8165BF54D0097EE03 /* NSObject+isNull.h in Headers */, 420D1ACA165BF54D0097EE03 /* NSString+isEmpty.h in Headers */, 420D1AC6165BF54D0097EE03 /* NSArray+orNull.h in Headers */, @@ -686,8 +672,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 42352D671877E46C0011CA48 /* TXMutableWeakArray.m in Sources */, - 42352D691877E46C0011CA48 /* TXMutableWeakDictionary.m in Sources */, 42352D6A1877E4AF0011CA48 /* NSDictionary+entrySet.m in Sources */, 42352D6B1877E4AF0011CA48 /* NSMapTable+objectForKeyedSubscript.m in Sources */, 42352D6E1877E4AF0011CA48 /* NSObject+abstractClass.m in Sources */, diff --git a/TypeExtensions/Collection Extensions/TXMutableWeakArray.h b/TypeExtensions/Collection Extensions/TXMutableWeakArray.h deleted file mode 100644 index 0f076bf..0000000 --- a/TypeExtensions/Collection Extensions/TXMutableWeakArray.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// NSArray_NonRetaining_Zeroing.h -// TypeExtensions -// -// Created by Ethan Reesor on 8/24/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import - -#import "NSObject+DeallocListener.h" - -@interface TXMutableWeakArray : NSMutableArray - -@end diff --git a/TypeExtensions/Collection Extensions/TXMutableWeakArray.m b/TypeExtensions/Collection Extensions/TXMutableWeakArray.m deleted file mode 100644 index 9fdc185..0000000 --- a/TypeExtensions/Collection Extensions/TXMutableWeakArray.m +++ /dev/null @@ -1,97 +0,0 @@ -// -// NSArray_NonRetaining_Zeroing.m -// TypeExtensions -// -// Created by Ethan Reesor on 8/24/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import "TXMutableWeakArray.h" - -@implementation TXMutableWeakArray { - NSMutableArray * _backing; -} - -- (id)initWithObjects:(const id [])objects count:(NSUInteger)cnt -{ - if (!(self = [super init])) - return nil; - - id entries[cnt]; - for (int i = 0; i < cnt; i++) - entries[i] = [NSValue valueWithNonretainedObject:objects[i]]; - _backing = [[NSMutableArray alloc] initWithObjects:entries count:cnt]; - - return self; -} - -- (void)dealloc -{ - [_backing release]; - - [super dealloc]; -} - -- (id)wrapAndStartNotification:(id)object -{ - if (![object isKindOfClass:NSObject.class]) - return nil; - - [(NSObject *)object addDeallocListener:self]; - return [self wrap:object]; -} - -- (id)wrap:(id)object -{ - return [NSValue valueWithNonretainedObject:object]; -} - -- (id)unwrap:(id)object -{ - if (![object isKindOfClass:NSValue.class]) - return nil; - - return ((NSValue *)object).nonretainedObjectValue; -} - -- (void)objectDidDeallocate:(id)obj -{ - [_backing removeObject:[self wrap:obj]]; -} - -- (NSUInteger)count -{ - return _backing.count; -} - -- (id)objectAtIndex:(NSUInteger)index -{ - return [self unwrap:[_backing objectAtIndex:index]]; -} - -- (void)insertObject:(id)anObject atIndex:(NSUInteger)index -{ - [_backing insertObject:[self wrapAndStartNotification:anObject] atIndex:index]; -} - -- (void)removeObjectAtIndex:(NSUInteger)index -{ - [_backing removeObjectAtIndex:index]; -} - -- (void)addObject:(id)anObject -{ - [_backing addObject:[self wrapAndStartNotification:anObject]]; -} - -- (void)removeLastObject -{ - [self removeObjectAtIndex:self.count - 1]; -} - -- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject -{ - [_backing replaceObjectAtIndex:index withObject:[self wrapAndStartNotification:anObject]]; -} - -@end diff --git a/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.h b/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.h deleted file mode 100644 index 029e808..0000000 --- a/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// NSMutableDictionary_NonRetaining_Zeroing.h -// TypeExtensions -// -// Created by Ethan Reesor on 8/24/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import - -@interface TXMutableWeakDictionary : NSMutableDictionary - -@end diff --git a/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.m b/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.m deleted file mode 100644 index 7c9d53e..0000000 --- a/TypeExtensions/Collection Extensions/TXMutableWeakDictionary.m +++ /dev/null @@ -1,150 +0,0 @@ -// -// NSMutableDictionary_NonRetaining_Zeroing.m -// TypeExtensions -// -// Created by Ethan Reesor on 8/24/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import "TXMutableWeakDictionary.h" - -#import "NSObject+DeallocListener.h" - - -@interface TXMutableWeakDictionary () - -- (void)objectDidDeallocateForKey:(id)key; - -@end - - -@interface __NSMutableDictionary_NonRetaining_Zeroing__Listener : NSObject - -@property (readonly) TXMutableWeakDictionary * dictionary; -@property (readonly) id key; -@property (readonly) id obj; - -+ (__NSMutableDictionary_NonRetaining_Zeroing__Listener *)listenerWithDictionary:(TXMutableWeakDictionary *)dict forObject:(id)obj withKey:(id)key; -- (id)initWithDictionary:(TXMutableWeakDictionary *)dict forObject:(id)obj withKey:(id)key; - -@end - - -@implementation __NSMutableDictionary_NonRetaining_Zeroing__Listener - -+ (__NSMutableDictionary_NonRetaining_Zeroing__Listener *)listenerWithDictionary:(TXMutableWeakDictionary *)dict forObject:(id)obj withKey:(id)key -{ - return [[[self alloc] initWithDictionary:dict forObject:obj withKey:key] autorelease]; -} - -- (id)initWithDictionary:(TXMutableWeakDictionary *)dict forObject:(id)obj withKey:(id)key -{ - if (!(self = [super init])) - return nil; - - if (![obj isKindOfClass:NSObject.class]) - return nil; - - _dictionary = dict.retain; - _obj = obj; - _key = key.retain; - - [self.obj addDeallocListener:self]; - - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - [NSException raise:@"Unsupported functionality" format:@"This object should not be copied"]; - return nil; -} - -- (void)dealloc -{ -// [(NSObject *)_obj stopDeallocationNotification]; - [_obj removeDeallocListener:self]; - [_dictionary release]; - [_key release]; - - [super dealloc]; -} - -- (void)objectDidDeallocate:(id)obj -{ - _obj = nil; - [self.dictionary objectDidDeallocateForKey:self.key]; -} - -@end - - -@implementation TXMutableWeakDictionary { - NSMutableDictionary * _backing; -} - -- (id)initWithObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt -{ - if (!(self = [super init])) - return nil; - - id entries[cnt]; - for (int i = 0; i < cnt; i++) - entries[i] = [__NSMutableDictionary_NonRetaining_Zeroing__Listener listenerWithDictionary:self forObject:objects[i] withKey:(id)keys[i]]; - - _backing = [[NSMutableDictionary alloc] initWithObjects:entries forKeys:keys count:cnt]; - - return self; -} - -- (void)dealloc -{ - [_backing release]; - - [super dealloc]; -} - -- (id)wrap:(id)object key:(id)key -{ - return [__NSMutableDictionary_NonRetaining_Zeroing__Listener listenerWithDictionary:self forObject:object withKey:key]; -} - -- (id)unwrap:(id)object -{ - if (![object isKindOfClass:__NSMutableDictionary_NonRetaining_Zeroing__Listener.class]) - return nil; - - return ((__NSMutableDictionary_NonRetaining_Zeroing__Listener *)object).obj; -} - -- (void)objectDidDeallocateForKey:(id)key -{ - [_backing removeObjectForKey:key]; -} - -- (NSUInteger)count -{ - return _backing.count; -} - -- (id)objectForKey:(id)aKey -{ - return [self unwrap:[_backing objectForKey:aKey]]; -} - -- (NSEnumerator *)keyEnumerator -{ - return _backing.keyEnumerator; -} - -- (void)setObject:(id)anObject forKey:(id)aKey -{ - [_backing setObject:[self wrap:anObject key:(id)aKey] forKey:aKey]; -} - -- (void)removeObjectForKey:(id)aKey -{ - [_backing removeObjectForKey:aKey]; -} - -@end From 9da21a785b2130636d1139b1ba5fb101fcd89e93 Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 21:46:56 -0500 Subject: [PATCH 08/13] Moving dealloc listener stuff to branch (1/2) --- TypeExtensions.xcodeproj/project.pbxproj | 8 - .../NSObject+DeallocListener.h | 29 --- .../NSObject+DeallocListener.m | 195 ------------------ 3 files changed, 232 deletions(-) delete mode 100644 TypeExtensions/Other Extensions/NSObject+DeallocListener.h delete mode 100644 TypeExtensions/Other Extensions/NSObject+DeallocListener.m diff --git a/TypeExtensions.xcodeproj/project.pbxproj b/TypeExtensions.xcodeproj/project.pbxproj index 5389d34..dc3dee0 100644 --- a/TypeExtensions.xcodeproj/project.pbxproj +++ b/TypeExtensions.xcodeproj/project.pbxproj @@ -62,7 +62,6 @@ 42352D871877E4AF0011CA48 /* NSString+dateValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4202873216CC241600F2C92A /* NSString+dateValue.m */; }; 42352D881877E4AF0011CA48 /* NSDate+stringValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4202873616CC245E00F2C92A /* NSDate+stringValue.m */; }; 42352D891877E4AF0011CA48 /* NSObject+associatedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CA6183DAC4100967368 /* NSObject+associatedObject.m */; }; - 42352D8A1877E4AF0011CA48 /* NSObject+DeallocListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CA8183DAC4100967368 /* NSObject+DeallocListener.m */; }; 42352D8B1877E4AF0011CA48 /* NSObject+invocationForSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */; }; 42352D8C1877E4AF0011CA48 /* NSObject+invokeSafely.m in Sources */ = {isa = PBXBuildFile; fileRef = 42877CB9183DB08900967368 /* NSObject+invokeSafely.m */; }; 42719C5317C935A6007AAB83 /* Design.h in Headers */ = {isa = PBXBuildFile; fileRef = 42719C5117C9343C007AAB83 /* Design.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -83,7 +82,6 @@ 4273080217C932F50045A398 /* NSString+isEqualToStringIgnoreCase.h in Headers */ = {isa = PBXBuildFile; fileRef = 427307EE17C932F50045A398 /* NSString+isEqualToStringIgnoreCase.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42877CAF183DAC4100967368 /* Misc.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA4183DAC4100967368 /* Misc.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42877CB0183DAC4100967368 /* NSObject+associatedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA5183DAC4100967368 /* NSObject+associatedObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42877CB2183DAC4100967368 /* NSObject+DeallocListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA7183DAC4100967368 /* NSObject+DeallocListener.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42877CB4183DAC4100967368 /* NSObject+invocationForSelector.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CA9183DAC4100967368 /* NSObject+invocationForSelector.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42877CBA183DB08900967368 /* NSObject+invokeSafely.h in Headers */ = {isa = PBXBuildFile; fileRef = 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */; settings = {ATTRIBUTES = (Public, ); }; }; 428D034118482D9500303ED4 /* Notification.h in Headers */ = {isa = PBXBuildFile; fileRef = 428D033E18482D9500303ED4 /* Notification.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -177,8 +175,6 @@ 42877CA4183DAC4100967368 /* Misc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Misc.h; sourceTree = ""; }; 42877CA5183DAC4100967368 /* NSObject+associatedObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+associatedObject.h"; sourceTree = ""; }; 42877CA6183DAC4100967368 /* NSObject+associatedObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+associatedObject.m"; sourceTree = ""; }; - 42877CA7183DAC4100967368 /* NSObject+DeallocListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+DeallocListener.h"; sourceTree = ""; }; - 42877CA8183DAC4100967368 /* NSObject+DeallocListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+DeallocListener.m"; sourceTree = ""; }; 42877CA9183DAC4100967368 /* NSObject+invocationForSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+invocationForSelector.h"; sourceTree = ""; }; 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+invocationForSelector.m"; sourceTree = ""; }; 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+invokeSafely.h"; sourceTree = ""; }; @@ -454,8 +450,6 @@ 42877CA4183DAC4100967368 /* Misc.h */, 42877CA5183DAC4100967368 /* NSObject+associatedObject.h */, 42877CA6183DAC4100967368 /* NSObject+associatedObject.m */, - 42877CA7183DAC4100967368 /* NSObject+DeallocListener.h */, - 42877CA8183DAC4100967368 /* NSObject+DeallocListener.m */, 42877CA9183DAC4100967368 /* NSObject+invocationForSelector.h */, 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */, 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */, @@ -532,7 +526,6 @@ 4202873716CC245E00F2C92A /* NSDate+stringValue.h in Headers */, 42877CAF183DAC4100967368 /* Misc.h in Headers */, 42877CB0183DAC4100967368 /* NSObject+associatedObject.h in Headers */, - 42877CB2183DAC4100967368 /* NSObject+DeallocListener.h in Headers */, 42877CB4183DAC4100967368 /* NSObject+invocationForSelector.h in Headers */, 42352D3518765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h in Headers */, 42877CBA183DB08900967368 /* NSObject+invokeSafely.h in Headers */, @@ -702,7 +695,6 @@ 42352D871877E4AF0011CA48 /* NSString+dateValue.m in Sources */, 42352D881877E4AF0011CA48 /* NSDate+stringValue.m in Sources */, 42352D891877E4AF0011CA48 /* NSObject+associatedObject.m in Sources */, - 42352D8A1877E4AF0011CA48 /* NSObject+DeallocListener.m in Sources */, 42352D8B1877E4AF0011CA48 /* NSObject+invocationForSelector.m in Sources */, 42352D8C1877E4AF0011CA48 /* NSObject+invokeSafely.m in Sources */, ); diff --git a/TypeExtensions/Other Extensions/NSObject+DeallocListener.h b/TypeExtensions/Other Extensions/NSObject+DeallocListener.h deleted file mode 100644 index 6705ceb..0000000 --- a/TypeExtensions/Other Extensions/NSObject+DeallocListener.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// NSObject+DeallocListener.h -// TypeExtensions -// -// Created by Ethan Reesor on 8/24/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import - -@protocol DeallocListener - -- (void)objectDidDeallocate:(id)obj; - -@end - -@protocol DeallocNotifier - -- (void)addDeallocListener:(id)listener; -- (void)removeDeallocListener:(id)listener; - -@end - -@interface NSObject (DeallocListener) - -- (void)addDeallocListener:(id)listener; -- (void)removeDeallocListener:(id)listener; - -@end diff --git a/TypeExtensions/Other Extensions/NSObject+DeallocListener.m b/TypeExtensions/Other Extensions/NSObject+DeallocListener.m deleted file mode 100644 index b835269..0000000 --- a/TypeExtensions/Other Extensions/NSObject+DeallocListener.m +++ /dev/null @@ -1,195 +0,0 @@ -// -// NSObject+DeallocListener.m -// TypeExtensions -// -// Created by Ethan Reesor on 8/24/13. -// Copyright (c) 2013 Lens Flare. All rights reserved. -// - -#import "NSObject+DeallocListener.h" - -#import "NSObject+associatedObject.h" -#import "NSString+random.h" - -#import -#import - -#define kDeallocListenerAssociatedClassKey "__DeallocListener__AssociatedClass__" -#define kDeallocListenerOriginalClassKey "__DeallocListener__OriginalClass__" -#define kDeallocListenerArrayKey "com.firelizzard.TypeExtensions.DeallocListener.listeners" -#define kDeallocListenerSubclassFailureExceptionKey @"com.firelizzard.TypeExtensions.DeallocListener.exceptions.subclassFailure" - -#define MAX_RETAIN_COUNT 0x7fffffffffffffff - -#pragma mark - - -@interface NSObject (DeallocListenerPrivate) - -- (void)_revert; - -@end - -#pragma mark - - -void DeallocNotifier_addDeallocListener(id self, SEL _cmd, id listener) { - NSMutableArray * arr = objc_getAssociatedObject(self, kDeallocListenerArrayKey); - - if (!arr) { - arr = [NSMutableArray array]; - objc_setAssociatedObject(self, kDeallocListenerArrayKey, arr, OBJC_ASSOCIATION_RETAIN); - } - - [arr addObject:listener]; -} - -void DeallocNotifier_removeDeallocListener(id self, SEL _cmd, id listener) { - NSMutableArray * arr = objc_getAssociatedObject(self, kDeallocListenerArrayKey); - - if (!arr) - return; - - [arr removeObject:listener]; -} - -void DeallocNotifier_dealloc(id self, SEL _cmd) { - if ([self respondsToSelector:@selector(invalidate)]) - [self invalidate]; - - for (id listener in objc_getAssociatedObject(self, kDeallocListenerArrayKey)) - [listener objectDidDeallocate:self]; - - objc_setAssociatedObject(self, kDeallocListenerArrayKey, nil, OBJC_ASSOCIATION_RETAIN); - - [self _revert]; - [self dealloc]; -} - -Class DeallocNotifier_class(id self, SEL _cmd) { - Class realClass = object_getClass(self); - Class superClass = class_getSuperclass(realClass); - - object_setClass(self, superClass); - Class class = [self class]; - object_setClass(self, realClass); - return class; -} - -#pragma mark - - -id associatedObject_associatedObjectForKey(Class self, SEL _cmd, const char * key) { - return objc_getAssociatedObject(objc_getAssociatedObject(self, kDeallocListenerOriginalClassKey), key); -} - -void associatedObject_setAssociatedObject_forKey(Class self, SEL _cmd, id obj, const char * key) { - objc_setAssociatedObject(objc_getAssociatedObject(self, kDeallocListenerOriginalClassKey), key, obj, OBJC_ASSOCIATION_RETAIN); -} - -#pragma mark - - -void KVOBug_addObserver_forKeyPath_options_context(id self, SEL _cmd, NSObject * observer, NSString * keyPath, NSKeyValueObservingOptions options, void * context) { - Class realClass = object_getClass(self); - Class superClass = class_getSuperclass(realClass); - - object_setClass(self, superClass); - [self addObserver:observer forKeyPath:keyPath options:options context:context]; - object_setClass(self, realClass); -} - -void KVOBug_removeObserver_forKeyPath_context(id self, SEL _cmd, NSObject * observer, NSString * keyPath, void * context) { - Class realClass = object_getClass(self); - Class superClass = class_getSuperclass(realClass); - - object_setClass(self, superClass); - [self removeObserver:observer forKeyPath:keyPath context:context]; - object_setClass(self, realClass); -} - -void KVOBug_setValue_forKey(id self, SEL _cmd, id object, NSString * key) { - Class realClass = object_getClass(self); - Class superClass = class_getSuperclass(realClass); - - object_setClass(self, superClass); - [self setValue:object forKey:key]; - object_setClass(self, realClass); -} - -#pragma mark - - -@implementation NSObject (DeallocListener) - -- (void)addDeallocListener:(id)listener { - Class original = objc_getAssociatedObject(self.class, kDeallocListenerOriginalClassKey); - if (original || [self conformsToProtocol:@protocol(DeallocNotifier)]) - goto _addListener; - - if ([self isMemberOfClass:NSObject.class]) - goto _classException; - - if ([self isKindOfClass:NSString.class]) - goto _classException; - - if ([self isKindOfClass:NSNumber.class]) - goto _classException; - - if (self.retainCount == @(0).retainCount || self.retainCount == @"".retainCount) - goto _classException; - - [self addObserver:self forKeyPath:@"self" options:0 context:nil]; - - original = object_getClass(self); - Class proxyClass = [(NSObject *)original associatedObjectForKey:kDeallocListenerAssociatedClassKey]; - - if (!proxyClass) { - NSString * newName = [NSString stringWithFormat:@"DeallocNotifying_%@", original]; - proxyClass = objc_allocateClassPair(original, [newName cStringUsingEncoding:NSASCIIStringEncoding], 0); - Class proxyClassClass = object_getClass(proxyClass); - - objc_registerClassPair(proxyClass); - - class_addProtocol(proxyClass, @protocol(DeallocNotifier)); - - class_addMethod(proxyClass, @selector(addDeallocListener:), (IMP)&DeallocNotifier_addDeallocListener, "v@:@@"); - class_addMethod(proxyClass, @selector(removeDeallocListener:), (IMP)&DeallocNotifier_removeDeallocListener, "v@:@"); - class_addMethod(proxyClass, @selector(dealloc), (IMP)&DeallocNotifier_dealloc, "v@:"); - class_addMethod(proxyClass, @selector(class), (IMP)&DeallocNotifier_class, "@@:"); - - class_addMethod(proxyClassClass, @selector(associatedObjectForKey:), (IMP)&associatedObject_associatedObjectForKey, "@@:*"); - class_addMethod(proxyClassClass, @selector(setAssociatedObject:forKey:), (IMP)&associatedObject_setAssociatedObject_forKey, "v@:@*"); - - class_addMethod(proxyClass, @selector(addObserver:forKeyPath:options:context:), (IMP)&KVOBug_addObserver_forKeyPath_options_context, "v@:@@i*"); - class_addMethod(proxyClass, @selector(removeObserver:forKeyPath:context:), (IMP)&KVOBug_removeObserver_forKeyPath_context, "v@:@@*"); - class_addMethod(proxyClass, @selector(setValue:forKey:), (IMP)&KVOBug_setValue_forKey, "v@:@@"); - - objc_setAssociatedObject(proxyClass, kDeallocListenerOriginalClassKey, original, OBJC_ASSOCIATION_RETAIN); - objc_setAssociatedObject(original, kDeallocListenerAssociatedClassKey, proxyClass, OBJC_ASSOCIATION_RETAIN); - } - - object_setClass(self, proxyClass); - -_addListener: - [self addDeallocListener:listener]; - return; - -_classException: - @throw [NSException exceptionWithName:kDeallocListenerSubclassFailureExceptionKey reason:[NSString stringWithFormat:@"%@ cannot be converted to a DeallocNotifier", self] userInfo:0]; -} - -- (void)removeDeallocListener:(id)listener -{ - // nothing to do -} - -@end - -@implementation NSObject (DeallocListenerPrivate) - -- (void)_revert -{ - Class original = objc_getAssociatedObject(object_getClass(self), kDeallocListenerOriginalClassKey); - if (original) - object_setClass(self, original); - - [self removeObserver:self forKeyPath:@"self" context:nil]; -} - -@end From 553d2bc3614eb7ddb7b91b5cad4f5f80b1f89f9a Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 21:51:30 -0500 Subject: [PATCH 09/13] Forgot to move something to ER-DeallocListener --- TypeExtensionsTests/TEMiscTests.m | 109 +----------------------------- 1 file changed, 1 insertion(+), 108 deletions(-) diff --git a/TypeExtensionsTests/TEMiscTests.m b/TypeExtensionsTests/TEMiscTests.m index 0e1c2c6..ff9ca0e 100644 --- a/TypeExtensionsTests/TEMiscTests.m +++ b/TypeExtensionsTests/TEMiscTests.m @@ -12,13 +12,12 @@ #import "Dummy.h" -@interface TEMiscTests : XCTestCase +@interface TEMiscTests : XCTestCase @end @implementation TEMiscTests { NSAutoreleasePool * _pool; - BOOL _caughtDeallocNotification, _caughtKVONotification; } - (void)setUp @@ -26,9 +25,6 @@ - (void)setUp [super setUp]; _pool = [[NSAutoreleasePool alloc] init]; - - _caughtDeallocNotification = NO; - _caughtKVONotification = NO; } - (void)tearDown @@ -38,109 +34,6 @@ - (void)tearDown [super tearDown]; } -- (void)testDeallocateNotifier -{ - id obj; - @autoreleasepool { - obj = [Dummy dummy]; - [obj addDeallocListener:self]; - } - - if (!_caughtDeallocNotification) - XCTFail(@"Did not receive deallocation notification"); -} - -- (void)objectDidDeallocate:(id)obj -{ - _caughtDeallocNotification = YES; -} - -- (void)testKVOBugs -{ - id obj = [Dummy dummy]; - - [obj setValue:@"Hi" forKey:@"something"]; - - if (![@"Hi" isEqualToString:[obj valueForKey:@"something"]]) - XCTFail(@"KVC failed"); - - [obj addObserver:self forKeyPath:@"something" options:0 context:nil]; - - [obj addDeallocListener:self]; - - [obj setValue:@"Lo" forKey:@"something"]; - - if (![@"Lo" isEqualToString:[obj valueForKey:@"something"]]) - XCTFail(@"KVC failed"); - - @try { - [obj removeObserver:self forKeyPath:@"something" context:nil]; - } - @catch (NSException *exception) { - XCTFail(@"Failed: %@", exception); - } - - if (!_caughtKVONotification) - XCTFail(@"KVO notification not caught"); -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context -{ - _caughtKVONotification = YES; -} - -- (void)testObjectForKey -{ - id obj = [Dummy dummy]; - char * key = "com.firelizzard.TypeExtensions.Test.Misc.associatedObject.ObjectForKey"; - NSString * test = [NSMutableString stringWithString:@"Here is my test object"]; - - // make sure DN doesn't interfere - [obj addDeallocListener:self]; - - [obj setAssociatedObject:test forKey:key]; - if (test != [obj associatedObjectForKey:key]) - XCTFail(@"Did not retreive correct object"); - [obj setAssociatedObject:nil forKey:key]; - if ([obj associatedObjectForKey:key]) - XCTFail(@"Object should be nil"); - - [obj setAssociatedObject:test forSelector:_cmd]; - if (test != [obj associatedObjectForSelector:_cmd]) - XCTFail(@"Did not retreive correct object"); - [obj setAssociatedObject:nil forSelector:_cmd]; - if ([obj associatedObjectForSelector:_cmd]) - XCTFail(@"Object should be nil"); - - [obj setAssociatedObject:test forClass:[self class]]; - if (test != [obj associatedObjectForClass:[self class]]) - XCTFail(@"Did not retreive correct object"); - [obj setAssociatedObject:nil forClass:[self class]]; - if ([obj associatedObjectForClass:[self class]]) - XCTFail(@"Object should be nil"); -} - -- (void)testBadTypes -{ - @try { - [[[[NSObject alloc] init] autorelease] addDeallocListener:self]; - XCTFail(@"Adding a DeallocListener to an NSObject should fail"); - } - @catch (NSException *exception) { } - - @try { - [@"asdf" addDeallocListener:self]; - XCTFail(@"Adding a DeallocListener to an NSObject should fail"); - } - @catch (NSException *exception) { } - - @try { - [@(1) addDeallocListener:self]; - XCTFail(@"Adding a DeallocListener to an NSObject should fail"); - } - @catch (NSException *exception) { } -} - - (void)testSingleton { id s1 = [NSObject_Singleton sharedInstance]; From fc1b01ccc851e4e5eab78526a014d273f12a23da Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 21:52:12 -0500 Subject: [PATCH 10/13] Switching to ARC --- TypeExtensions/Collection Extensions/Collection.h | 4 +--- TypeExtensions/Other Extensions/Misc.h | 2 -- TypeExtensions/TypeExtensions-Info.plist | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/TypeExtensions/Collection Extensions/Collection.h b/TypeExtensions/Collection Extensions/Collection.h index 927be10..be4fa52 100644 --- a/TypeExtensions/Collection Extensions/Collection.h +++ b/TypeExtensions/Collection Extensions/Collection.h @@ -7,6 +7,4 @@ // #import "NSDictionary+entrySet.h" -#import "NSMapTable+objectForKeyedSubscript.h" -#import "TXMutableWeakArray.h" -#import "TXMutableWeakDictionary.h" \ No newline at end of file +#import "NSMapTable+objectForKeyedSubscript.h" \ No newline at end of file diff --git a/TypeExtensions/Other Extensions/Misc.h b/TypeExtensions/Other Extensions/Misc.h index 27f5655..8f5393d 100644 --- a/TypeExtensions/Other Extensions/Misc.h +++ b/TypeExtensions/Other Extensions/Misc.h @@ -8,7 +8,5 @@ #import "NSObject+associatedObject.h" #import "NSObject+invocationForSelector.h" -#import "NSObject+DeallocListener.h" -#import "TXZeroingWeakProxy.h" #import "NSObject+invokeSafely.h" #import "NSObject_Singleton.h" \ No newline at end of file diff --git a/TypeExtensions/TypeExtensions-Info.plist b/TypeExtensions/TypeExtensions-Info.plist index 315d081..6b76569 100644 --- a/TypeExtensions/TypeExtensions-Info.plist +++ b/TypeExtensions/TypeExtensions-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 115 + 121 NSHumanReadableCopyright Copyright © 2012 Lens Flare. Some rights reserved, see license. NSPrincipalClass From 87e1282ae22fbe1b2b486e4010b373fc3cafc512 Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 22:05:42 -0500 Subject: [PATCH 11/13] Switching to ARC --- TypeExtensions.xcodeproj/project.pbxproj | 18 +++++++++------- .../NSDictionary+entrySet.m | 12 +++-------- .../NSObject_KVCArrayForwarding.m | 21 +++++++------------ .../KVC Extensions/NSObject_KVCUndefined.m | 4 ---- .../NSObject_ProtocolConformer.h | 2 +- TypeExtensions/TypeExtensions-Info.plist | 2 +- .../Value Extensions/NSData+stringValue.m | 2 +- 7 files changed, 23 insertions(+), 38 deletions(-) diff --git a/TypeExtensions.xcodeproj/project.pbxproj b/TypeExtensions.xcodeproj/project.pbxproj index 8c920cb..3f9f6bc 100644 --- a/TypeExtensions.xcodeproj/project.pbxproj +++ b/TypeExtensions.xcodeproj/project.pbxproj @@ -92,8 +92,8 @@ 4290F08C1849A31400C67769 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 4290F08A1849A31400C67769 /* LICENSE */; }; 4290F08D1849A31400C67769 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 4290F08B1849A31400C67769 /* README.md */; }; 4291FF3816C57EA4000538EF /* NSString+orNull.h in Headers */ = {isa = PBXBuildFile; fileRef = 4291FF3616C57EA4000538EF /* NSString+orNull.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 429CE069188F682C00FF0113 /* TXZeroingWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 429CE067188F682C00FF0113 /* TXZeroingWeakProxy.h */; }; - 429CE06A188F682C00FF0113 /* TXZeroingWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 429CE068188F682C00FF0113 /* TXZeroingWeakProxy.m */; }; + 429CE069188F682C00FF0113 /* TXWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 429CE067188F682C00FF0113 /* TXWeakProxy.h */; }; + 429CE06A188F682C00FF0113 /* TXWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 429CE068188F682C00FF0113 /* TXWeakProxy.m */; }; 42AC0B19165CA0B2002E846E /* Null.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AC0B16165C9FBB002E846E /* Null.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42AC0B1B165CA111002E846E /* TypeExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 420D1AAC165BF5020097EE03 /* TypeExtensions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42BA0C3516707B2C0066DD1A /* NSString+urlValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 42BA0C3316707B2C0066DD1A /* NSString+urlValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -208,8 +208,8 @@ 4290F08E1849A32600C67769 /* .travis.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .travis.yml; sourceTree = ""; }; 4291FF3616C57EA4000538EF /* NSString+orNull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+orNull.h"; sourceTree = ""; }; 4291FF3716C57EA4000538EF /* NSString+orNull.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+orNull.m"; sourceTree = ""; }; - 429CE067188F682C00FF0113 /* TXZeroingWeakProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXZeroingWeakProxy.h; sourceTree = ""; }; - 429CE068188F682C00FF0113 /* TXZeroingWeakProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXZeroingWeakProxy.m; sourceTree = ""; }; + 429CE067188F682C00FF0113 /* TXWeakProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXWeakProxy.h; sourceTree = ""; }; + 429CE068188F682C00FF0113 /* TXWeakProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXWeakProxy.m; sourceTree = ""; }; 42AC0B16165C9FBB002E846E /* Null.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Null.h; sourceTree = ""; }; 42BA0C3316707B2C0066DD1A /* NSString+urlValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+urlValue.h"; sourceTree = ""; }; 42BA0C3416707B2C0066DD1A /* NSString+urlValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+urlValue.m"; sourceTree = ""; }; @@ -458,8 +458,8 @@ 42877CAA183DAC4100967368 /* NSObject+invocationForSelector.m */, 42877CB8183DB08900967368 /* NSObject+invokeSafely.h */, 42877CB9183DB08900967368 /* NSObject+invokeSafely.m */, - 429CE067188F682C00FF0113 /* TXZeroingWeakProxy.h */, - 429CE068188F682C00FF0113 /* TXZeroingWeakProxy.m */, + 429CE067188F682C00FF0113 /* TXWeakProxy.h */, + 429CE068188F682C00FF0113 /* TXWeakProxy.m */, ); path = "Other Extensions"; sourceTree = ""; @@ -534,7 +534,7 @@ 42877CB0183DAC4100967368 /* NSObject+associatedObject.h in Headers */, 42877CB4183DAC4100967368 /* NSObject+invocationForSelector.h in Headers */, 42352D3518765FFA0011CA48 /* NSMapTable+objectForKeyedSubscript.h in Headers */, - 429CE069188F682C00FF0113 /* TXZeroingWeakProxy.h in Headers */, + 429CE069188F682C00FF0113 /* TXWeakProxy.h in Headers */, 42877CBA183DB08900967368 /* NSObject+invokeSafely.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -689,7 +689,7 @@ 42352D7A1877E4AF0011CA48 /* NSObject+isNull.m in Sources */, 42352D7B1877E4AF0011CA48 /* NSString+isEmpty.m in Sources */, 42352D7C1877E4AF0011CA48 /* NSArray+orNull.m in Sources */, - 429CE06A188F682C00FF0113 /* TXZeroingWeakProxy.m in Sources */, + 429CE06A188F682C00FF0113 /* TXWeakProxy.m in Sources */, 42352D7D1877E4AF0011CA48 /* NSString+orNull.m in Sources */, 42352D7E1877E4AF0011CA48 /* NSObject_KVCArrayForwarding.m in Sources */, 42352D7F1877E4AF0011CA48 /* NSObject_KVCUndefined.m in Sources */, @@ -845,6 +845,7 @@ 420D1AB2165BF5020097EE03 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -860,6 +861,7 @@ 420D1AB3165BF5020097EE03 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; diff --git a/TypeExtensions/Collection Extensions/NSDictionary+entrySet.m b/TypeExtensions/Collection Extensions/NSDictionary+entrySet.m index 30385a7..2582def 100644 --- a/TypeExtensions/Collection Extensions/NSDictionary+entrySet.m +++ b/TypeExtensions/Collection Extensions/NSDictionary+entrySet.m @@ -37,24 +37,18 @@ @implementation __NSDictionaryEntry + (instancetype)dictionaryEntryWithKey:(id)key forDictionary:(NSDictionary *)dictionary { - return [[[self alloc] initWithKey:key forDictionary:dictionary] autorelease]; + return [[self alloc] initWithKey:key forDictionary:dictionary]; } - (id)initWithKey:(id)key forDictionary:(NSDictionary *)dictionary { if (self = [super init]) { - _key = [key retain]; - _object = [dictionary[key] retain]; + _key = key; + _object = dictionary[key]; } return self; } -- (void)dealloc -{ - [_key release]; - [_object release]; - [super dealloc]; -} - (NSString *)description { diff --git a/TypeExtensions/KVC Extensions/NSObject_KVCArrayForwarding.m b/TypeExtensions/KVC Extensions/NSObject_KVCArrayForwarding.m index 2feb144..c99a0f9 100644 --- a/TypeExtensions/KVC Extensions/NSObject_KVCArrayForwarding.m +++ b/TypeExtensions/KVC Extensions/NSObject_KVCArrayForwarding.m @@ -25,8 +25,8 @@ @implementation NSObject_KVCArrayForwarding { - (id)initWithTarget:(id)theTarget keyPath:(NSString *)theKeyPath isMutable:(BOOL)isMutable { if (self = [super init]) { - target = [theTarget retain]; - keyPath = [theKeyPath retain]; + target = theTarget; + keyPath = theKeyPath; NSString * KeyPath = keyPath.capitalizedString; Class class = [self class]; @@ -41,10 +41,10 @@ - (id)initWithTarget:(id)theTarget keyPath:(NSString *)theKeyPath isMutable:(BOO if (subclass == nil) return nil; - class_addMethod(subclass, - @selector(dealloc), - [class instanceMethodForSelector:@selector(dealloc)], - "v@:"); +// class_addMethod(subclass, +// @selector(dealloc), +// [class instanceMethodForSelector:@selector(dealloc)], +// "v@:"); class_addMethod(subclass, NSSelectorFromString([NSString stringWithFormat:@"countOf%@", KeyPath]), @@ -105,13 +105,6 @@ - (id)initWithTarget:(id)theTarget keyPath:(NSString *)theKeyPath isMutable:(BOO return self; } -- (void)dealloc -{ - [target release]; - [keyPath release]; - - [super dealloc]; -} - (NSArray *)arrayProperty { @@ -144,7 +137,7 @@ - (NSArray *)arrayObjectsAtIndexes:(NSIndexSet *)indexes return [self.arrayProperty objectsAtIndexes:indexes]; } -- (void)getArrayObjects:(id *)buffer range:(NSRange)inRange +- (void)getArrayObjects:(__unsafe_unretained id *)buffer range:(NSRange)inRange { [self.arrayProperty getObjects:buffer range:inRange]; } diff --git a/TypeExtensions/KVC Extensions/NSObject_KVCUndefined.m b/TypeExtensions/KVC Extensions/NSObject_KVCUndefined.m index e1a0f7a..c21f47a 100644 --- a/TypeExtensions/KVC Extensions/NSObject_KVCUndefined.m +++ b/TypeExtensions/KVC Extensions/NSObject_KVCUndefined.m @@ -29,10 +29,6 @@ - (void)dealloc [_internal_set unlock]; [_internal_get unlock]; - [undefined release]; - [_internal_set release]; - [_internal_get release]; - [super dealloc]; } - (NSArray *)redefinedKeys diff --git a/TypeExtensions/Protocol Extensions/NSObject_ProtocolConformer.h b/TypeExtensions/Protocol Extensions/NSObject_ProtocolConformer.h index a29b863..f4e0db2 100644 --- a/TypeExtensions/Protocol Extensions/NSObject_ProtocolConformer.h +++ b/TypeExtensions/Protocol Extensions/NSObject_ProtocolConformer.h @@ -10,7 +10,7 @@ @interface NSObject_ProtocolConformer : NSObject -@property (readonly) Protocol * protocol; +@property (unsafe_unretained, readonly) Protocol * protocol; - (id)initWithProtocol:(Protocol *)protocol; diff --git a/TypeExtensions/TypeExtensions-Info.plist b/TypeExtensions/TypeExtensions-Info.plist index 6b76569..2a2c7d4 100644 --- a/TypeExtensions/TypeExtensions-Info.plist +++ b/TypeExtensions/TypeExtensions-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 121 + 123 NSHumanReadableCopyright Copyright © 2012 Lens Flare. Some rights reserved, see license. NSPrincipalClass diff --git a/TypeExtensions/Value Extensions/NSData+stringValue.m b/TypeExtensions/Value Extensions/NSData+stringValue.m index 8a59a52..a9c2c5e 100644 --- a/TypeExtensions/Value Extensions/NSData+stringValue.m +++ b/TypeExtensions/Value Extensions/NSData+stringValue.m @@ -12,7 +12,7 @@ @implementation NSData (stringValue) - (NSString *)stringValue { - return [[[NSString alloc] initWithData:self encoding:NSUTF8StringEncoding] autorelease]; + return [[NSString alloc] initWithData:self encoding:NSUTF8StringEncoding]; } @end From ed0552fcf02a8d25b05e54d727bdf92c609b73de Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 22:06:12 -0500 Subject: [PATCH 12/13] ER-WeakProxy finished --- TypeExtensions/Other Extensions/TXWeakProxy.h | 19 +++++++++ TypeExtensions/Other Extensions/TXWeakProxy.m | 39 +++++++++++++++++++ .../Other Extensions/TXZeroingWeakProxy.h | 13 ------- .../Other Extensions/TXZeroingWeakProxy.m | 13 ------- 4 files changed, 58 insertions(+), 26 deletions(-) create mode 100644 TypeExtensions/Other Extensions/TXWeakProxy.h create mode 100644 TypeExtensions/Other Extensions/TXWeakProxy.m delete mode 100644 TypeExtensions/Other Extensions/TXZeroingWeakProxy.h delete mode 100644 TypeExtensions/Other Extensions/TXZeroingWeakProxy.m diff --git a/TypeExtensions/Other Extensions/TXWeakProxy.h b/TypeExtensions/Other Extensions/TXWeakProxy.h new file mode 100644 index 0000000..441fab4 --- /dev/null +++ b/TypeExtensions/Other Extensions/TXWeakProxy.h @@ -0,0 +1,19 @@ +// +// TXZeroingWeakProxy.h +// TypeExtensions +// +// Created by Ethan Reesor on 1/21/14. +// Copyright (c) 2014 Lens Flare. All rights reserved. +// + +#import + +@interface TXWeakProxy : NSProxy + ++ (instancetype)proxyWithTarget:(NSObject *)target; +- (id)initWithTarget:(NSObject *)target; + +@property (readonly, weak) NSObject * target; +@property (unsafe_unretained, readonly) Class targetClass; + +@end diff --git a/TypeExtensions/Other Extensions/TXWeakProxy.m b/TypeExtensions/Other Extensions/TXWeakProxy.m new file mode 100644 index 0000000..0c64794 --- /dev/null +++ b/TypeExtensions/Other Extensions/TXWeakProxy.m @@ -0,0 +1,39 @@ +// +// TXZeroingWeakProxy.m +// TypeExtensions +// +// Created by Ethan Reesor on 1/21/14. +// Copyright (c) 2014 Lens Flare. All rights reserved. +// + +#import "TXWeakProxy.h" + +@implementation TXWeakProxy + ++ (instancetype)proxyWithTarget:(NSObject *)target +{ + return [[self alloc] initWithTarget:target]; +} + +- (id)initWithTarget:(NSObject *)target +{ +// if (!(self = [super init])) +// return nil; + + _target = target; + _targetClass = target.class; + + return self; +} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel +{ + return [self.targetClass methodSignatureForSelector:sel]; +} + +- (void)forwardInvocation:(NSInvocation *)invocation +{ + [invocation invokeWithTarget:self.target]; +} + +@end diff --git a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h deleted file mode 100644 index 3e2aebe..0000000 --- a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// TXZeroingWeakProxy.h -// TypeExtensions -// -// Created by Ethan Reesor on 1/21/14. -// Copyright (c) 2014 Lens Flare. All rights reserved. -// - -#import - -@interface TXZeroingWeakProxy : NSProxy - -@end diff --git a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m b/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m deleted file mode 100644 index c1ddb05..0000000 --- a/TypeExtensions/Other Extensions/TXZeroingWeakProxy.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// TXZeroingWeakProxy.m -// TypeExtensions -// -// Created by Ethan Reesor on 1/21/14. -// Copyright (c) 2014 Lens Flare. All rights reserved. -// - -#import "TXZeroingWeakProxy.h" - -@implementation TXZeroingWeakProxy - -@end From 6e01784686ce0cb8c333690c61f420863e2ac272 Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Tue, 21 Jan 2014 22:07:52 -0500 Subject: [PATCH 13/13] Version bump --- TypeExtensions/TypeExtensions-Info.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TypeExtensions/TypeExtensions-Info.plist b/TypeExtensions/TypeExtensions-Info.plist index 2a2c7d4..7140ed1 100644 --- a/TypeExtensions/TypeExtensions-Info.plist +++ b/TypeExtensions/TypeExtensions-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0 + 2.1 CFBundleSignature ???? CFBundleVersion - 123 + 124 NSHumanReadableCopyright Copyright © 2012 Lens Flare. Some rights reserved, see license. NSPrincipalClass