From 06dfe157acb177cbfc3fb7278716bfc9cda69e3d Mon Sep 17 00:00:00 2001 From: kujenga Date: Thu, 21 May 2015 10:09:03 -0400 Subject: [PATCH 1/8] added skeleton mac example --- EDQueue/EDQueue.h | 2 +- Project/macqueue.xcodeproj/project.pbxproj | 403 ++++++++++ .../contents.xcworkspacedata | 7 + Project/macqueue/AppDelegate.h | 15 + Project/macqueue/AppDelegate.m | 25 + Project/macqueue/Base.lproj/Main.storyboard | 746 ++++++++++++++++++ .../AppIcon.appiconset/Contents.json | 58 ++ Project/macqueue/Info.plist | 34 + Project/macqueue/ViewController.h | 15 + Project/macqueue/ViewController.m | 25 + Project/macqueue/main.m | 13 + .../contents.xcworkspacedata | 10 + 12 files changed, 1352 insertions(+), 1 deletion(-) create mode 100644 Project/macqueue.xcodeproj/project.pbxproj create mode 100644 Project/macqueue.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Project/macqueue/AppDelegate.h create mode 100644 Project/macqueue/AppDelegate.m create mode 100644 Project/macqueue/Base.lproj/Main.storyboard create mode 100644 Project/macqueue/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Project/macqueue/Info.plist create mode 100644 Project/macqueue/ViewController.h create mode 100644 Project/macqueue/ViewController.m create mode 100644 Project/macqueue/main.m create mode 100644 Project/queues.xcworkspace/contents.xcworkspacedata diff --git a/EDQueue/EDQueue.h b/EDQueue/EDQueue.h index 9d49848..da14d2a 100755 --- a/EDQueue/EDQueue.h +++ b/EDQueue/EDQueue.h @@ -6,7 +6,7 @@ // Copyright (c) 2012 Andrew Sliwinski. All rights reserved. // -#import +#import typedef NS_ENUM(NSInteger, EDQueueResult) { EDQueueResultSuccess = 0, diff --git a/Project/macqueue.xcodeproj/project.pbxproj b/Project/macqueue.xcodeproj/project.pbxproj new file mode 100644 index 0000000..92da5af --- /dev/null +++ b/Project/macqueue.xcodeproj/project.pbxproj @@ -0,0 +1,403 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 86887ABF1B0E19A900BB35FD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887ABE1B0E19A900BB35FD /* AppDelegate.m */; }; + 86887AC11B0E19A900BB35FD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887AC01B0E19A900BB35FD /* main.m */; }; + 86887AC41B0E19A900BB35FD /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887AC31B0E19A900BB35FD /* ViewController.m */; }; + 86887AC61B0E19A900BB35FD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 86887AC51B0E19A900BB35FD /* Images.xcassets */; }; + 86887AC91B0E19A900BB35FD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 86887AC71B0E19A900BB35FD /* Main.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 86887ACF1B0E19A900BB35FD /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 86887AB01B0E19A900BB35FD /* Project object */; + proxyType = 1; + remoteGlobalIDString = 86887AB71B0E19A900BB35FD; + remoteInfo = macqueue; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 86887AB81B0E19A900BB35FD /* macqueue.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = macqueue.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 86887ABC1B0E19A900BB35FD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 86887ABD1B0E19A900BB35FD /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 86887ABE1B0E19A900BB35FD /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 86887AC01B0E19A900BB35FD /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 86887AC21B0E19A900BB35FD /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 86887AC31B0E19A900BB35FD /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 86887AC51B0E19A900BB35FD /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 86887AC81B0E19A900BB35FD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 86887ACE1B0E19A900BB35FD /* macqueueTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = macqueueTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 86887AB51B0E19A900BB35FD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 86887ACB1B0E19A900BB35FD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 86887AAF1B0E19A900BB35FD = { + isa = PBXGroup; + children = ( + 86887ABA1B0E19A900BB35FD /* Example */, + 86887AB91B0E19A900BB35FD /* Products */, + ); + sourceTree = ""; + }; + 86887AB91B0E19A900BB35FD /* Products */ = { + isa = PBXGroup; + children = ( + 86887AB81B0E19A900BB35FD /* macqueue.app */, + 86887ACE1B0E19A900BB35FD /* macqueueTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 86887ABA1B0E19A900BB35FD /* Example */ = { + isa = PBXGroup; + children = ( + 86887ABD1B0E19A900BB35FD /* AppDelegate.h */, + 86887ABE1B0E19A900BB35FD /* AppDelegate.m */, + 86887AC21B0E19A900BB35FD /* ViewController.h */, + 86887AC31B0E19A900BB35FD /* ViewController.m */, + 86887AC51B0E19A900BB35FD /* Images.xcassets */, + 86887AC71B0E19A900BB35FD /* Main.storyboard */, + 86887ABB1B0E19A900BB35FD /* Supporting Files */, + ); + name = Example; + path = macqueue; + sourceTree = ""; + }; + 86887ABB1B0E19A900BB35FD /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 86887ABC1B0E19A900BB35FD /* Info.plist */, + 86887AC01B0E19A900BB35FD /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 86887AB71B0E19A900BB35FD /* macqueue */ = { + isa = PBXNativeTarget; + buildConfigurationList = 86887AD81B0E19A900BB35FD /* Build configuration list for PBXNativeTarget "macqueue" */; + buildPhases = ( + 86887AB41B0E19A900BB35FD /* Sources */, + 86887AB51B0E19A900BB35FD /* Frameworks */, + 86887AB61B0E19A900BB35FD /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = macqueue; + productName = macqueue; + productReference = 86887AB81B0E19A900BB35FD /* macqueue.app */; + productType = "com.apple.product-type.application"; + }; + 86887ACD1B0E19A900BB35FD /* macqueueTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 86887ADB1B0E19A900BB35FD /* Build configuration list for PBXNativeTarget "macqueueTests" */; + buildPhases = ( + 86887ACA1B0E19A900BB35FD /* Sources */, + 86887ACB1B0E19A900BB35FD /* Frameworks */, + 86887ACC1B0E19A900BB35FD /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 86887AD01B0E19A900BB35FD /* PBXTargetDependency */, + ); + name = macqueueTests; + productName = macqueueTests; + productReference = 86887ACE1B0E19A900BB35FD /* macqueueTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 86887AB01B0E19A900BB35FD /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0630; + ORGANIZATIONNAME = "Aaron Taylor"; + TargetAttributes = { + 86887AB71B0E19A900BB35FD = { + CreatedOnToolsVersion = 6.3.1; + }; + 86887ACD1B0E19A900BB35FD = { + CreatedOnToolsVersion = 6.3.1; + TestTargetID = 86887AB71B0E19A900BB35FD; + }; + }; + }; + buildConfigurationList = 86887AB31B0E19A900BB35FD /* Build configuration list for PBXProject "macqueue" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 86887AAF1B0E19A900BB35FD; + productRefGroup = 86887AB91B0E19A900BB35FD /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 86887AB71B0E19A900BB35FD /* macqueue */, + 86887ACD1B0E19A900BB35FD /* macqueueTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 86887AB61B0E19A900BB35FD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 86887AC61B0E19A900BB35FD /* Images.xcassets in Resources */, + 86887AC91B0E19A900BB35FD /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 86887ACC1B0E19A900BB35FD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 86887AB41B0E19A900BB35FD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 86887AC41B0E19A900BB35FD /* ViewController.m in Sources */, + 86887AC11B0E19A900BB35FD /* main.m in Sources */, + 86887ABF1B0E19A900BB35FD /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 86887ACA1B0E19A900BB35FD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 86887AD01B0E19A900BB35FD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 86887AB71B0E19A900BB35FD /* macqueue */; + targetProxy = 86887ACF1B0E19A900BB35FD /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 86887AC71B0E19A900BB35FD /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 86887AC81B0E19A900BB35FD /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 86887AD61B0E19A900BB35FD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 86887AD71B0E19A900BB35FD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 86887AD91B0E19A900BB35FD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = macqueue/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 86887ADA1B0E19A900BB35FD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = macqueue/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 86887ADC1B0E19A900BB35FD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = macqueue/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/macqueue.app/Contents/MacOS/macqueue"; + }; + name = Debug; + }; + 86887ADD1B0E19A900BB35FD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + INFOPLIST_FILE = macqueue/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/macqueue.app/Contents/MacOS/macqueue"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 86887AB31B0E19A900BB35FD /* Build configuration list for PBXProject "macqueue" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 86887AD61B0E19A900BB35FD /* Debug */, + 86887AD71B0E19A900BB35FD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 86887AD81B0E19A900BB35FD /* Build configuration list for PBXNativeTarget "macqueue" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 86887AD91B0E19A900BB35FD /* Debug */, + 86887ADA1B0E19A900BB35FD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 86887ADB1B0E19A900BB35FD /* Build configuration list for PBXNativeTarget "macqueueTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 86887ADC1B0E19A900BB35FD /* Debug */, + 86887ADD1B0E19A900BB35FD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 86887AB01B0E19A900BB35FD /* Project object */; +} diff --git a/Project/macqueue.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Project/macqueue.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..92f6f46 --- /dev/null +++ b/Project/macqueue.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Project/macqueue/AppDelegate.h b/Project/macqueue/AppDelegate.h new file mode 100644 index 0000000..e7e3c48 --- /dev/null +++ b/Project/macqueue/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// macqueue +// +// Created by Aaron Taylor on 5/21/15. +// Copyright (c) 2015 Aaron Taylor. All rights reserved. +// + +#import + +@interface AppDelegate : NSObject + + +@end + diff --git a/Project/macqueue/AppDelegate.m b/Project/macqueue/AppDelegate.m new file mode 100644 index 0000000..7011790 --- /dev/null +++ b/Project/macqueue/AppDelegate.m @@ -0,0 +1,25 @@ +// +// AppDelegate.m +// macqueue +// +// Created by Aaron Taylor on 5/21/15. +// Copyright (c) 2015 Aaron Taylor. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application +} + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + +@end diff --git a/Project/macqueue/Base.lproj/Main.storyboard b/Project/macqueue/Base.lproj/Main.storyboard new file mode 100644 index 0000000..b7cc20e --- /dev/null +++ b/Project/macqueue/Base.lproj/Main.storyboard @@ -0,0 +1,746 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Project/macqueue/Images.xcassets/AppIcon.appiconset/Contents.json b/Project/macqueue/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2db2b1c --- /dev/null +++ b/Project/macqueue/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Project/macqueue/Info.plist b/Project/macqueue/Info.plist new file mode 100644 index 0000000..b7d3baa --- /dev/null +++ b/Project/macqueue/Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + com.diy.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2015 Aaron Taylor. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/Project/macqueue/ViewController.h b/Project/macqueue/ViewController.h new file mode 100644 index 0000000..1e50c62 --- /dev/null +++ b/Project/macqueue/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// macqueue +// +// Created by Aaron Taylor on 5/21/15. +// Copyright (c) 2015 Aaron Taylor. All rights reserved. +// + +#import + +@interface ViewController : NSViewController + + +@end + diff --git a/Project/macqueue/ViewController.m b/Project/macqueue/ViewController.m new file mode 100644 index 0000000..411d712 --- /dev/null +++ b/Project/macqueue/ViewController.m @@ -0,0 +1,25 @@ +// +// ViewController.m +// macqueue +// +// Created by Aaron Taylor on 5/21/15. +// Copyright (c) 2015 Aaron Taylor. All rights reserved. +// + +#import "ViewController.h" + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Do any additional setup after loading the view. +} + +- (void)setRepresentedObject:(id)representedObject { + [super setRepresentedObject:representedObject]; + + // Update the view, if already loaded. +} + +@end diff --git a/Project/macqueue/main.m b/Project/macqueue/main.m new file mode 100644 index 0000000..17272a8 --- /dev/null +++ b/Project/macqueue/main.m @@ -0,0 +1,13 @@ +// +// main.m +// macqueue +// +// Created by Aaron Taylor on 5/21/15. +// Copyright (c) 2015 Aaron Taylor. All rights reserved. +// + +#import + +int main(int argc, const char * argv[]) { + return NSApplicationMain(argc, argv); +} diff --git a/Project/queues.xcworkspace/contents.xcworkspacedata b/Project/queues.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..325d744 --- /dev/null +++ b/Project/queues.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + From 5d193720317292ddfc0d36ae34ec821912b92255 Mon Sep 17 00:00:00 2001 From: kujenga Date: Thu, 21 May 2015 10:41:13 -0400 Subject: [PATCH 2/8] ported example code to mac project --- Project/macqueue.xcodeproj/project.pbxproj | 188 ++++++++------------ Project/macqueue/AppDelegate.h | 5 +- Project/macqueue/AppDelegate.m | 24 ++- Project/macqueue/Base.lproj/Main.storyboard | 28 ++- Project/macqueue/ViewController.h | 6 + Project/macqueue/ViewController.m | 55 +++++- 6 files changed, 183 insertions(+), 123 deletions(-) diff --git a/Project/macqueue.xcodeproj/project.pbxproj b/Project/macqueue.xcodeproj/project.pbxproj index 92da5af..5b1cc66 100644 --- a/Project/macqueue.xcodeproj/project.pbxproj +++ b/Project/macqueue.xcodeproj/project.pbxproj @@ -12,18 +12,16 @@ 86887AC41B0E19A900BB35FD /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887AC31B0E19A900BB35FD /* ViewController.m */; }; 86887AC61B0E19A900BB35FD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 86887AC51B0E19A900BB35FD /* Images.xcassets */; }; 86887AC91B0E19A900BB35FD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 86887AC71B0E19A900BB35FD /* Main.storyboard */; }; + 86887AE31B0E1EF200BB35FD /* EDQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887AE01B0E1EF200BB35FD /* EDQueue.m */; }; + 86887AE41B0E1EF200BB35FD /* EDQueueStorageEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887AE21B0E1EF200BB35FD /* EDQueueStorageEngine.m */; }; + 86887AF11B0E205A00BB35FD /* FMDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887AE81B0E205A00BB35FD /* FMDatabase.m */; }; + 86887AF21B0E205A00BB35FD /* FMDatabaseAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887AEA1B0E205A00BB35FD /* FMDatabaseAdditions.m */; }; + 86887AF31B0E205A00BB35FD /* FMDatabasePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887AEC1B0E205A00BB35FD /* FMDatabasePool.m */; }; + 86887AF41B0E205A00BB35FD /* FMDatabaseQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887AEE1B0E205A00BB35FD /* FMDatabaseQueue.m */; }; + 86887AF51B0E205A00BB35FD /* FMResultSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 86887AF01B0E205A00BB35FD /* FMResultSet.m */; }; + 86887AF71B0E208600BB35FD /* libsqlite3.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 86887AF61B0E208600BB35FD /* libsqlite3.0.dylib */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 86887ACF1B0E19A900BB35FD /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 86887AB01B0E19A900BB35FD /* Project object */; - proxyType = 1; - remoteGlobalIDString = 86887AB71B0E19A900BB35FD; - remoteInfo = macqueue; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ 86887AB81B0E19A900BB35FD /* macqueue.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = macqueue.app; sourceTree = BUILT_PRODUCTS_DIR; }; 86887ABC1B0E19A900BB35FD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -34,7 +32,21 @@ 86887AC31B0E19A900BB35FD /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 86887AC51B0E19A900BB35FD /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 86887AC81B0E19A900BB35FD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 86887ACE1B0E19A900BB35FD /* macqueueTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = macqueueTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 86887ADF1B0E1EF200BB35FD /* EDQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EDQueue.h; sourceTree = ""; }; + 86887AE01B0E1EF200BB35FD /* EDQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EDQueue.m; sourceTree = ""; }; + 86887AE11B0E1EF200BB35FD /* EDQueueStorageEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EDQueueStorageEngine.h; sourceTree = ""; }; + 86887AE21B0E1EF200BB35FD /* EDQueueStorageEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EDQueueStorageEngine.m; sourceTree = ""; }; + 86887AE71B0E205A00BB35FD /* FMDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMDatabase.h; sourceTree = ""; }; + 86887AE81B0E205A00BB35FD /* FMDatabase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMDatabase.m; sourceTree = ""; }; + 86887AE91B0E205A00BB35FD /* FMDatabaseAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMDatabaseAdditions.h; sourceTree = ""; }; + 86887AEA1B0E205A00BB35FD /* FMDatabaseAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMDatabaseAdditions.m; sourceTree = ""; }; + 86887AEB1B0E205A00BB35FD /* FMDatabasePool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMDatabasePool.h; sourceTree = ""; }; + 86887AEC1B0E205A00BB35FD /* FMDatabasePool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMDatabasePool.m; sourceTree = ""; }; + 86887AED1B0E205A00BB35FD /* FMDatabaseQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMDatabaseQueue.h; sourceTree = ""; }; + 86887AEE1B0E205A00BB35FD /* FMDatabaseQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMDatabaseQueue.m; sourceTree = ""; }; + 86887AEF1B0E205A00BB35FD /* FMResultSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMResultSet.h; sourceTree = ""; }; + 86887AF01B0E205A00BB35FD /* FMResultSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMResultSet.m; sourceTree = ""; }; + 86887AF61B0E208600BB35FD /* libsqlite3.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.0.dylib; path = usr/lib/libsqlite3.0.dylib; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -42,13 +54,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 86887ACB1B0E19A900BB35FD /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( + 86887AF71B0E208600BB35FD /* libsqlite3.0.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -58,7 +64,10 @@ 86887AAF1B0E19A900BB35FD = { isa = PBXGroup; children = ( + 86887ADE1B0E1EF200BB35FD /* EDQueue */, + 86887AE51B0E203F00BB35FD /* Lib */, 86887ABA1B0E19A900BB35FD /* Example */, + 86887AF81B0E209300BB35FD /* Frameworks */, 86887AB91B0E19A900BB35FD /* Products */, ); sourceTree = ""; @@ -67,7 +76,6 @@ isa = PBXGroup; children = ( 86887AB81B0E19A900BB35FD /* macqueue.app */, - 86887ACE1B0E19A900BB35FD /* macqueueTests.xctest */, ); name = Products; sourceTree = ""; @@ -96,6 +104,51 @@ name = "Supporting Files"; sourceTree = ""; }; + 86887ADE1B0E1EF200BB35FD /* EDQueue */ = { + isa = PBXGroup; + children = ( + 86887ADF1B0E1EF200BB35FD /* EDQueue.h */, + 86887AE01B0E1EF200BB35FD /* EDQueue.m */, + 86887AE11B0E1EF200BB35FD /* EDQueueStorageEngine.h */, + 86887AE21B0E1EF200BB35FD /* EDQueueStorageEngine.m */, + ); + name = EDQueue; + path = ../EDQueue; + sourceTree = ""; + }; + 86887AE51B0E203F00BB35FD /* Lib */ = { + isa = PBXGroup; + children = ( + 86887AE61B0E205A00BB35FD /* Fmdb */, + ); + name = Lib; + sourceTree = ""; + }; + 86887AE61B0E205A00BB35FD /* Fmdb */ = { + isa = PBXGroup; + children = ( + 86887AE71B0E205A00BB35FD /* FMDatabase.h */, + 86887AE81B0E205A00BB35FD /* FMDatabase.m */, + 86887AE91B0E205A00BB35FD /* FMDatabaseAdditions.h */, + 86887AEA1B0E205A00BB35FD /* FMDatabaseAdditions.m */, + 86887AEB1B0E205A00BB35FD /* FMDatabasePool.h */, + 86887AEC1B0E205A00BB35FD /* FMDatabasePool.m */, + 86887AED1B0E205A00BB35FD /* FMDatabaseQueue.h */, + 86887AEE1B0E205A00BB35FD /* FMDatabaseQueue.m */, + 86887AEF1B0E205A00BB35FD /* FMResultSet.h */, + 86887AF01B0E205A00BB35FD /* FMResultSet.m */, + ); + path = Fmdb; + sourceTree = ""; + }; + 86887AF81B0E209300BB35FD /* Frameworks */ = { + isa = PBXGroup; + children = ( + 86887AF61B0E208600BB35FD /* libsqlite3.0.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -116,24 +169,6 @@ productReference = 86887AB81B0E19A900BB35FD /* macqueue.app */; productType = "com.apple.product-type.application"; }; - 86887ACD1B0E19A900BB35FD /* macqueueTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 86887ADB1B0E19A900BB35FD /* Build configuration list for PBXNativeTarget "macqueueTests" */; - buildPhases = ( - 86887ACA1B0E19A900BB35FD /* Sources */, - 86887ACB1B0E19A900BB35FD /* Frameworks */, - 86887ACC1B0E19A900BB35FD /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 86887AD01B0E19A900BB35FD /* PBXTargetDependency */, - ); - name = macqueueTests; - productName = macqueueTests; - productReference = 86887ACE1B0E19A900BB35FD /* macqueueTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -146,10 +181,6 @@ 86887AB71B0E19A900BB35FD = { CreatedOnToolsVersion = 6.3.1; }; - 86887ACD1B0E19A900BB35FD = { - CreatedOnToolsVersion = 6.3.1; - TestTargetID = 86887AB71B0E19A900BB35FD; - }; }; }; buildConfigurationList = 86887AB31B0E19A900BB35FD /* Build configuration list for PBXProject "macqueue" */; @@ -166,7 +197,6 @@ projectRoot = ""; targets = ( 86887AB71B0E19A900BB35FD /* macqueue */, - 86887ACD1B0E19A900BB35FD /* macqueueTests */, ); }; /* End PBXProject section */ @@ -181,13 +211,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 86887ACC1B0E19A900BB35FD /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -196,28 +219,20 @@ buildActionMask = 2147483647; files = ( 86887AC41B0E19A900BB35FD /* ViewController.m in Sources */, + 86887AE41B0E1EF200BB35FD /* EDQueueStorageEngine.m in Sources */, 86887AC11B0E19A900BB35FD /* main.m in Sources */, + 86887AF11B0E205A00BB35FD /* FMDatabase.m in Sources */, + 86887AF51B0E205A00BB35FD /* FMResultSet.m in Sources */, + 86887AE31B0E1EF200BB35FD /* EDQueue.m in Sources */, + 86887AF31B0E205A00BB35FD /* FMDatabasePool.m in Sources */, + 86887AF21B0E205A00BB35FD /* FMDatabaseAdditions.m in Sources */, 86887ABF1B0E19A900BB35FD /* AppDelegate.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 86887ACA1B0E19A900BB35FD /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( + 86887AF41B0E205A00BB35FD /* FMDatabaseQueue.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - 86887AD01B0E19A900BB35FD /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 86887AB71B0E19A900BB35FD /* macqueue */; - targetProxy = 86887ACF1B0E19A900BB35FD /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ 86887AC71B0E19A900BB35FD /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -331,42 +346,6 @@ }; name = Release; }; - 86887ADC1B0E19A900BB35FD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = macqueue/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/macqueue.app/Contents/MacOS/macqueue"; - }; - name = Debug; - }; - 86887ADD1B0E19A900BB35FD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - INFOPLIST_FILE = macqueue/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/macqueue.app/Contents/MacOS/macqueue"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -388,15 +367,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 86887ADB1B0E19A900BB35FD /* Build configuration list for PBXNativeTarget "macqueueTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 86887ADC1B0E19A900BB35FD /* Debug */, - 86887ADD1B0E19A900BB35FD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = 86887AB01B0E19A900BB35FD /* Project object */; diff --git a/Project/macqueue/AppDelegate.h b/Project/macqueue/AppDelegate.h index e7e3c48..bfe243f 100644 --- a/Project/macqueue/AppDelegate.h +++ b/Project/macqueue/AppDelegate.h @@ -7,8 +7,11 @@ // #import +#import "EDQueue.h" -@interface AppDelegate : NSObject +@class ViewController; + +@interface AppDelegate : NSObject @end diff --git a/Project/macqueue/AppDelegate.m b/Project/macqueue/AppDelegate.m index 7011790..2ba649e 100644 --- a/Project/macqueue/AppDelegate.m +++ b/Project/macqueue/AppDelegate.m @@ -14,12 +14,34 @@ @interface AppDelegate () @implementation AppDelegate +- (void)queue:(EDQueue *)queue processJob:(NSDictionary *)job completion:(void (^)(EDQueueResult))block +{ + sleep(1); + + @try { + if ([[job objectForKey:@"task"] isEqualToString:@"success"]) { + block(EDQueueResultSuccess); + } else if ([[job objectForKey:@"task"] isEqualToString:@"fail"]) { + block(EDQueueResultFail); + } else { + block(EDQueueResultCritical); + } + } + @catch (NSException *exception) { + block(EDQueueResultCritical); + } +} + - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - // Insert code here to initialize your application + // Insert code here to initialize your application + + [[EDQueue sharedInstance] setDelegate:self]; + [[EDQueue sharedInstance] start]; } - (void)applicationWillTerminate:(NSNotification *)aNotification { // Insert code here to tear down your application + [[EDQueue sharedInstance] stop]; } @end diff --git a/Project/macqueue/Base.lproj/Main.storyboard b/Project/macqueue/Base.lproj/Main.storyboard index b7cc20e..bff953d 100644 --- a/Project/macqueue/Base.lproj/Main.storyboard +++ b/Project/macqueue/Base.lproj/Main.storyboard @@ -653,7 +653,7 @@ - + @@ -669,7 +669,7 @@ - + - + - - + + - + - + @@ -737,10 +746,13 @@ + + + - + diff --git a/Project/macqueue/ViewController.h b/Project/macqueue/ViewController.h index 1e50c62..0b6c3e2 100644 --- a/Project/macqueue/ViewController.h +++ b/Project/macqueue/ViewController.h @@ -7,9 +7,15 @@ // #import +#import "EDQueue.h" @interface ViewController : NSViewController +@property (nonatomic, retain) IBOutlet NSTextView *activity; + +- (IBAction)addSuccess:(id)sender; +- (IBAction)addFail:(id)sender; +- (IBAction)addCritical:(id)sender; @end diff --git a/Project/macqueue/ViewController.m b/Project/macqueue/ViewController.m index 411d712..863011b 100644 --- a/Project/macqueue/ViewController.m +++ b/Project/macqueue/ViewController.m @@ -10,16 +10,63 @@ @implementation ViewController -- (void)viewDidLoad { - [super viewDidLoad]; +@synthesize activity = _activity; - // Do any additional setup after loading the view. +- (void)viewDidLoad +{ + [super viewDidLoad]; + + // Register notifications + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + [nc addObserver:self selector:@selector(receivedNotification:) name:@"EDQueueJobDidSucceed" object:nil]; + [nc addObserver:self selector:@selector(receivedNotification:) name:@"EDQueueJobDidFail" object:nil]; + [nc addObserver:self selector:@selector(receivedNotification:) name:@"EDQueueDidStart" object:nil]; + [nc addObserver:self selector:@selector(receivedNotification:) name:@"EDQueueDidStop" object:nil]; + [nc addObserver:self selector:@selector(receivedNotification:) name:@"EDQueueDidDrain" object:nil]; } - (void)setRepresentedObject:(id)representedObject { [super setRepresentedObject:representedObject]; - + // Update the view, if already loaded. } +#pragma mark - UI events + +- (IBAction)addSuccess:(id)sender +{ + [[EDQueue sharedInstance] enqueueWithData:@{ @"nyan" : @"cat" } forTask:@"success"]; +} + +- (IBAction)addFail:(id)sender +{ + [[EDQueue sharedInstance] enqueueWithData:nil forTask:@"fail"]; +} + +- (IBAction)addCritical:(id)sender +{ + [[EDQueue sharedInstance] enqueueWithData:nil forTask:@"critical"]; +} + +#pragma mark - Notifications + +- (void)receivedNotification:(NSNotification *)notification +{ + dispatch_async(dispatch_get_main_queue(), ^{ + NSString* str = [NSString stringWithFormat:@"%@\n", notification]; + NSAttributedString* attr = [[NSAttributedString alloc] initWithString: str]; + + [[self.activity textStorage] appendAttributedString:attr]; + [self.activity scrollRangeToVisible:NSMakeRange([[self.activity string] length], 0)]; + }); +} + +#pragma mark - Dealloc + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + _activity = nil; +} + @end From 50ac190f7112c99e8bece77492b723a4f5c0896a Mon Sep 17 00:00:00 2001 From: kujenga Date: Thu, 21 May 2015 10:57:41 -0400 Subject: [PATCH 3/8] podspec updated for osx support --- EDQueue.podspec | 1 + 1 file changed, 1 insertion(+) diff --git a/EDQueue.podspec b/EDQueue.podspec index 2618403..7f0066a 100644 --- a/EDQueue.podspec +++ b/EDQueue.podspec @@ -7,6 +7,7 @@ Pod::Spec.new do |s| s.authors = {'Andrew Sliwinski' => 'andrewsliwinski@acm.org', 'Francois Lambert' => 'flambert@mirego.com'} s.source = { :git => 'https://github.com/thisandagain/queue.git', :tag => 'v0.7.1' } s.platform = :ios, '5.0' + s.platform = :osx, '10.8' s.source_files = 'EDQueue' s.library = 'sqlite3.0' s.requires_arc = true From 431f19728b23c9fdc9afa6a157eeb12890dde85a Mon Sep 17 00:00:00 2001 From: Aaron Taylor Date: Thu, 21 May 2015 11:34:37 -0400 Subject: [PATCH 4/8] added OS X support to README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6c2d0f1..03feb2b 100644 --- a/README.md +++ b/README.md @@ -141,5 +141,8 @@ EDQueueJobDidFail ### iOS Support EDQueue is designed for iOS 5 and up. +### OSX Support +EDQueue works with at least OSX 10.8 and up. + ### ARC EDQueue is built using ARC. If you are including EDQueue in a project that **does not** use [Automatic Reference Counting (ARC)](http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html), you will need to set the `-fobjc-arc` compiler flag on all of the EDQueue source files. To do this in Xcode, go to your active target and select the "Build Phases" tab. Now select all EDQueue source files, press Enter, insert `-fobjc-arc` and then "Done" to enable ARC for EDQueue. From 310090123e4917db4282d4fe4bab581fcbac56b1 Mon Sep 17 00:00:00 2001 From: kujenga Date: Sun, 21 Jun 2015 16:14:42 -0400 Subject: [PATCH 5/8] Added jobCount property --- EDQueue/EDQueue.h | 1 + EDQueue/EDQueue.m | 7 +++++++ EDQueue/EDQueueStorageEngine.m | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/EDQueue/EDQueue.h b/EDQueue/EDQueue.h index da14d2a..8905d46 100755 --- a/EDQueue/EDQueue.h +++ b/EDQueue/EDQueue.h @@ -32,6 +32,7 @@ extern NSString *const EDQueueDidDrain; @property (nonatomic, readonly) BOOL isRunning; @property (nonatomic, readonly) BOOL isActive; @property (nonatomic) NSUInteger retryLimit; +@property (nonatomic, readonly) NSUInteger jobCount; - (void)enqueueWithData:(id)data forTask:(NSString *)task; - (void)start; diff --git a/EDQueue/EDQueue.m b/EDQueue/EDQueue.m index a26f870..13df2ab 100755 --- a/EDQueue/EDQueue.m +++ b/EDQueue/EDQueue.m @@ -79,6 +79,7 @@ - (void)enqueueWithData:(id)data forTask:(NSString *)task { if (data == nil) data = @{}; [self.engine createJob:data forTask:task]; + _jobCount++; [self tick]; } @@ -130,6 +131,7 @@ - (void)start { if (!self.isRunning) { _isRunning = YES; + _jobCount = [self.engine fetchJobCount]; [self tick]; [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueDidStart, @"name", nil, @"data", nil] waitUntilDone:false]; } @@ -145,6 +147,7 @@ - (void)stop { if (self.isRunning) { _isRunning = NO; + _jobCount = [self.engine fetchJobCount]; [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueDidStop, @"name", nil, @"data", nil] waitUntilDone:false]; } } @@ -160,6 +163,7 @@ - (void)stop - (void)empty { [self.engine removeAllJobs]; + _jobCount = 0; } @@ -202,6 +206,7 @@ - (void)processJob:(NSDictionary*)job withResult:(EDQueueResult)result case EDQueueResultSuccess: [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueJobDidSucceed, @"name", job, @"data", nil] waitUntilDone:false]; [self.engine removeJob:[job objectForKey:@"id"]]; + _jobCount--; break; case EDQueueResultFail: [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueJobDidFail, @"name", job, @"data", nil] waitUntilDone:true]; @@ -210,12 +215,14 @@ - (void)processJob:(NSDictionary*)job withResult:(EDQueueResult)result [self.engine incrementAttemptForJob:[job objectForKey:@"id"]]; } else { [self.engine removeJob:[job objectForKey:@"id"]]; + _jobCount--; } break; case EDQueueResultCritical: [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueJobDidFail, @"name", job, @"data", nil] waitUntilDone:false]; [self errorWithMessage:@"Critical error. Job canceled."]; [self.engine removeJob:[job objectForKey:@"id"]]; + _jobCount--; break; } diff --git a/EDQueue/EDQueueStorageEngine.m b/EDQueue/EDQueueStorageEngine.m index 9d2e907..f8fc5f7 100755 --- a/EDQueue/EDQueueStorageEngine.m +++ b/EDQueue/EDQueueStorageEngine.m @@ -22,7 +22,7 @@ - (id)init self = [super init]; if (self) { // Database path - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES); + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask,YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"edqueue_0.5.0d.db"]; From 8d7d162f63225ac118a12759ee3c15f93b29dc18 Mon Sep 17 00:00:00 2001 From: kujenga Date: Thu, 3 Sep 2015 09:45:05 -0400 Subject: [PATCH 6/8] use job count implementation from adba's fork https://github.com/adba/queue/commit/03eac556569d1549edb1ddc49979a90df8d6b9d5 --- EDQueue/EDQueue.h | 3 +++ EDQueue/EDQueue.m | 26 ++++++++++++++++++++++++-- EDQueue/EDQueueStorageEngine.h | 1 + EDQueue/EDQueueStorageEngine.m | 21 ++++++++++++++++----- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/EDQueue/EDQueue.h b/EDQueue/EDQueue.h index 8905d46..2d384fa 100755 --- a/EDQueue/EDQueue.h +++ b/EDQueue/EDQueue.h @@ -43,6 +43,9 @@ extern NSString *const EDQueueDidDrain; - (BOOL)jobIsActiveForTask:(NSString *)task; - (NSDictionary *)nextJobForTask:(NSString *)task; +- (NSUInteger)jobCountForTask:(NSString *)task; +- (NSUInteger)totalJobCount; + @end @protocol EDQueueDelegate diff --git a/EDQueue/EDQueue.m b/EDQueue/EDQueue.m index 13df2ab..8b88372 100755 --- a/EDQueue/EDQueue.m +++ b/EDQueue/EDQueue.m @@ -122,6 +122,28 @@ - (NSDictionary *)nextJobForTask:(NSString *)task return nextJobForTask; } +/** + * Returns the number of jobs for task + * + * @param {NSString} Task label + * + * @return {NSUinteger} + */ +- (NSUInteger)jobCountForTask:(NSString *)task +{ + return [self.engine jobCountForTask:task]; +} + +/** + * Returns the total number of jobs + * + * @return {NSUinteger} + */ +- (NSUInteger)totalJobCount +{ + return [self.engine fetchJobCount]; +} + /** * Starts the queue. * @@ -131,7 +153,7 @@ - (void)start { if (!self.isRunning) { _isRunning = YES; - _jobCount = [self.engine fetchJobCount]; +// _jobCount = [self.engine fetchJobCount]; [self tick]; [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueDidStart, @"name", nil, @"data", nil] waitUntilDone:false]; } @@ -147,7 +169,7 @@ - (void)stop { if (self.isRunning) { _isRunning = NO; - _jobCount = [self.engine fetchJobCount]; +// _jobCount = [self.engine fetchJobCount]; [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueDidStop, @"name", nil, @"data", nil] waitUntilDone:false]; } } diff --git a/EDQueue/EDQueueStorageEngine.h b/EDQueue/EDQueueStorageEngine.h index aec98f4..be3f9c6 100755 --- a/EDQueue/EDQueueStorageEngine.h +++ b/EDQueue/EDQueueStorageEngine.h @@ -19,6 +19,7 @@ - (void)removeJob:(NSNumber *)jid; - (void)removeAllJobs; - (NSUInteger)fetchJobCount; +- (NSUInteger)jobCountForTask:(id)task; - (NSDictionary *)fetchJob; - (NSDictionary *)fetchJobForTask:(id)task; diff --git a/EDQueue/EDQueueStorageEngine.m b/EDQueue/EDQueueStorageEngine.m index f8fc5f7..f7b93ab 100755 --- a/EDQueue/EDQueueStorageEngine.m +++ b/EDQueue/EDQueueStorageEngine.m @@ -71,22 +71,33 @@ - (void)createJob:(id)data forTask:(id)task */ - (BOOL)jobExistsForTask:(id)task { - __block BOOL jobExists = NO; - + return [self jobCountForTask:task] > 0; +} + +/** + + * Returns the number of jobs for the specified task name. + + * + + * @param {NSString} Task name + + * + + * @return {NSUinteger} + + */ +- (NSUInteger)jobCountForTask:(id)task +{ + __block NSUInteger jobCount = 0; [self.queue inDatabase:^(FMDatabase *db) { FMResultSet *rs = [db executeQuery:@"SELECT count(id) AS count FROM queue WHERE task = ?", task]; [self _databaseHadError:[db hadError] fromDatabase:db]; while ([rs next]) { - jobExists |= ([rs intForColumn:@"count"] > 0); + jobCount = [rs intForColumn:@"count"]; } - [rs close]; }]; - return jobExists; + return jobCount; } + /** * Increments the "attempts" column for a specified job. * From cbeac10d814043f383d3623f1be85f236631ba3c Mon Sep 17 00:00:00 2001 From: kujenga Date: Thu, 3 Sep 2015 09:53:38 -0400 Subject: [PATCH 7/8] remove old jobCount property --- EDQueue/EDQueue.h | 1 - EDQueue/EDQueue.m | 7 ------- 2 files changed, 8 deletions(-) diff --git a/EDQueue/EDQueue.h b/EDQueue/EDQueue.h index 2d384fa..711f9bb 100755 --- a/EDQueue/EDQueue.h +++ b/EDQueue/EDQueue.h @@ -32,7 +32,6 @@ extern NSString *const EDQueueDidDrain; @property (nonatomic, readonly) BOOL isRunning; @property (nonatomic, readonly) BOOL isActive; @property (nonatomic) NSUInteger retryLimit; -@property (nonatomic, readonly) NSUInteger jobCount; - (void)enqueueWithData:(id)data forTask:(NSString *)task; - (void)start; diff --git a/EDQueue/EDQueue.m b/EDQueue/EDQueue.m index 8b88372..839b27b 100755 --- a/EDQueue/EDQueue.m +++ b/EDQueue/EDQueue.m @@ -79,7 +79,6 @@ - (void)enqueueWithData:(id)data forTask:(NSString *)task { if (data == nil) data = @{}; [self.engine createJob:data forTask:task]; - _jobCount++; [self tick]; } @@ -153,7 +152,6 @@ - (void)start { if (!self.isRunning) { _isRunning = YES; -// _jobCount = [self.engine fetchJobCount]; [self tick]; [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueDidStart, @"name", nil, @"data", nil] waitUntilDone:false]; } @@ -169,7 +167,6 @@ - (void)stop { if (self.isRunning) { _isRunning = NO; -// _jobCount = [self.engine fetchJobCount]; [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueDidStop, @"name", nil, @"data", nil] waitUntilDone:false]; } } @@ -185,7 +182,6 @@ - (void)stop - (void)empty { [self.engine removeAllJobs]; - _jobCount = 0; } @@ -228,7 +224,6 @@ - (void)processJob:(NSDictionary*)job withResult:(EDQueueResult)result case EDQueueResultSuccess: [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueJobDidSucceed, @"name", job, @"data", nil] waitUntilDone:false]; [self.engine removeJob:[job objectForKey:@"id"]]; - _jobCount--; break; case EDQueueResultFail: [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueJobDidFail, @"name", job, @"data", nil] waitUntilDone:true]; @@ -237,14 +232,12 @@ - (void)processJob:(NSDictionary*)job withResult:(EDQueueResult)result [self.engine incrementAttemptForJob:[job objectForKey:@"id"]]; } else { [self.engine removeJob:[job objectForKey:@"id"]]; - _jobCount--; } break; case EDQueueResultCritical: [self performSelectorOnMainThread:@selector(postNotification:) withObject:[NSDictionary dictionaryWithObjectsAndKeys:EDQueueJobDidFail, @"name", job, @"data", nil] waitUntilDone:false]; [self errorWithMessage:@"Critical error. Job canceled."]; [self.engine removeJob:[job objectForKey:@"id"]]; - _jobCount--; break; } From 72610b41c706733321f08152bbafa0b3172abb59 Mon Sep 17 00:00:00 2001 From: Juwan Yoo Date: Mon, 1 Feb 2016 14:36:30 +0900 Subject: [PATCH 8/8] platform notation fix for newer CocoaPods version --- EDQueue.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EDQueue.podspec b/EDQueue.podspec index 7f0066a..8589669 100644 --- a/EDQueue.podspec +++ b/EDQueue.podspec @@ -6,8 +6,8 @@ Pod::Spec.new do |s| s.homepage = 'https://github.com/thisandagain/queue' s.authors = {'Andrew Sliwinski' => 'andrewsliwinski@acm.org', 'Francois Lambert' => 'flambert@mirego.com'} s.source = { :git => 'https://github.com/thisandagain/queue.git', :tag => 'v0.7.1' } - s.platform = :ios, '5.0' - s.platform = :osx, '10.8' + s.ios.platform = :ios, '5.0' + s.osx.platform = :osx, '10.8' s.source_files = 'EDQueue' s.library = 'sqlite3.0' s.requires_arc = true