Permalink
Browse files

Add an example project

  • Loading branch information...
1 parent 093e672 commit 0f7d7e8b86a2009fa249f3f00f003034d04b20bf Abizer Nasir committed Nov 9, 2011
View
12 AppledocSettings.plist
@@ -1,12 +0,0 @@
-<?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>--project-name</key>
- <string>NSTimer+JCSBlocks</string>
- <key>--create-html</key>
- <true/>
- <key>--create-docset</key>
- <false/>
-</dict>
-</plist>
View
299 TimerTester.xcodeproj/project.pbxproj
@@ -0,0 +1,299 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ EE6CEBA91469B02D00C28147 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE6CEBA81469B02D00C28147 /* Cocoa.framework */; };
+ EE6CEBB31469B02D00C28147 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EE6CEBB11469B02D00C28147 /* InfoPlist.strings */; };
+ EE6CEBB51469B02D00C28147 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6CEBB41469B02D00C28147 /* main.m */; };
+ EE6CEBBC1469B02D00C28147 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6CEBBB1469B02D00C28147 /* AppDelegate.m */; };
+ EE6CEBBF1469B02E00C28147 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = EE6CEBBD1469B02E00C28147 /* MainMenu.xib */; };
+ EE6CEBC81469B09B00C28147 /* NSTimer+JCSBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6CEBC71469B09B00C28147 /* NSTimer+JCSBlocks.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ EE6CEBA41469B02D00C28147 /* TimerTester.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TimerTester.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ EE6CEBA81469B02D00C28147 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
+ EE6CEBAB1469B02D00C28147 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
+ EE6CEBAC1469B02D00C28147 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
+ EE6CEBAD1469B02D00C28147 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ EE6CEBB01469B02D00C28147 /* TimerTester-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TimerTester-Info.plist"; sourceTree = "<group>"; };
+ EE6CEBB21469B02D00C28147 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ EE6CEBB41469B02D00C28147 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ EE6CEBB61469B02D00C28147 /* TimerTester-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TimerTester-Prefix.pch"; sourceTree = "<group>"; };
+ EE6CEBBA1469B02D00C28147 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ EE6CEBBB1469B02D00C28147 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ EE6CEBBE1469B02E00C28147 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ EE6CEBC61469B09B00C28147 /* NSTimer+JCSBlocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTimer+JCSBlocks.h"; sourceTree = SOURCE_ROOT; };
+ EE6CEBC71469B09B00C28147 /* NSTimer+JCSBlocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTimer+JCSBlocks.m"; sourceTree = SOURCE_ROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ EE6CEBA11469B02D00C28147 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ EE6CEBA91469B02D00C28147 /* Cocoa.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ EE6CEB991469B02D00C28147 = {
+ isa = PBXGroup;
+ children = (
+ EE6CEBAE1469B02D00C28147 /* TimerTester */,
+ EE6CEBA71469B02D00C28147 /* Frameworks */,
+ EE6CEBA51469B02D00C28147 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ EE6CEBA51469B02D00C28147 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ EE6CEBA41469B02D00C28147 /* TimerTester.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ EE6CEBA71469B02D00C28147 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ EE6CEBA81469B02D00C28147 /* Cocoa.framework */,
+ EE6CEBAA1469B02D00C28147 /* Other Frameworks */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ EE6CEBAA1469B02D00C28147 /* Other Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ EE6CEBAB1469B02D00C28147 /* AppKit.framework */,
+ EE6CEBAC1469B02D00C28147 /* CoreData.framework */,
+ EE6CEBAD1469B02D00C28147 /* Foundation.framework */,
+ );
+ name = "Other Frameworks";
+ sourceTree = "<group>";
+ };
+ EE6CEBAE1469B02D00C28147 /* TimerTester */ = {
+ isa = PBXGroup;
+ children = (
+ EE6CEBBA1469B02D00C28147 /* AppDelegate.h */,
+ EE6CEBBB1469B02D00C28147 /* AppDelegate.m */,
+ EE6CEBBD1469B02E00C28147 /* MainMenu.xib */,
+ EE6CEBC51469B07E00C28147 /* Categories */,
+ EE6CEBAF1469B02D00C28147 /* Supporting Files */,
+ );
+ path = TimerTester;
+ sourceTree = "<group>";
+ };
+ EE6CEBAF1469B02D00C28147 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ EE6CEBB01469B02D00C28147 /* TimerTester-Info.plist */,
+ EE6CEBB11469B02D00C28147 /* InfoPlist.strings */,
+ EE6CEBB41469B02D00C28147 /* main.m */,
+ EE6CEBB61469B02D00C28147 /* TimerTester-Prefix.pch */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ EE6CEBC51469B07E00C28147 /* Categories */ = {
+ isa = PBXGroup;
+ children = (
+ EE6CEBC61469B09B00C28147 /* NSTimer+JCSBlocks.h */,
+ EE6CEBC71469B09B00C28147 /* NSTimer+JCSBlocks.m */,
+ );
+ name = Categories;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ EE6CEBA31469B02D00C28147 /* TimerTester */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = EE6CEBC21469B02E00C28147 /* Build configuration list for PBXNativeTarget "TimerTester" */;
+ buildPhases = (
+ EE6CEBA01469B02D00C28147 /* Sources */,
+ EE6CEBA11469B02D00C28147 /* Frameworks */,
+ EE6CEBA21469B02D00C28147 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = TimerTester;
+ productName = TimerTester;
+ productReference = EE6CEBA41469B02D00C28147 /* TimerTester.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ EE6CEB9B1469B02D00C28147 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0420;
+ ORGANIZATIONNAME = "Jungle Candy Software";
+ };
+ buildConfigurationList = EE6CEB9E1469B02D00C28147 /* Build configuration list for PBXProject "TimerTester" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = EE6CEB991469B02D00C28147;
+ productRefGroup = EE6CEBA51469B02D00C28147 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ EE6CEBA31469B02D00C28147 /* TimerTester */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ EE6CEBA21469B02D00C28147 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ EE6CEBB31469B02D00C28147 /* InfoPlist.strings in Resources */,
+ EE6CEBBF1469B02E00C28147 /* MainMenu.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ EE6CEBA01469B02D00C28147 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ EE6CEBB51469B02D00C28147 /* main.m in Sources */,
+ EE6CEBBC1469B02D00C28147 /* AppDelegate.m in Sources */,
+ EE6CEBC81469B09B00C28147 /* NSTimer+JCSBlocks.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ EE6CEBB11469B02D00C28147 /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ EE6CEBB21469B02D00C28147 /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ EE6CEBBD1469B02E00C28147 /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ EE6CEBBE1469B02E00C28147 /* en */,
+ );
+ name = MainMenu.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ EE6CEBC01469B02E00C28147 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ EE6CEBC11469B02E00C28147 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ EE6CEBC31469B02E00C28147 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "TimerTester/TimerTester-Prefix.pch";
+ INFOPLIST_FILE = "TimerTester/TimerTester-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ EE6CEBC41469B02E00C28147 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "TimerTester/TimerTester-Prefix.pch";
+ INFOPLIST_FILE = "TimerTester/TimerTester-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ EE6CEB9E1469B02D00C28147 /* Build configuration list for PBXProject "TimerTester" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ EE6CEBC01469B02E00C28147 /* Debug */,
+ EE6CEBC11469B02E00C28147 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ EE6CEBC21469B02E00C28147 /* Build configuration list for PBXNativeTarget "TimerTester" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ EE6CEBC31469B02E00C28147 /* Debug */,
+ EE6CEBC41469B02E00C28147 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = EE6CEB9B1469B02D00C28147 /* Project object */;
+}
View
17 TimerTester/AppDelegate.h
@@ -0,0 +1,17 @@
+//
+// AppDelegate.h
+// TimerTester
+//
+// Created by Abizer Nasir on 08/11/2011.
+// Copyright (c) 2011 Jungle Candy Software. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@interface AppDelegate : NSObject <NSApplicationDelegate>
+
+@property (assign) IBOutlet NSWindow *window;
+@property (strong, nonatomic) NSTimer *timer1;
+@property (strong, nonatomic) NSTimer *timer2;
+
+@end
View
45 TimerTester/AppDelegate.m
@@ -0,0 +1,45 @@
+//
+// AppDelegate.m
+// TimerTester
+//
+// Created by Abizer Nasir on 08/11/2011.
+// Copyright (c) 2011 Jungle Candy Software. All rights reserved.
+//
+
+#import "AppDelegate.h"
+#import "NSTimer+JCSBlocks.h"
+
+@implementation AppDelegate
+
+@synthesize window = _window;
+@synthesize timer1 = _timer1;
+@synthesize timer2 = _timer2;
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
+ __block NSInteger count = 0;
+
+ // This timer will fire continuously
+ self.timer1 = [NSTimer jcs_scheduledTimerWithTimeInterval:1.5 repeats:YES blockHandler:^{
+ NSLog(@"Hello World");
+
+ // Will randomly set the __block variable count to 8 to stop the second timer.
+ NSInteger value = arc4random() % 3;
+ if (value == 2) {
+ count = 8;
+ }
+ }];
+
+ // This timer will fire until the `count` variable becomes 8. either by being set within the block,
+ // or from elsewhere.
+ self.timer2 = [NSTimer jcs_scheduledInterruptableTimerWithTimeInterval:1 blockHandler:^(BOOL *stop){
+ count++;
+ NSLog(@"Hello Universe: %ld", count);
+
+ if (count >= 8) {
+ *stop = YES;
+ }
+ }];
+
+}
+
+@end
View
34 TimerTester/TimerTester-Info.plist
@@ -0,0 +1,34 @@
+<?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>en</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.junglecandy.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>${MACOSX_DEPLOYMENT_TARGET}</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2011 Jungle Candy Software. All rights reserved.</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
View
35 TimerTester/TimerTester-Prefix.pch
@@ -0,0 +1,35 @@
+//
+// Prefix header for all source files of the 'TimerTester' target in the 'TimerTester' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif
+
+// Useful Macros.
+// See http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/ for details.
+
+#ifdef DEBUG
+#define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
+#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
+#else
+#define DLog(...) do { } while (0)
+#ifndef NS_BLOCK_ASSERTIONS
+#define NS_BLOCK_ASSERTIONS
+#endif
+#define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
+#endif
+
+#define ZAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0)
+
+//
+// This is a general test for emptiness
+// Courtesy of Wil Shipley http://www.wilshipley.com/blog/2005/10/pimp-my-code-interlude-free-code.html
+
+static inline BOOL isEmpty(id thing) {
+ return thing == nil
+ || ([thing respondsToSelector:@selector(length)]
+ && [(NSData *)thing length] == 0)
+ || ([thing respondsToSelector:@selector(count)]
+ && [(NSArray *)thing count] == 0);
+}
View
2 TimerTester/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
View
4,582 TimerTester/en.lproj/MainMenu.xib
4,582 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
14 TimerTester/main.m
@@ -0,0 +1,14 @@
+//
+// main.m
+// TimerTester
+//
+// Created by Abizer Nasir on 08/11/2011.
+// Copyright (c) 2011 Jungle Candy Software. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, char *argv[])
+{
+ return NSApplicationMain(argc, (const char **)argv);
+}

0 comments on commit 0f7d7e8

Please sign in to comment.