Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .framework target #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions FoundationKit-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>it.foundationk.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2011 __MyCompanyName__. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
225 changes: 208 additions & 17 deletions FoundationKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "DC410CFE13C39BFD00C90C19"
BuildableName = "libFoundationKit.a"
BlueprintName = "FoundationKit"
BlueprintName = "libFoundationKit"
ReferencedContainer = "container:FoundationKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -33,6 +33,20 @@
ReferencedContainer = "container:FoundationKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5EF02F413C980F600953F2B"
BuildableName = "FoundationKit.framework"
BlueprintName = "FoundationKit"
ReferencedContainer = "container:FoundationKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
Expand Down
4 changes: 2 additions & 2 deletions Sources/FoundationKit.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Part of FoundationKit http://foundationk.it

#import "Audio/NKAudioRecorder.h"

#import "NKAudioRecorder.h"
#import "NKShorthands.h"
#import "NKSynthesizeSingleton.h"
#import "NKLog.h"
Expand All @@ -22,3 +21,4 @@

#import "NSData+NKCrypto.h"
#import "NSError+NKAdditions.h"
#import "NSString+NKAdditions.h"
12 changes: 12 additions & 0 deletions Sources/NSString+NKAdditions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#import <Foundation/Foundation.h>

@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
29 changes: 29 additions & 0 deletions Sources/NSString+NKAdditions.m
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions Tests/NSStringAdditionsTests.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import "NSString+NKAdditions.h"

@interface NSStringAdditionsTests : SenTestCase

@end
40 changes: 40 additions & 0 deletions Tests/NSStringAdditionsTests.m
Original file line number Diff line number Diff line change
@@ -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