From bd6cfe285950311fc49ce245cabf74974103c515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Sun, 10 Jul 2011 09:07:02 +0200 Subject: [PATCH 1/3] Add framework target, and remove AudioUnit & AudioToolbox dependencies for now --- FoundationKit-Info.plist | 30 ++++ FoundationKit.xcodeproj/project.pbxproj | 164 +++++++++++++++++- .../xcschemes/FoundationKit.xcscheme | 16 +- Sources/FoundationKit.h | 2 +- 4 files changed, 202 insertions(+), 10 deletions(-) create mode 100644 FoundationKit-Info.plist diff --git a/FoundationKit-Info.plist b/FoundationKit-Info.plist new file mode 100644 index 0000000..67a5c8e --- /dev/null +++ b/FoundationKit-Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + it.foundationk.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSHumanReadableCopyright + Copyright © 2011 __MyCompanyName__. All rights reserved. + NSPrincipalClass + + + diff --git a/FoundationKit.xcodeproj/project.pbxproj b/FoundationKit.xcodeproj/project.pbxproj index 514cb09..28ac7dd 100644 --- a/FoundationKit.xcodeproj/project.pbxproj +++ b/FoundationKit.xcodeproj/project.pbxproj @@ -19,6 +19,35 @@ C5E31A0513C4EA7E00D9CA76 /* NSDictionary+NKBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E319FD13C4EA7D00D9CA76 /* NSDictionary+NKBlocks.m */; }; C5E31A0713C4EA7E00D9CA76 /* NSMutableArray+NKBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E319FF13C4EA7D00D9CA76 /* NSMutableArray+NKBlocks.m */; }; C5E31A0913C4EA7E00D9CA76 /* NSMutableDictionary+NKBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E31A0113C4EA7D00D9CA76 /* NSMutableDictionary+NKBlocks.m */; }; + C5EF030813C9811600953F2B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC410D0213C39BFD00C90C19 /* Foundation.framework */; }; + C5EF033113C9812400953F2B /* NKLog.m in Sources */ = {isa = PBXBuildFile; fileRef = C582BF8A13C8B77C0012DF67 /* NKLog.m */; }; + C5EF033213C9812400953F2B /* NSArray+NKBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E319FB13C4EA7C00D9CA76 /* NSArray+NKBlocks.m */; }; + C5EF033313C9812400953F2B /* NSData+NKCrypto.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E319D213C4744800D9CA76 /* NSData+NKCrypto.m */; }; + C5EF033413C9812400953F2B /* NSDictionary+NKBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E319FD13C4EA7D00D9CA76 /* NSDictionary+NKBlocks.m */; }; + C5EF033513C9812400953F2B /* NSError+NKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DCB0127013C4AE9400AB692F /* NSError+NKAdditions.m */; }; + C5EF033613C9812400953F2B /* NSMutableArray+NKBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E319FF13C4EA7D00D9CA76 /* NSMutableArray+NKBlocks.m */; }; + C5EF033713C9812400953F2B /* NSMutableDictionary+NKBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E31A0113C4EA7D00D9CA76 /* NSMutableDictionary+NKBlocks.m */; }; + C5EF033813C9812400953F2B /* NSObject+NKSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = DCF68FBD13C74ADB0057517A /* NSObject+NKSwizzle.m */; }; + C5EF033913C9812400953F2B /* NSObject+NKAssociatedObjects.m in Sources */ = {isa = PBXBuildFile; fileRef = 399F4CD313C905C70008CC0E /* NSObject+NKAssociatedObjects.m */; }; + C5EF033A13C9813200953F2B /* FoundationKit.h in Headers */ = {isa = PBXBuildFile; fileRef = C5E319D713C474FE00D9CA76 /* FoundationKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF033B13C9813E00953F2B /* NKAudioRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = C5E319F613C4E90B00D9CA76 /* NKAudioRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF033C13C9813E00953F2B /* NKLog.h in Headers */ = {isa = PBXBuildFile; fileRef = C582BF8913C8B77C0012DF67 /* NKLog.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF033D13C9813E00953F2B /* NKShorthands.h in Headers */ = {isa = PBXBuildFile; fileRef = C5E31A0A13C4EC8700D9CA76 /* NKShorthands.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF033E13C9813E00953F2B /* NSArray+NKBlocks.h in Headers */ = {isa = PBXBuildFile; fileRef = C5E319FA13C4EA7C00D9CA76 /* NSArray+NKBlocks.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF033F13C9813E00953F2B /* NSArray+NKConcise.h in Headers */ = {isa = PBXBuildFile; fileRef = DC1CF42313C483BC00E5BEBC /* NSArray+NKConcise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034013C9813E00953F2B /* NSData+NKCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = C5E319D113C4744800D9CA76 /* NSData+NKCrypto.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034113C9813E00953F2B /* NSDictionary+NKBlocks.h in Headers */ = {isa = PBXBuildFile; fileRef = C5E319FC13C4EA7C00D9CA76 /* NSDictionary+NKBlocks.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034213C9813E00953F2B /* NSDictionary+NKConcise.h in Headers */ = {isa = PBXBuildFile; fileRef = DC1CF42813C4847200E5BEBC /* NSDictionary+NKConcise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034313C9813E00953F2B /* NSError+NKAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DCB0126F13C4AE9400AB692F /* NSError+NKAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034413C9813E00953F2B /* NSMutableArray+NKBlocks.h in Headers */ = {isa = PBXBuildFile; fileRef = C5E319FE13C4EA7D00D9CA76 /* NSMutableArray+NKBlocks.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034513C9813E00953F2B /* NSMutableDictionary+NKBlocks.h in Headers */ = {isa = PBXBuildFile; fileRef = C5E31A0013C4EA7D00D9CA76 /* NSMutableDictionary+NKBlocks.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034613C9813E00953F2B /* NSNull+NKConcise.h in Headers */ = {isa = PBXBuildFile; fileRef = DC1CF42C13C4849400E5BEBC /* NSNull+NKConcise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034713C9813E00953F2B /* NSNumber+NKConcise.h in Headers */ = {isa = PBXBuildFile; fileRef = DC1CF42613C4845D00E5BEBC /* NSNumber+NKConcise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034813C9813E00953F2B /* NSObject+NKSwizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF68FBC13C74ADB0057517A /* NSObject+NKSwizzle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034913C9813E00953F2B /* NSSet+NKConcise.h in Headers */ = {isa = PBXBuildFile; fileRef = DC1CF43013C484B800E5BEBC /* NSSet+NKConcise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034A13C9813E00953F2B /* NSString+NKConcise.h in Headers */ = {isa = PBXBuildFile; fileRef = DC1CF42E13C484A400E5BEBC /* NSString+NKConcise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034B13C9813E00953F2B /* NSValue+NKConcise.h in Headers */ = {isa = PBXBuildFile; fileRef = DC1CF42A13C4848200E5BEBC /* NSValue+NKConcise.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5EF034C13C9813E00953F2B /* NSObject+NKAssociatedObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 399F4CD213C905C70008CC0E /* NSObject+NKAssociatedObjects.h */; settings = {ATTRIBUTES = (Public, ); }; }; DC410D0313C39BFD00C90C19 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC410D0213C39BFD00C90C19 /* Foundation.framework */; }; DCB0127213C4AE9400AB692F /* NSError+NKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DCB0127013C4AE9400AB692F /* NSError+NKAdditions.m */; }; DCF68FBF13C74ADB0057517A /* NSObject+NKSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = DCF68FBD13C74ADB0057517A /* NSObject+NKSwizzle.m */; }; @@ -60,6 +89,8 @@ C5E31A0013C4EA7D00D9CA76 /* NSMutableDictionary+NKBlocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+NKBlocks.h"; sourceTree = ""; }; C5E31A0113C4EA7D00D9CA76 /* NSMutableDictionary+NKBlocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+NKBlocks.m"; sourceTree = ""; }; C5E31A0A13C4EC8700D9CA76 /* NKShorthands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NKShorthands.h; sourceTree = ""; }; + C5EF02F513C980F600953F2B /* FoundationKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FoundationKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C5EF02FE13C980F600953F2B /* FoundationKit-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FoundationKit-Info.plist"; sourceTree = ""; }; DC1CF42313C483BC00E5BEBC /* NSArray+NKConcise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+NKConcise.h"; sourceTree = ""; }; DC1CF42613C4845D00E5BEBC /* NSNumber+NKConcise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNumber+NKConcise.h"; sourceTree = ""; }; DC1CF42813C4847200E5BEBC /* NSDictionary+NKConcise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+NKConcise.h"; sourceTree = ""; }; @@ -86,6 +117,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C5EF02F113C980F600953F2B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C5EF030813C9811600953F2B /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; DC410CFC13C39BFD00C90C19 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -147,6 +186,7 @@ isa = PBXGroup; children = ( C5E319D513C474E800D9CA76 /* FoundationKit-Prefix.pch */, + C5EF02FE13C980F600953F2B /* FoundationKit-Info.plist */, ); name = "Supporting Files"; sourceTree = ""; @@ -178,6 +218,7 @@ children = ( DC410CFF13C39BFD00C90C19 /* libFoundationKit.a */, C5C18E7A13C8C64C00DD0872 /* Tests.octest */, + C5EF02F513C980F600953F2B /* FoundationKit.framework */, ); name = Products; sourceTree = ""; @@ -193,6 +234,35 @@ }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + C5EF02F213C980F600953F2B /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + C5EF033A13C9813200953F2B /* FoundationKit.h in Headers */, + C5EF033B13C9813E00953F2B /* NKAudioRecorder.h in Headers */, + C5EF033C13C9813E00953F2B /* NKLog.h in Headers */, + C5EF033D13C9813E00953F2B /* NKShorthands.h in Headers */, + C5EF033E13C9813E00953F2B /* NSArray+NKBlocks.h in Headers */, + C5EF033F13C9813E00953F2B /* NSArray+NKConcise.h in Headers */, + C5EF034013C9813E00953F2B /* NSData+NKCrypto.h in Headers */, + C5EF034113C9813E00953F2B /* NSDictionary+NKBlocks.h in Headers */, + C5EF034213C9813E00953F2B /* NSDictionary+NKConcise.h in Headers */, + C5EF034313C9813E00953F2B /* NSError+NKAdditions.h in Headers */, + C5EF034413C9813E00953F2B /* NSMutableArray+NKBlocks.h in Headers */, + C5EF034513C9813E00953F2B /* NSMutableDictionary+NKBlocks.h in Headers */, + C5EF034613C9813E00953F2B /* NSNull+NKConcise.h in Headers */, + C5EF034713C9813E00953F2B /* NSNumber+NKConcise.h in Headers */, + C5EF034813C9813E00953F2B /* NSObject+NKSwizzle.h in Headers */, + C5EF034913C9813E00953F2B /* NSSet+NKConcise.h in Headers */, + C5EF034A13C9813E00953F2B /* NSString+NKConcise.h in Headers */, + C5EF034B13C9813E00953F2B /* NSValue+NKConcise.h in Headers */, + C5EF034C13C9813E00953F2B /* NSObject+NKAssociatedObjects.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ C5C18E7913C8C64C00DD0872 /* Tests */ = { isa = PBXNativeTarget; @@ -213,9 +283,27 @@ productReference = C5C18E7A13C8C64C00DD0872 /* Tests.octest */; productType = "com.apple.product-type.bundle"; }; - DC410CFE13C39BFD00C90C19 /* FoundationKit */ = { + C5EF02F413C980F600953F2B /* FoundationKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = C5EF030313C980F600953F2B /* Build configuration list for PBXNativeTarget "FoundationKit" */; + buildPhases = ( + C5EF02F013C980F600953F2B /* Sources */, + C5EF02F113C980F600953F2B /* Frameworks */, + C5EF02F213C980F600953F2B /* Headers */, + C5EF02F313C980F600953F2B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = FoundationKit; + productName = FundationKit; + productReference = C5EF02F513C980F600953F2B /* FoundationKit.framework */; + productType = "com.apple.product-type.framework"; + }; + DC410CFE13C39BFD00C90C19 /* libFoundationKit */ = { isa = PBXNativeTarget; - buildConfigurationList = DC410D0913C39BFD00C90C19 /* Build configuration list for PBXNativeTarget "FoundationKit" */; + buildConfigurationList = DC410D0913C39BFD00C90C19 /* Build configuration list for PBXNativeTarget "libFoundationKit" */; buildPhases = ( DC410CFB13C39BFD00C90C19 /* Sources */, DC410CFC13C39BFD00C90C19 /* Frameworks */, @@ -224,7 +312,7 @@ ); dependencies = ( ); - name = FoundationKit; + name = libFoundationKit; productName = FoundationKit; productReference = DC410CFF13C39BFD00C90C19 /* libFoundationKit.a */; productType = "com.apple.product-type.library.static"; @@ -246,8 +334,9 @@ projectDirPath = ""; projectRoot = ""; targets = ( - DC410CFE13C39BFD00C90C19 /* FoundationKit */, + DC410CFE13C39BFD00C90C19 /* libFoundationKit */, C5C18E7913C8C64C00DD0872 /* Tests */, + C5EF02F413C980F600953F2B /* FoundationKit */, ); }; /* End PBXProject section */ @@ -260,6 +349,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C5EF02F313C980F600953F2B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -287,6 +383,22 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C5EF02F013C980F600953F2B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C5EF033113C9812400953F2B /* NKLog.m in Sources */, + C5EF033213C9812400953F2B /* NSArray+NKBlocks.m in Sources */, + C5EF033313C9812400953F2B /* NSData+NKCrypto.m in Sources */, + C5EF033413C9812400953F2B /* NSDictionary+NKBlocks.m in Sources */, + C5EF033513C9812400953F2B /* NSError+NKAdditions.m in Sources */, + C5EF033613C9812400953F2B /* NSMutableArray+NKBlocks.m in Sources */, + C5EF033713C9812400953F2B /* NSMutableDictionary+NKBlocks.m in Sources */, + C5EF033813C9812400953F2B /* NSObject+NKSwizzle.m in Sources */, + C5EF033913C9812400953F2B /* NSObject+NKAssociatedObjects.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; DC410CFB13C39BFD00C90C19 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -309,7 +421,7 @@ /* Begin PBXTargetDependency section */ C5C18E9313C8C65100DD0872 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = DC410CFE13C39BFD00C90C19 /* FoundationKit */; + target = DC410CFE13C39BFD00C90C19 /* libFoundationKit */; targetProxy = C5C18E9213C8C65100DD0872 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -343,6 +455,34 @@ }; name = Release; }; + C5EF030413C980F600953F2B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "FoundationKit-Prefix.pch"; + INFOPLIST_FILE = "FoundationKit-Info.plist"; + INSTALL_PATH = "@loader_path/../Frameworks"; + WRAPPER_EXTENSION = framework; + }; + name = Debug; + }; + C5EF030513C980F600953F2B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "FoundationKit-Prefix.pch"; + INFOPLIST_FILE = "FoundationKit-Info.plist"; + INSTALL_PATH = "@loader_path/../Frameworks"; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; DC410D0713C39BFD00C90C19 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -362,6 +502,7 @@ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = FoundationKit; SKIP_INSTALL = YES; }; name = Debug; @@ -379,6 +520,7 @@ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = FoundationKit; SKIP_INSTALL = YES; VALIDATE_PRODUCT = YES; }; @@ -389,7 +531,6 @@ buildSettings = { GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "FoundationKit-Prefix.pch"; - PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; @@ -398,7 +539,6 @@ buildSettings = { GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "FoundationKit-Prefix.pch"; - PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; @@ -414,6 +554,14 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + C5EF030313C980F600953F2B /* Build configuration list for PBXNativeTarget "FoundationKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C5EF030413C980F600953F2B /* Debug */, + C5EF030513C980F600953F2B /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; DC410CF913C39BFD00C90C19 /* Build configuration list for PBXProject "FoundationKit" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -423,7 +571,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - DC410D0913C39BFD00C90C19 /* Build configuration list for PBXNativeTarget "FoundationKit" */ = { + DC410D0913C39BFD00C90C19 /* Build configuration list for PBXNativeTarget "libFoundationKit" */ = { isa = XCConfigurationList; buildConfigurations = ( DC410D0A13C39BFD00C90C19 /* Debug */, diff --git a/FoundationKit.xcodeproj/xcshareddata/xcschemes/FoundationKit.xcscheme b/FoundationKit.xcodeproj/xcshareddata/xcschemes/FoundationKit.xcscheme index 55a8e94..f3a81c5 100644 --- a/FoundationKit.xcodeproj/xcshareddata/xcschemes/FoundationKit.xcscheme +++ b/FoundationKit.xcodeproj/xcshareddata/xcschemes/FoundationKit.xcscheme @@ -15,7 +15,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "DC410CFE13C39BFD00C90C19" BuildableName = "libFoundationKit.a" - BlueprintName = "FoundationKit" + BlueprintName = "libFoundationKit" ReferencedContainer = "container:FoundationKit.xcodeproj"> @@ -33,6 +33,20 @@ ReferencedContainer = "container:FoundationKit.xcodeproj"> + + + + Date: Sun, 10 Jul 2011 09:32:11 +0200 Subject: [PATCH 2/3] Weakly link Audio toolkits --- FoundationKit.xcodeproj/project.pbxproj | 23 ++++++++++++++++++++++- Sources/FoundationKit.h | 3 +-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/FoundationKit.xcodeproj/project.pbxproj b/FoundationKit.xcodeproj/project.pbxproj index 28ac7dd..82b8cb8 100644 --- a/FoundationKit.xcodeproj/project.pbxproj +++ b/FoundationKit.xcodeproj/project.pbxproj @@ -48,7 +48,14 @@ C5EF034A13C9813E00953F2B /* NSString+NKConcise.h in Headers */ = {isa = PBXBuildFile; fileRef = DC1CF42E13C484A400E5BEBC /* NSString+NKConcise.h */; settings = {ATTRIBUTES = (Public, ); }; }; C5EF034B13C9813E00953F2B /* NSValue+NKConcise.h in Headers */ = {isa = PBXBuildFile; fileRef = DC1CF42A13C4848200E5BEBC /* NSValue+NKConcise.h */; settings = {ATTRIBUTES = (Public, ); }; }; C5EF034C13C9813E00953F2B /* NSObject+NKAssociatedObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 399F4CD213C905C70008CC0E /* NSObject+NKAssociatedObjects.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DC410D0313C39BFD00C90C19 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC410D0213C39BFD00C90C19 /* Foundation.framework */; }; + C5EF036713C98C1C00953F2B /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5EF036513C98C1C00953F2B /* AudioToolbox.framework */; }; + C5EF036813C98C1C00953F2B /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5EF036613C98C1C00953F2B /* AudioUnit.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + C5EF036A13C98C3200953F2B /* NKAudioRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E319F713C4E90B00D9CA76 /* NKAudioRecorder.m */; }; + C5EF036B13C98C4D00953F2B /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5EF036513C98C1C00953F2B /* AudioToolbox.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + C5EF036C13C98C4D00953F2B /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5EF036613C98C1C00953F2B /* AudioUnit.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + C5EF036E13C98C7E00953F2B /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5EF036D13C98C7E00953F2B /* CoreAudio.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + C5EF037213C98CC500953F2B /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5EF036D13C98C7E00953F2B /* CoreAudio.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + DC410D0313C39BFD00C90C19 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC410D0213C39BFD00C90C19 /* Foundation.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; DCB0127213C4AE9400AB692F /* NSError+NKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DCB0127013C4AE9400AB692F /* NSError+NKAdditions.m */; }; DCF68FBF13C74ADB0057517A /* NSObject+NKSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = DCF68FBD13C74ADB0057517A /* NSObject+NKSwizzle.m */; }; /* End PBXBuildFile section */ @@ -91,6 +98,9 @@ C5E31A0A13C4EC8700D9CA76 /* NKShorthands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NKShorthands.h; sourceTree = ""; }; C5EF02F513C980F600953F2B /* FoundationKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FoundationKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C5EF02FE13C980F600953F2B /* FoundationKit-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FoundationKit-Info.plist"; sourceTree = ""; }; + C5EF036513C98C1C00953F2B /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = ""; }; + C5EF036613C98C1C00953F2B /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = ""; }; + C5EF036D13C98C7E00953F2B /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = ""; }; DC1CF42313C483BC00E5BEBC /* NSArray+NKConcise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+NKConcise.h"; sourceTree = ""; }; DC1CF42613C4845D00E5BEBC /* NSNumber+NKConcise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNumber+NKConcise.h"; sourceTree = ""; }; DC1CF42813C4847200E5BEBC /* NSDictionary+NKConcise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+NKConcise.h"; sourceTree = ""; }; @@ -121,6 +131,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + C5EF036E13C98C7E00953F2B /* CoreAudio.framework in Frameworks */, + C5EF036B13C98C4D00953F2B /* AudioToolbox.framework in Frameworks */, + C5EF036C13C98C4D00953F2B /* AudioUnit.framework in Frameworks */, C5EF030813C9811600953F2B /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -129,6 +142,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + C5EF037213C98CC500953F2B /* CoreAudio.framework in Frameworks */, + C5EF036713C98C1C00953F2B /* AudioToolbox.framework in Frameworks */, + C5EF036813C98C1C00953F2B /* AudioUnit.framework in Frameworks */, DC410D0313C39BFD00C90C19 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -226,6 +242,9 @@ DC410D0113C39BFD00C90C19 /* Frameworks */ = { isa = PBXGroup; children = ( + C5EF036D13C98C7E00953F2B /* CoreAudio.framework */, + C5EF036513C98C1C00953F2B /* AudioToolbox.framework */, + C5EF036613C98C1C00953F2B /* AudioUnit.framework */, DC410D0213C39BFD00C90C19 /* Foundation.framework */, C5C18E7B13C8C64C00DD0872 /* SenTestingKit.framework */, ); @@ -396,6 +415,7 @@ C5EF033713C9812400953F2B /* NSMutableDictionary+NKBlocks.m in Sources */, C5EF033813C9812400953F2B /* NSObject+NKSwizzle.m in Sources */, C5EF033913C9812400953F2B /* NSObject+NKAssociatedObjects.m in Sources */, + C5EF036A13C98C3200953F2B /* NKAudioRecorder.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -561,6 +581,7 @@ C5EF030513C980F600953F2B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; DC410CF913C39BFD00C90C19 /* Build configuration list for PBXProject "FoundationKit" */ = { isa = XCConfigurationList; diff --git a/Sources/FoundationKit.h b/Sources/FoundationKit.h index 4134b9e..bbc0216 100644 --- a/Sources/FoundationKit.h +++ b/Sources/FoundationKit.h @@ -1,7 +1,6 @@ // Part of FoundationKit http://foundationk.it -//#import "Audio/NKAudioRecorder.h" - +#import "NKAudioRecorder.h" #import "NKShorthands.h" #import "NKLog.h" From c39a0eb44b51d8f95b729240e9b7ebd7c38210c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Sun, 10 Jul 2011 11:05:01 +0200 Subject: [PATCH 3/3] Add blank/presence, trimmed, stringRange to NSString --- FoundationKit.xcodeproj/project.pbxproj | 34 ++++++++++++++++----- Sources/FoundationKit.h | 1 + Sources/NSString+NKAdditions.h | 12 ++++++++ Sources/NSString+NKAdditions.m | 29 ++++++++++++++++++ Tests/NSStringAdditionsTests.h | 5 ++++ Tests/NSStringAdditionsTests.m | 40 +++++++++++++++++++++++++ 6 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 Sources/NSString+NKAdditions.h create mode 100644 Sources/NSString+NKAdditions.m create mode 100644 Tests/NSStringAdditionsTests.h create mode 100644 Tests/NSStringAdditionsTests.m diff --git a/FoundationKit.xcodeproj/project.pbxproj b/FoundationKit.xcodeproj/project.pbxproj index a6a5984..4b63496 100644 --- a/FoundationKit.xcodeproj/project.pbxproj +++ b/FoundationKit.xcodeproj/project.pbxproj @@ -12,10 +12,15 @@ C582BF8C13C8B77C0012DF67 /* NKLog.m in Sources */ = {isa = PBXBuildFile; fileRef = C582BF8A13C8B77C0012DF67 /* NKLog.m */; }; C5AAAA4413C9920900E44CE7 /* NKSynthesizeSingleton.h in Headers */ = {isa = PBXBuildFile; fileRef = 399F4CD913C90B210008CC0E /* NKSynthesizeSingleton.h */; settings = {ATTRIBUTES = (Public, ); }; }; C5AAAA4513C9920900E44CE7 /* NKMath.h in Headers */ = {isa = PBXBuildFile; fileRef = 39EA898A13C98C6C00B6427F /* NKMath.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5AAAA6213C99A0A00E44CE7 /* NSString+NKAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = C5AAAA6013C99A0A00E44CE7 /* NSString+NKAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C5AAAA6313C99A0A00E44CE7 /* NSString+NKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = C5AAAA6113C99A0A00E44CE7 /* NSString+NKAdditions.m */; }; + C5AAAA6413C99A0A00E44CE7 /* NSString+NKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = C5AAAA6113C99A0A00E44CE7 /* NSString+NKAdditions.m */; }; + C5AAAA6813C99DC900E44CE7 /* NSStringAdditionsTests.h in Headers */ = {isa = PBXBuildFile; fileRef = C5AAAA6613C99DC900E44CE7 /* NSStringAdditionsTests.h */; }; + C5AAAA6B13C99DD200E44CE7 /* NSStringAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C5AAAA6713C99DC900E44CE7 /* NSStringAdditionsTests.m */; }; + C5AAAA6E13C99FAD00E44CE7 /* FoundationKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5EF02F513C980F600953F2B /* FoundationKit.framework */; }; C5C18E7C13C8C64C00DD0872 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5C18E7B13C8C64C00DD0872 /* SenTestingKit.framework */; }; C5C18E9713C8C72D00DD0872 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC410D0213C39BFD00C90C19 /* Foundation.framework */; }; C5C18EC213C8CE9800DD0872 /* NKLogTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C5C18EBC13C8CCDF00DD0872 /* NKLogTests.m */; }; - C5C18EC313C8CF1A00DD0872 /* libFoundationKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DC410CFF13C39BFD00C90C19 /* libFoundationKit.a */; }; C5E319D413C4744800D9CA76 /* NSData+NKCrypto.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E319D213C4744800D9CA76 /* NSData+NKCrypto.m */; }; C5E319F913C4E90B00D9CA76 /* NKAudioRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E319F713C4E90B00D9CA76 /* NKAudioRecorder.m */; }; C5E31A0313C4EA7E00D9CA76 /* NSArray+NKBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E319FB13C4EA7C00D9CA76 /* NSArray+NKBlocks.m */; }; @@ -65,11 +70,11 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - C5C18E9213C8C65100DD0872 /* PBXContainerItemProxy */ = { + C5AAAA6C13C99FA600E44CE7 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = DC410CF613C39BFD00C90C19 /* Project object */; proxyType = 1; - remoteGlobalIDString = DC410CFE13C39BFD00C90C19; + remoteGlobalIDString = C5EF02F413C980F600953F2B; remoteInfo = FoundationKit; }; /* End PBXContainerItemProxy section */ @@ -82,6 +87,10 @@ 39EA898B13C98C6C00B6427F /* NKMath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NKMath.m; sourceTree = ""; }; C582BF8913C8B77C0012DF67 /* NKLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NKLog.h; sourceTree = ""; }; C582BF8A13C8B77C0012DF67 /* NKLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NKLog.m; sourceTree = ""; }; + C5AAAA6013C99A0A00E44CE7 /* NSString+NKAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+NKAdditions.h"; sourceTree = ""; }; + C5AAAA6113C99A0A00E44CE7 /* NSString+NKAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+NKAdditions.m"; sourceTree = ""; }; + C5AAAA6613C99DC900E44CE7 /* NSStringAdditionsTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSStringAdditionsTests.h; sourceTree = ""; }; + C5AAAA6713C99DC900E44CE7 /* NSStringAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSStringAdditionsTests.m; sourceTree = ""; }; C5C18E7A13C8C64C00DD0872 /* Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; C5C18E7B13C8C64C00DD0872 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; C5C18E8D13C8C64C00DD0872 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; @@ -130,7 +139,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C5C18EC313C8CF1A00DD0872 /* libFoundationKit.a in Frameworks */, + C5AAAA6E13C99FAD00E44CE7 /* FoundationKit.framework in Frameworks */, C5C18E9713C8C72D00DD0872 /* Foundation.framework in Frameworks */, C5C18E7C13C8C64C00DD0872 /* SenTestingKit.framework in Frameworks */, ); @@ -166,6 +175,8 @@ children = ( C5C18EBB13C8CCDF00DD0872 /* NKLogTests.h */, C5C18EBC13C8CCDF00DD0872 /* NKLogTests.m */, + C5AAAA6613C99DC900E44CE7 /* NSStringAdditionsTests.h */, + C5AAAA6713C99DC900E44CE7 /* NSStringAdditionsTests.m */, C5EF038513C98EC100953F2B /* NKSynthesizeSingletonTests.h */, C5EF038613C98EC100953F2B /* NKSynthesizeSingletonTests.m */, C5C18EBD13C8CCDF00DD0872 /* Tests-Info.plist */, @@ -204,6 +215,8 @@ DCF68FBC13C74ADB0057517A /* NSObject+NKSwizzle.h */, DCF68FBD13C74ADB0057517A /* NSObject+NKSwizzle.m */, DC1CF43013C484B800E5BEBC /* NSSet+NKConcise.h */, + C5AAAA6013C99A0A00E44CE7 /* NSString+NKAdditions.h */, + C5AAAA6113C99A0A00E44CE7 /* NSString+NKAdditions.m */, DC1CF42E13C484A400E5BEBC /* NSString+NKConcise.h */, DC1CF42A13C4848200E5BEBC /* NSValue+NKConcise.h */, 399F4CD213C905C70008CC0E /* NSObject+NKAssociatedObjects.h */, @@ -293,6 +306,8 @@ C5AAAA4413C9920900E44CE7 /* NKSynthesizeSingleton.h in Headers */, C5EF034B13C9813E00953F2B /* NSValue+NKConcise.h in Headers */, C5EF034C13C9813E00953F2B /* NSObject+NKAssociatedObjects.h in Headers */, + C5AAAA6213C99A0A00E44CE7 /* NSString+NKAdditions.h in Headers */, + C5AAAA6813C99DC900E44CE7 /* NSStringAdditionsTests.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -311,7 +326,7 @@ buildRules = ( ); dependencies = ( - C5C18E9313C8C65100DD0872 /* PBXTargetDependency */, + C5AAAA6D13C99FA600E44CE7 /* PBXTargetDependency */, ); name = Tests; productName = Tests; @@ -416,6 +431,7 @@ files = ( C5C18EC213C8CE9800DD0872 /* NKLogTests.m in Sources */, C5EF038913C98ECE00953F2B /* NKSynthesizeSingletonTests.m in Sources */, + C5AAAA6B13C99DD200E44CE7 /* NSStringAdditionsTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -433,6 +449,7 @@ C5EF033813C9812400953F2B /* NSObject+NKSwizzle.m in Sources */, C5EF033913C9812400953F2B /* NSObject+NKAssociatedObjects.m in Sources */, C5EF036A13C98C3200953F2B /* NKAudioRecorder.m in Sources */, + C5AAAA6413C99A0A00E44CE7 /* NSString+NKAdditions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -451,16 +468,17 @@ C582BF8C13C8B77C0012DF67 /* NKLog.m in Sources */, 399F4CD413C905C70008CC0E /* NSObject+NKAssociatedObjects.m in Sources */, 39EA898C13C98C6C00B6427F /* NKMath.m in Sources */, + C5AAAA6313C99A0A00E44CE7 /* NSString+NKAdditions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - C5C18E9313C8C65100DD0872 /* PBXTargetDependency */ = { + C5AAAA6D13C99FA600E44CE7 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = DC410CFE13C39BFD00C90C19 /* libFoundationKit */; - targetProxy = C5C18E9213C8C65100DD0872 /* PBXContainerItemProxy */; + target = C5EF02F413C980F600953F2B /* FoundationKit */; + targetProxy = C5AAAA6C13C99FA600E44CE7 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ diff --git a/Sources/FoundationKit.h b/Sources/FoundationKit.h index 37a9d26..3a27a19 100644 --- a/Sources/FoundationKit.h +++ b/Sources/FoundationKit.h @@ -21,3 +21,4 @@ #import "NSData+NKCrypto.h" #import "NSError+NKAdditions.h" +#import "NSString+NKAdditions.h" diff --git a/Sources/NSString+NKAdditions.h b/Sources/NSString+NKAdditions.h new file mode 100644 index 0000000..a187fe7 --- /dev/null +++ b/Sources/NSString+NKAdditions.h @@ -0,0 +1,12 @@ +#import + +@interface NSString (NKAdditions) + +// see https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/object/blank.rb +- (BOOL)isBlank; +- (BOOL)isEmpty; +- (NSString *)presence; +- (NSRange)stringRange; +- (NSString *)trimmed; + +@end diff --git a/Sources/NSString+NKAdditions.m b/Sources/NSString+NKAdditions.m new file mode 100644 index 0000000..b7c9eea --- /dev/null +++ b/Sources/NSString+NKAdditions.m @@ -0,0 +1,29 @@ +#import "NSString+NKAdditions.h" + +@implementation NSString (NKAdditions) + +- (BOOL)isBlank { + return [[self trimmed] isEmpty]; +} + +- (BOOL)isEmpty { + return ([self length] == 0); +} + +- (NSString *)presence { + if([self isBlank]) { + return nil; + } else { + return self; + } +} + +- (NSRange)stringRange { + return NSMakeRange(0, [self length]); +} + +- (NSString *)trimmed { + return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; +} + +@end diff --git a/Tests/NSStringAdditionsTests.h b/Tests/NSStringAdditionsTests.h new file mode 100644 index 0000000..4cedc3e --- /dev/null +++ b/Tests/NSStringAdditionsTests.h @@ -0,0 +1,5 @@ +#import "NSString+NKAdditions.h" + +@interface NSStringAdditionsTests : SenTestCase + +@end diff --git a/Tests/NSStringAdditionsTests.m b/Tests/NSStringAdditionsTests.m new file mode 100644 index 0000000..deb1d01 --- /dev/null +++ b/Tests/NSStringAdditionsTests.m @@ -0,0 +1,40 @@ +#import "NSStringAdditionsTests.h" + +@implementation NSStringAdditionsTests + +- (void)testIsBlank { + STAssertTrue([@" " isBlank], @"only whitespace"); + STAssertTrue([@" " isBlank], @"whitespace + tab"); + STAssertTrue([@"" isBlank], @"empty"); + STAssertFalse([@"asd" isBlank], @"no whitespace"); + STAssertFalse([@" asd " isBlank], @"leading/trailing whitespace"); +} + +- (void)testIsEmpty { + STAssertFalse([@" " isEmpty], @"only whitespace"); + STAssertFalse([@" " isEmpty], @"whitespace + tab"); + STAssertTrue([@"" isEmpty], @"empty"); + STAssertFalse([@"asd" isEmpty], @"no whitespace"); + STAssertFalse([@" asd " isEmpty], @"leading/trailing whitespace"); +} + +- (void)testPresence { + STAssertEquals([@" " presence], (NSString *)nil, @"nil for blank"); + STAssertEquals([@"asd" presence], @"asd", @"self otherwise"); +} + +- (void)testStringRange { + STAssertEquals([@"" stringRange], NSMakeRange(0, 0), @"empty"); + STAssertEquals([@"asd" stringRange], NSMakeRange(0, 3), @"non empty"); +} + +- (void)testTrimmed { + STAssertEqualObjects([@" " trimmed], @"", @"only whitespace"); + STAssertEqualObjects([@" " trimmed], @"", @"whitespace + tab"); + STAssertEqualObjects([@"" trimmed], @"", @"empty"); + STAssertEqualObjects([@"asd" trimmed], @"asd", @"no whitespace"); + STAssertEqualObjects([@" asd " trimmed], @"asd", @"leading/trailing whitespace"); + STAssertEqualObjects([@" asd qwe " trimmed], @"asd qwe", @"leading/trailing whitespace, whitespace between words"); +} + +@end