├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── WorkflowSchema.podspec ├── WorkflowSchema ├── Code │ ├── NSArray+WorkflowSchema.h │ ├── NSArray+WorkflowSchema.m │ ├── NSDate+WFSSchematising.h │ ├── NSDate+WFSSchematising.m │ ├── NSDictionary+WorkflowSchema.h │ ├── NSDictionary+WorkflowSchema.m │ ├── NSNull+WorkflowSchema.h │ ├── NSNull+WorkflowSchema.m │ ├── NSNumber+WFSSchematising.h │ ├── NSNumber+WFSSchematising.m │ ├── NSObject+WFSSchematising.h │ ├── NSObject+WFSSchematising.m │ ├── NSObject+WorkflowSchema.h │ ├── NSObject+WorkflowSchema.m │ ├── NSString+WFSSchematising.h │ ├── NSString+WFSSchematising.m │ ├── UIImage+WFSSchematising.h │ ├── UIImage+WFSSchematising.m │ ├── UINavigationItem+WFSSchematising.h │ ├── UINavigationItem+WFSSchematising.m │ ├── UIResponder+WFSSchematising.h │ ├── UIResponder+WFSSchematising.m │ ├── UIView+WFSSchematising.h │ ├── UIView+WFSSchematising.m │ ├── UIView+WorkflowSchema.h │ ├── UIView+WorkflowSchema.m │ ├── UIViewController+WFSSchematising.h │ ├── UIViewController+WFSSchematising.m │ ├── UIViewController+WorkflowSchema.h │ ├── UIViewController+WorkflowSchema.m │ ├── WFSAction.h │ ├── WFSAction.m │ ├── WFSActionButtonItem.h │ ├── WFSActionButtonItem.m │ ├── WFSBarButtonItem.h │ ├── WFSBarButtonItem.m │ ├── WFSButton.h │ ├── WFSButton.m │ ├── WFSComparisonCondition.h │ ├── WFSComparisonCondition.m │ ├── WFSCondition.h │ ├── WFSCondition.m │ ├── WFSConditionalAction.h │ ├── WFSConditionalAction.m │ ├── WFSConditionalSchema.h │ ├── WFSConditionalSchema.m │ ├── WFSContainerView.h │ ├── WFSContainerView.m │ ├── WFSContext.h │ ├── WFSContext.m │ ├── WFSControllerAction.h │ ├── WFSControllerAction.m │ ├── WFSDatePicker.h │ ├── WFSDatePicker.m │ ├── WFSDismissControllerAction.h │ ├── WFSDismissControllerAction.m │ ├── WFSEndEditingAction.h │ ├── WFSEndEditingAction.m │ ├── WFSEqualityCondition.h │ ├── WFSEqualityCondition.m │ ├── WFSError.h │ ├── WFSError.m │ ├── WFSFormAccessoryView.h │ ├── WFSFormAccessoryView.m │ ├── WFSFormController.h │ ├── WFSFormController.m │ ├── WFSFormInput.h │ ├── WFSFormTrigger.h │ ├── WFSFormTrigger.m │ ├── WFSFormView.h │ ├── WFSFormView.m │ ├── WFSHideViewsAction.h │ ├── WFSHideViewsAction.m │ ├── WFSHostView.h │ ├── WFSHostView.m │ ├── WFSImageView.h │ ├── WFSImageView.m │ ├── WFSLabel.h │ ├── WFSLabel.m │ ├── WFSLoadSchemaAction.h │ ├── WFSLoadSchemaAction.m │ ├── WFSLongPressGestureRecognizer.h │ ├── WFSLongPressGestureRecognizer.m │ ├── WFSMacros.h │ ├── WFSMessage.h │ ├── WFSMessage.m │ ├── WFSMultipleAction.h │ ├── WFSMultipleAction.m │ ├── WFSMultipleCondition.h │ ├── WFSMultipleCondition.m │ ├── WFSNavigationBar.h │ ├── WFSNavigationBar.m │ ├── WFSNavigationController.h │ ├── WFSNavigationController.m │ ├── WFSNavigationItem.h │ ├── WFSNavigationItem.m │ ├── WFSNegatedCondition.h │ ├── WFSNegatedCondition.m │ ├── WFSParameterProxy.h │ ├── WFSParameterProxy.m │ ├── WFSPopControllerAction.h │ ├── WFSPopControllerAction.m │ ├── WFSPresenceCondition.h │ ├── WFSPresenceCondition.m │ ├── WFSPresentControllerAction.h │ ├── WFSPresentControllerAction.m │ ├── WFSPushControllerAction.h │ ├── WFSPushControllerAction.m │ ├── WFSRegularExpressionCondition.h │ ├── WFSRegularExpressionCondition.m │ ├── WFSReplaceRootControllerAction.h │ ├── WFSReplaceRootControllerAction.m │ ├── WFSResult.h │ ├── WFSResult.m │ ├── WFSSchema+WFSDocumentation.h │ ├── WFSSchema+WFSDocumentation.m │ ├── WFSSchema+WFSGroupedParameters.h │ ├── WFSSchema+WFSGroupedParameters.m │ ├── WFSSchema.h │ ├── WFSSchema.m │ ├── WFSSchemaParameter.h │ ├── WFSSchemaParameter.m │ ├── WFSSchematising.h │ ├── WFSScreenController.h │ ├── WFSScreenController.m │ ├── WFSScreenView.h │ ├── WFSScreenView.m │ ├── WFSSearchBar.h │ ├── WFSSearchBar.m │ ├── WFSSegment.h │ ├── WFSSegment.m │ ├── WFSSegmentedControl.h │ ├── WFSSegmentedControl.m │ ├── WFSSendMessageAction.h │ ├── WFSSendMessageAction.m │ ├── WFSShowActionSheetAction.h │ ├── WFSShowActionSheetAction.m │ ├── WFSShowAlertAction.h │ ├── WFSShowAlertAction.m │ ├── WFSShowViewsAction.h │ ├── WFSShowViewsAction.m │ ├── WFSSlider.h │ ├── WFSSlider.m │ ├── WFSStoreValueAction.h │ ├── WFSStoreValueAction.m │ ├── WFSSwipeGestureRecognizer.h │ ├── WFSSwipeGestureRecognizer.m │ ├── WFSSwitch.h │ ├── WFSSwitch.m │ ├── WFSTabBarController.h │ ├── WFSTabBarController.m │ ├── WFSTabBarItem.h │ ├── WFSTabBarItem.m │ ├── WFSTableCell.h │ ├── WFSTableCell.m │ ├── WFSTableCellSchematising.h │ ├── WFSTableController.h │ ├── WFSTableController.m │ ├── WFSTableSection.h │ ├── WFSTableSection.m │ ├── WFSTapGestureRecognizer.h │ ├── WFSTapGestureRecognizer.m │ ├── WFSTextField.h │ ├── WFSTextField.m │ ├── WFSTextView.h │ ├── WFSTextView.m │ ├── WFSToolbar.h │ ├── WFSToolbar.m │ ├── WFSTruthinessCondition.h │ ├── WFSTruthinessCondition.m │ ├── WFSUpdateViewsAction.h │ ├── WFSUpdateViewsAction.m │ ├── WFSViewsAction.h │ ├── WFSViewsAction.m │ ├── WFSWorkflowMessageDelegate.h │ ├── WFSXMLParser.h │ ├── WFSXMLParser.m │ └── WorkflowSchema.h ├── Modules │ └── WorkflowSchema+DTCoreText │ │ ├── Code │ │ ├── DTAttributedTextView+WFSSchematising.h │ │ ├── DTAttributedTextView+WFSSchematising.m │ │ ├── NSAttributedString+WFSSchematising.h │ │ ├── NSAttributedString+WFSSchematising.m │ │ ├── WFSSchema+DTCoreText.h │ │ ├── WFSSchema+DTCoreText.m │ │ ├── WorkflowSchema+DTCoreText-Info.plist │ │ ├── WorkflowSchema+DTCoreText-Prefix.pch │ │ ├── WorkflowSchema+DTCoreText.h │ │ └── en.lproj │ │ │ └── InfoPlist.strings │ │ └── WorkflowSchema+DTCoreText.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── WorkflowSchema-Info.plist ├── WorkflowSchema-Prefix.pch ├── WorkflowSchema.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── en.lproj │ └── InfoPlist.strings └── WorkflowSchemaTests ├── .gitignore ├── Code ├── KIFTestScenario+WSTActionSheetTests.h ├── KIFTestScenario+WSTActionSheetTests.m ├── KIFTestScenario+WSTAlertViewTests.h ├── KIFTestScenario+WSTAlertViewTests.m ├── KIFTestScenario+WSTAttributedTextViewUnitTests.h ├── KIFTestScenario+WSTAttributedTextViewUnitTests.m ├── KIFTestScenario+WSTButtonUnitTests.h ├── KIFTestScenario+WSTButtonUnitTests.m ├── KIFTestScenario+WSTComparisonConditionTests.h ├── KIFTestScenario+WSTComparisonConditionTests.m ├── KIFTestScenario+WSTConditionalActionTests.h ├── KIFTestScenario+WSTConditionalActionTests.m ├── KIFTestScenario+WSTConditionalSchemaUnitTests.h ├── KIFTestScenario+WSTConditionalSchemaUnitTests.m ├── KIFTestScenario+WSTContainerUnitTests.h ├── KIFTestScenario+WSTContainerUnitTests.m ├── KIFTestScenario+WSTControllerFunctionalTests.h ├── KIFTestScenario+WSTControllerFunctionalTests.m ├── KIFTestScenario+WSTDatePickerTests.h ├── KIFTestScenario+WSTDatePickerTests.m ├── KIFTestScenario+WSTDateTests.h ├── KIFTestScenario+WSTDateTests.m ├── KIFTestScenario+WSTDocumentationTests.h ├── KIFTestScenario+WSTDocumentationTests.m ├── KIFTestScenario+WSTFormControllerUnitTests.h ├── KIFTestScenario+WSTFormControllerUnitTests.m ├── KIFTestScenario+WSTImageViewUnitTests.h ├── KIFTestScenario+WSTImageViewUnitTests.m ├── KIFTestScenario+WSTLabelUnitTests.h ├── KIFTestScenario+WSTLabelUnitTests.m ├── KIFTestScenario+WSTMultipleActionsTests.h ├── KIFTestScenario+WSTMultipleActionsTests.m ├── KIFTestScenario+WSTNavigationBarTests.h ├── KIFTestScenario+WSTNavigationBarTests.m ├── KIFTestScenario+WSTNavigationControllerTests.h ├── KIFTestScenario+WSTNavigationControllerTests.m ├── KIFTestScenario+WSTNumberTests.h ├── KIFTestScenario+WSTNumberTests.m ├── KIFTestScenario+WSTParameterProxyTests.h ├── KIFTestScenario+WSTParameterProxyTests.m ├── KIFTestScenario+WSTSchemaStyleTests.h ├── KIFTestScenario+WSTSchemaStyleTests.m ├── KIFTestScenario+WSTScreenControllerUnitTests.h ├── KIFTestScenario+WSTScreenControllerUnitTests.m ├── KIFTestScenario+WSTSearchBarUnitTests.h ├── KIFTestScenario+WSTSearchBarUnitTests.m ├── KIFTestScenario+WSTSegmentedControlTests.h ├── KIFTestScenario+WSTSegmentedControlTests.m ├── KIFTestScenario+WSTSendMessageActionTests.h ├── KIFTestScenario+WSTSendMessageActionTests.m ├── KIFTestScenario+WSTSliderTests.h ├── KIFTestScenario+WSTSliderTests.m ├── KIFTestScenario+WSTStoreValueActionTests.h ├── KIFTestScenario+WSTStoreValueActionTests.m ├── KIFTestScenario+WSTStringTests.h ├── KIFTestScenario+WSTStringTests.m ├── KIFTestScenario+WSTSwitchUnitTests.h ├── KIFTestScenario+WSTSwitchUnitTests.m ├── KIFTestScenario+WSTTabControllerTests.h ├── KIFTestScenario+WSTTabControllerTests.m ├── KIFTestScenario+WSTTableControllerUnitTests.h ├── KIFTestScenario+WSTTableControllerUnitTests.m ├── KIFTestScenario+WSTTextFieldUnitTests.h ├── KIFTestScenario+WSTTextFieldUnitTests.m ├── KIFTestScenario+WSTTextViewUnitTests.h ├── KIFTestScenario+WSTTextViewUnitTests.m ├── KIFTestScenario+WSTToolbarTests.h ├── KIFTestScenario+WSTToolbarTests.m ├── KIFTestScenario+WSTViewSharedPropertyTests.h ├── KIFTestScenario+WSTViewSharedPropertyTests.m ├── KIFTestScenario+WSTXMLParserTests.h ├── KIFTestScenario+WSTXMLParserTests.m ├── KIFTestStep+WSTShared.h ├── KIFTestStep+WSTShared.m ├── WSTAppDelegate.h ├── WSTAppDelegate.m ├── WSTAssert.h ├── WSTTestAction.h ├── WSTTestAction.m ├── WSTTestContext.h ├── WSTTestContext.m ├── WSTTestController.h ├── WSTTestController.m └── main.m ├── Example XML ├── conditional_tests.xml ├── form_tests_1.xml ├── form_tests_2.xml ├── form_tests_3.xml ├── form_triggers_tests.xml ├── gesture_recognizer_tests.xml ├── load_tests_main.xml ├── load_tests_screen1.xml ├── load_tests_screen2.xml ├── navigation_item_tests.xml ├── navigation_stack_tests.xml ├── searching_tests.xml ├── stored_value_tests.xml ├── style_tests.xml ├── tab_tests.xml ├── table_tests.xml └── updating_views_tests.xml ├── Podfile ├── Podfile.lock ├── Resources ├── Default-568h@2x.png ├── Default.png ├── Default.svg ├── Default@2x.png ├── Icon.png ├── Icon.svg ├── Icon@2x.png ├── Localizable.strings ├── Test.strings ├── button_bg.png ├── button_bg@2x.png ├── first.png ├── first@2x.png ├── second.png ├── second@2x.png ├── text_field_bg.png ├── text_field_bg@2x.png └── uiss.json ├── WorkflowSchemaTests-Info.plist ├── WorkflowSchemaTests-Prefix.pch ├── WorkflowSchemaTests.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── WorkflowSchemaTests.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── WorkspaceSettings.xcsettings └── en.lproj └── InfoPlist.strings /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .DS_store 3 | xcuserdata 4 | 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "WorkflowSchema/Modules/WorkflowSchema+DTCoreText/DTCoreText"] 2 | path = WorkflowSchema/Modules/WorkflowSchema+DTCoreText/DTCoreText 3 | url = git://github.com/Cocoanetics/DTCoreText.git 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 CRedit360 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /WorkflowSchema.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "WorkflowSchema" 3 | s.version = "0.5.0" 4 | s.summary = "An iOS framework which allows you to define app workflows in XML." 5 | s.homepage = "https://github.com/CRedit360/WorkflowSchema" 6 | s.license = 'MIT' 7 | s.author = { "Simon Booth" => "simon.booth@credit360.com" } 8 | s.source = { :git => "https://github.com/CRedit360/WorkflowSchema.git", :tag => "0.5.0" } 9 | s.platform = :ios, '5.0' 10 | s.requires_arc = true 11 | 12 | s.preferred_dependency = 'Core' 13 | 14 | s.subspec 'All' do |ss| 15 | ss.dependency 'WorkflowSchema/Core' 16 | ss.dependency 'WorkflowSchema/DTCoreText' 17 | end 18 | 19 | s.subspec 'Core' do |ss| 20 | ss.source_files = 'WorkflowSchema/Code' 21 | end 22 | 23 | s.subspec 'DTCoreText' do |ss| 24 | ss.source_files = 'WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code' 25 | ss.dependency 'DTCoreText', '~> 1.0' 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSArray+WorkflowSchema.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+WorkflowSchema.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSArray (WorkflowSchema) 12 | 13 | - (NSArray *)flattenedArray; 14 | 15 | - (NSArray *)arrayByPrependingObject:(id)object; 16 | - (NSArray *)arrayByPrependingObjectsFromArray:(NSArray *)array; 17 | 18 | - (NSNumber *)bitmaskByLookupInDictionary:(NSDictionary *)dictionary; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSArray+WorkflowSchema.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+WorkflowSchema.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "NSArray+WorkflowSchema.h" 10 | #import "NSObject+WFSSchematising.h" 11 | 12 | @implementation NSArray (WorkflowSchema) 13 | 14 | - (NSArray *)flattenedArray 15 | { 16 | NSMutableArray *flattenedArray = [NSMutableArray array]; 17 | 18 | for (id value in self) 19 | { 20 | if ([value isKindOfClass:[NSArray class]]) 21 | { 22 | [flattenedArray addObjectsFromArray:[value flattenedArray]]; 23 | } 24 | else 25 | { 26 | [flattenedArray addObject:value]; 27 | } 28 | } 29 | 30 | return flattenedArray; 31 | } 32 | 33 | - (NSArray *)arrayByPrependingObject:(id)object 34 | { 35 | return [@[ object ] arrayByAddingObjectsFromArray:self]; 36 | } 37 | 38 | - (NSArray *)arrayByPrependingObjectsFromArray:(NSArray *)array 39 | { 40 | return [array arrayByAddingObjectsFromArray:self]; 41 | } 42 | 43 | - (NSNumber *)bitmaskByLookupInDictionary:(NSDictionary *)dictionary 44 | { 45 | long long value = 0; 46 | 47 | for (id object in self) 48 | { 49 | NSNumber *objectValue = dictionary[object]; 50 | if (![objectValue isKindOfClass:[NSNumber class]]) return nil; 51 | value |= [objectValue longLongValue]; 52 | } 53 | 54 | return @(value); 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSDate+WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+WFSSchematising.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface NSDate (WFSSchematising) 13 | 14 | + (NSDate *)dateWithString:(NSString *)string format:(NSString *)format locale:(NSLocale *)locale error:(NSError **)outError; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSDictionary+WorkflowSchema.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+WorkflowSchema.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 23/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSDictionary (WorkflowSchema) 12 | 13 | - (NSDictionary *)dictionaryByAddingEntriesFromDictionary:(NSDictionary *)otherDictionary; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSDictionary+WorkflowSchema.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+WorkflowSchema.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 23/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "NSDictionary+WorkflowSchema.h" 10 | 11 | @implementation NSDictionary (WorkflowSchema) 12 | 13 | - (NSDictionary *)dictionaryByAddingEntriesFromDictionary:(NSDictionary *)otherDictionary 14 | { 15 | NSMutableDictionary *dictionary = [self mutableCopy]; 16 | [dictionary addEntriesFromDictionary:otherDictionary]; 17 | return dictionary; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSNull+WorkflowSchema.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSNull+WorkflowSchema.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 22/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSNull (WorkflowSchema) 12 | 13 | - (NSArray *)flattenedArray; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSNull+WorkflowSchema.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSNull+WorkflowSchema.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 22/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "NSNull+WorkflowSchema.h" 10 | 11 | @implementation NSNull (WorkflowSchema) 12 | 13 | - (NSArray *)flattenedArray 14 | { 15 | return @[]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSNumber+WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+WFSSchematising.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 25/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSchematising.h" 10 | 11 | @interface NSNumber (WFSSchematising) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSNumber+WFSSchematising.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+WFSSchematising.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 25/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "NSNumber+WFSSchematising.h" 10 | #import "WFSSchema+WFSGroupedParameters.h" 11 | 12 | @implementation NSNumber (WFSSchematising) 13 | 14 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 15 | { 16 | NSDictionary *groupedParameters = [schema groupedParametersWithContext:context error:outError]; 17 | 18 | NSNumber *numberValue = groupedParameters[@"value"]; 19 | if ([numberValue isKindOfClass:[NSNumber class]]) return numberValue; 20 | 21 | NSString *stringValue = groupedParameters[@"value"]; 22 | if ([schema.typeName isEqual:@"bool"]) 23 | { 24 | return [NSNumber numberWithBool:[stringValue boolValue]]; 25 | } 26 | 27 | return [NSDecimalNumber decimalNumberWithString:stringValue locale:schema.locale]; 28 | } 29 | 30 | + (NSArray *)defaultSchemaParameters 31 | { 32 | return [[super defaultSchemaParameters] arrayByAddingObject:@[ [NSObject class], @"value" ]]; 33 | } 34 | 35 | + (NSArray *)mandatorySchemaParameters 36 | { 37 | return [[super mandatorySchemaParameters] arrayByAddingObject:@"value"]; 38 | } 39 | 40 | + (NSDictionary *)schemaParameterTypes 41 | { 42 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 43 | 44 | @"value" : @[ [NSString class], [NSNumber class] ] 45 | 46 | }]; 47 | } 48 | 49 | - (BOOL)setSchemaParameterWithName:(NSString *)name value:(id)value context:(WFSContext *)context error:(NSError *__autoreleasing *)outError 50 | { 51 | if ([@[@"value"] containsObject:name]) return YES; 52 | return [super setSchemaParameterWithName:name value:value context:context error:outError]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSObject+WorkflowSchema.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+WorkflowSchema.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 13/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class WFSContext; 12 | @class WFSMessage; 13 | 14 | @interface NSObject (WorkflowSchema) 15 | 16 | - (NSArray *)flattenedArray; 17 | 18 | - (WFSMessage *)messageFromParameterWithName:(NSString *)name context:(WFSContext *)context; 19 | - (void)sendMessageFromParameterWithName:(NSString *)name context:(WFSContext *)context; 20 | 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSObject+WorkflowSchema.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+WorkflowSchema.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 13/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "NSObject+WorkflowSchema.h" 10 | #import "WFSMessage.h" 11 | #import "WFSContext.h" 12 | 13 | @implementation NSObject (WorkflowSchema) 14 | 15 | - (NSArray *)flattenedArray 16 | { 17 | return @[ self ]; 18 | } 19 | 20 | #pragma mark - Message sending 21 | 22 | - (WFSMessage *)messageFromParameterWithName:(NSString *)name context:(WFSContext *)context 23 | { 24 | NSError *error = nil; 25 | id message = [self schemaParameterWithName:name context:context error:&error]; 26 | if ([message isKindOfClass:[NSString class]]) 27 | { 28 | message = [WFSMessage messageWithName:message context:context responseHandler:nil]; 29 | } 30 | 31 | if ([message isKindOfClass:[WFSMessage class]]) 32 | { 33 | return message; 34 | } 35 | else 36 | { 37 | if (!error) error = WFSError(@"Could not find message for parameter %@", name); 38 | [context sendWorkflowError:error]; 39 | return nil; 40 | } 41 | } 42 | 43 | - (void)sendMessageFromParameterWithName:(NSString *)name context:(id)context 44 | { 45 | WFSMessage *message = [self messageFromParameterWithName:name context:context]; 46 | if (message) [context sendWorkflowMessage:message]; 47 | } 48 | 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSString+WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+WFSSchematising.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface NSString (WFSSchematising) 13 | 14 | // Due to a bug in KVC, bool parameters are interpreted as char instead of as bools. 15 | // NSString doesn't define charValue, so it blows up. To prevent this, we forward 16 | // charValue to boolValue. 17 | - (char)charValue; 18 | 19 | // On iOS 5, KVC attempts to call this, even though it's not defined on NSString. 20 | - (NSUInteger)unsignedIntValue; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/NSString+WFSSchematising.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+WFSSchematising.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "NSString+WFSSchematising.h" 10 | #import "WFSSchema+WFSGroupedParameters.h" 11 | #import 12 | 13 | @implementation NSString (WFSSchematising) 14 | 15 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 16 | { 17 | NSDictionary *groupedParameters = [schema groupedParametersWithContext:context error:outError]; 18 | if (!groupedParameters) return nil; 19 | 20 | NSString *key = groupedParameters[@"key"]; 21 | NSString *value = groupedParameters[@"value"]; 22 | NSString *table = groupedParameters[@"table"]; 23 | 24 | if (!key & !value) 25 | { 26 | if (outError) *outError = WFSError(@"Strings must specify a key or a value"); 27 | return nil; 28 | } 29 | 30 | if (table && !key) 31 | { 32 | if (outError) *outError = WFSError(@"Strings may only specify a table if they also specify a key"); 33 | return nil; 34 | } 35 | 36 | if (key) 37 | { 38 | value = [[NSBundle mainBundle] localizedStringForKey:key value:value table:table]; 39 | } 40 | 41 | // We use initWithFormat here to avoid the "Did you forget to nest alloc and init?" message 42 | self = [self initWithFormat:@"%@", value]; 43 | if (self) 44 | { 45 | WFS_SCHEMATISING_PROPERTY_INITITIALISATION; 46 | } 47 | return self; 48 | } 49 | 50 | + (NSArray *)defaultSchemaParameters 51 | { 52 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [NSString class], @"value" ] ]; 53 | } 54 | 55 | + (NSDictionary *)schemaParameterTypes 56 | { 57 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 58 | 59 | @"key" : [NSString class], 60 | @"value" : [NSString class], 61 | @"table" : [NSString class] 62 | 63 | }]; 64 | } 65 | 66 | - (char)charValue 67 | { 68 | return (char)[self boolValue]; 69 | } 70 | 71 | - (NSUInteger)unsignedIntValue 72 | { 73 | return [self intValue]; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UIImage+WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+WFSSchematising.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 21/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface UIImage (WFSSchematising) 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UIImage+WFSSchematising.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+WFSSchematising.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 21/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "UIImage+WFSSchematising.h" 10 | #import "WFSSchema+WFSGroupedParameters.h" 11 | #import 12 | 13 | @implementation UIImage (WFSSchematising) 14 | 15 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 16 | { 17 | NSDictionary *groupedParameters = [schema groupedParametersWithContext:context error:outError]; 18 | if (!groupedParameters) return nil; 19 | 20 | NSString *imageName = groupedParameters[@"name"]; 21 | if (!imageName) 22 | { 23 | if (outError) *outError = WFSError(@"Images require a name"); 24 | return nil; 25 | } 26 | 27 | self = [[self class] imageNamed:imageName]; 28 | if (self) 29 | { 30 | // The default is the image name, which isn't good enough. 31 | self.accessibilityLabel = nil; 32 | 33 | WFS_SCHEMATISING_INITIALISATION; 34 | } 35 | else 36 | { 37 | if (outError) *outError = WFSError(@"Could not find image named '%@'", imageName); 38 | return nil; 39 | } 40 | return self; 41 | } 42 | 43 | + (BOOL)includeAccessibilitySchemaParameters 44 | { 45 | return YES; 46 | } 47 | 48 | + (NSArray *)mandatorySchemaParameters 49 | { 50 | return [[super mandatorySchemaParameters] arrayByPrependingObject:@"name" ]; 51 | } 52 | 53 | + (NSArray *)defaultSchemaParameters 54 | { 55 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [NSString class], @"name"] ]; 56 | } 57 | 58 | + (NSDictionary *)schemaParameterTypes 59 | { 60 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ @"name" : [NSString class] }]; 61 | } 62 | 63 | - (BOOL)setSchemaParameterWithName:(NSString *)name value:(id)value context:(WFSContext *)context error:(NSError **)outError 64 | { 65 | if ([name isEqualToString:@"name"]) return YES; 66 | return [super setSchemaParameterWithName:name value:value context:context error:outError]; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UINavigationItem+WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationItem+WFSSchematising.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface UINavigationItem (WFSSchematising) 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UINavigationItem+WFSSchematising.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationItem+WFSSchematising.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "UINavigationItem+WFSSchematising.h" 10 | #import "WFSBarButtonItem.h" 11 | 12 | @implementation UINavigationItem (WFSSchematising) 13 | 14 | + (NSArray *)arraySchemaParameters 15 | { 16 | return [[super arraySchemaParameters] arrayByAddingObjectsFromArray:@[ @"leftBarButtonItems", @"rightBarButtonItems" ]]; 17 | } 18 | 19 | + (NSDictionary *)schemaParameterTypes 20 | { 21 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 22 | 23 | @"title" : [NSString class], 24 | @"titleView" : [UIView class], 25 | @"prompt" : [NSString class], 26 | @"hidesBackButton" : @[ [NSString class], [NSNumber class] ], 27 | @"leftItemsSupplementBackButton" : @[ [NSString class], [NSNumber class] ], 28 | @"leftBarButtonItem" : [WFSBarButtonItem class], 29 | @"leftBarButtonItems" : [WFSBarButtonItem class], 30 | @"rightBarButtonItem" : [WFSBarButtonItem class], 31 | @"rightBarButtonItems" : [WFSBarButtonItem class], 32 | @"backBarButtonItem" : @[ [NSString class], [UIImage class], [WFSBarButtonItem class] ] 33 | 34 | }]; 35 | } 36 | 37 | - (BOOL)setSchemaParameterWithName:(NSString *)name value:(id)value context:(WFSContext *)context error:(NSError **)outError 38 | { 39 | // since the backBarButtonItem is more-or-less ignored except for the title/image, we include these shorthands 40 | if ([name isEqualToString:@"backBarButtonItem"] && [value isKindOfClass:[NSString class]]) 41 | { 42 | self.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:value style:UIBarButtonItemStyleBordered target:nil action:nil]; 43 | return YES; 44 | } 45 | else if ([name isEqualToString:@"backBarButtonItem"] && [value isKindOfClass:[UIImage class]]) 46 | { 47 | self.backBarButtonItem = [[UIBarButtonItem alloc] initWithImage:value style:UIBarButtonItemStyleBordered target:nil action:nil]; 48 | return YES; 49 | } 50 | 51 | return [super setSchemaParameterWithName:name value:value context:context error:outError]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UIResponder+WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIResponder+WFSSchematising.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface UIResponder (WFSSchematising) 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UIResponder+WFSSchematising.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIResponder+WFSSchematising.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "UIResponder+WFSSchematising.h" 10 | 11 | @implementation UIResponder (WFSSchematising) 12 | 13 | + (NSDictionary *)schemaParameterTypes 14 | { 15 | NSDictionary *schemaParameterTypes = [super schemaParameterTypes]; 16 | 17 | if ([self instancesRespondToSelector:@selector(setInputView:)] && [self instancesRespondToSelector:@selector(setInputAccessoryView:)]) 18 | { 19 | schemaParameterTypes = [schemaParameterTypes dictionaryByAddingEntriesFromDictionary:@{ 20 | 21 | @"inputView" : [UIView class], 22 | @"inputAccessoryView" : [UIView class], 23 | 24 | }]; 25 | } 26 | 27 | return schemaParameterTypes; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UIView+WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+WFSSchematising.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface UIView (WFSSchematising) 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UIView+WorkflowSchema.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+WorkflowSchema.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 02/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (WorkflowSchema) 12 | 13 | - (UIResponder *)findFirstResponder; 14 | - (NSArray *)subviewsWithWorkflowNames:(NSArray *)names; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UIView+WorkflowSchema.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+WorkflowSchema.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 02/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "UIView+WorkflowSchema.h" 10 | #import "NSObject+WFSSchematising.h" 11 | 12 | @implementation UIView (WorkflowSchema) 13 | 14 | - (UIResponder *)findFirstResponder 15 | { 16 | if (self.isFirstResponder) return self; 17 | 18 | for (UIView *view in self.subviews) 19 | { 20 | UIResponder *responder = [view findFirstResponder]; 21 | if (responder) return responder; 22 | } 23 | 24 | return nil; 25 | } 26 | 27 | - (NSArray *)subviewsWithWorkflowNames:(NSArray *)names 28 | { 29 | NSMutableArray *subviews = [NSMutableArray array]; 30 | 31 | for (UIView *view in self.subviews) 32 | { 33 | NSString *name = view.workflowName; 34 | if (name && [names containsObject:name]) 35 | { 36 | [subviews addObject:view]; 37 | } 38 | 39 | [subviews addObjectsFromArray:[view subviewsWithWorkflowNames:names]]; 40 | } 41 | 42 | return subviews; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UIViewController+WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+WFSSchematising.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "WFSResult.h" 12 | #import "WFSMessage.h" 13 | #import "WFSContext.h" 14 | 15 | @interface UIViewController (WFSSchematising) 16 | 17 | @property (nonatomic, assign) BOOL shouldForwardAllMessages; 18 | 19 | @property (nonatomic, strong) NSArray *actions; 20 | - (NSString *)actionNameForSelector:(SEL)selector; 21 | - (WFSResult *)performActionName:(NSString *)name context:(WFSContext *)context; 22 | - (WFSMutableContext *)contextForPerformingActions:(WFSContext *)context; 23 | 24 | @property (nonatomic, strong) NSDictionary *storedValues; 25 | - (void)storeValues:(NSDictionary *)valuesToStore; 26 | - (void)clearCachedContextValues; 27 | 28 | @end 29 | 30 | #define WFS_UIVIEWCONTROLLER_LIFECYCLE \ 31 | - (void)viewDidLoad \ 32 | { \ 33 | [super viewDidLoad]; \ 34 | [self performActionName:[self actionNameForSelector:_cmd] context:self.workflowContext]; \ 35 | } \ 36 | \ 37 | - (void)viewWillAppear:(BOOL)animated \ 38 | { \ 39 | [super viewWillAppear:animated]; \ 40 | [self performActionName:[self actionNameForSelector:_cmd] context:self.workflowContext]; \ 41 | } \ 42 | \ 43 | - (void)viewDidAppear:(BOOL)animated \ 44 | { \ 45 | [super viewDidAppear:animated]; \ 46 | [self performActionName:[self actionNameForSelector:_cmd] context:self.workflowContext]; \ 47 | } \ 48 | \ 49 | - (void)viewWillDisappear:(BOOL)animated \ 50 | { \ 51 | [super viewWillDisappear:animated]; \ 52 | [self performActionName:[self actionNameForSelector:_cmd] context:self.workflowContext]; \ 53 | } \ 54 | \ 55 | - (void)viewDidDisappear:(BOOL)animated \ 56 | { \ 57 | [super viewDidDisappear:animated]; \ 58 | [self performActionName:[self actionNameForSelector:_cmd] context:self.workflowContext]; \ 59 | } -------------------------------------------------------------------------------- /WorkflowSchema/Code/UIViewController+WorkflowSchema.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+WorkflowSchema.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIViewController (WorkflowSchema) 12 | 13 | - (NSArray *)descendantControllersWithWorkflowNames:(NSArray *)names; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/UIViewController+WorkflowSchema.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+WorkflowSchema.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "UIViewController+WorkflowSchema.h" 10 | #import "NSObject+WFSSchematising.h" 11 | 12 | @implementation UIViewController (WorkflowSchema) 13 | 14 | - (NSArray *)descendantControllersWithWorkflowNames:(NSArray *)names 15 | { 16 | NSMutableArray *descendants = [NSMutableArray array]; 17 | 18 | for (UIViewController *child in self.childViewControllers) 19 | { 20 | NSString *name = child.workflowName; 21 | if (name && [names containsObject:name]) 22 | { 23 | [descendants addObject:child]; 24 | } 25 | 26 | [descendants addObjectsFromArray:[child descendantControllersWithWorkflowNames:names]]; 27 | } 28 | 29 | return descendants; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSAction.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSResult.h" 12 | #import "WFSMessage.h" 13 | 14 | @interface WFSAction : NSObject 15 | 16 | - (BOOL)shouldPerformActionForResultName:(NSString *)name; 17 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context; 18 | 19 | + (BOOL)actionAnimationsAreDisabled; 20 | + (void)performWithActionAnimationsDisabled:(void(^)(void))block; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSAction.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | 11 | static NSUInteger WFSActionAnimationDisabledCount; 12 | 13 | @interface WFSAction () 14 | 15 | @end 16 | 17 | @implementation WFSAction 18 | 19 | - (BOOL)shouldPerformActionForResultName:(NSString *)name 20 | { 21 | return (self.workflowName.length == 0) || [self.workflowName isEqualToString:name]; 22 | } 23 | 24 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 25 | { 26 | return [WFSResult successResultWithContext:context]; 27 | } 28 | 29 | #pragma mark - Global animation disabling 30 | 31 | + (BOOL)actionAnimationsAreDisabled 32 | { 33 | return WFSActionAnimationDisabledCount > 0; 34 | } 35 | 36 | + (void)performWithActionAnimationsDisabled:(void (^)(void))block 37 | { 38 | @try 39 | { 40 | WFSActionAnimationDisabledCount++; 41 | if (block) block(); 42 | } 43 | @finally 44 | { 45 | WFSActionAnimationDisabledCount--; 46 | } 47 | } 48 | 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSActionButtonItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSButtonItem.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 21/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSAction.h" 12 | 13 | @interface WFSActionButtonItem : NSObject 14 | 15 | @property (nonatomic, copy) NSString *title; 16 | @property (nonatomic, strong) id message; 17 | @property (nonatomic, assign) NSInteger index; 18 | 19 | @end 20 | 21 | @interface WFSCancelButtonItem : WFSActionButtonItem; @end 22 | @interface WFSDestructiveButtonItem : WFSActionButtonItem; @end -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSActionButtonItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSButtonItem.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 21/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSActionButtonItem.h" 10 | #import "WFSMacros.h" 11 | 12 | @implementation WFSActionButtonItem 13 | 14 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 15 | { 16 | self = [super initWithSchema:schema context:context error:outError]; 17 | if (self) 18 | { 19 | _index = NSNotFound; 20 | } 21 | return self; 22 | } 23 | 24 | + (NSArray *)mandatorySchemaParameters 25 | { 26 | return [[super mandatorySchemaParameters] arrayByPrependingObjectsFromArray:@[ @"title", @"message" ]]; 27 | } 28 | 29 | + (NSArray *)lazilyCreatedSchemaParameters 30 | { 31 | return [[super lazilyCreatedSchemaParameters] arrayByPrependingObject:@"message"]; 32 | } 33 | 34 | + (NSArray *)defaultSchemaParameters 35 | { 36 | return [[super defaultSchemaParameters] arrayByPrependingObjectsFromArray:@[ 37 | 38 | @[ [NSString class], @"title"], 39 | @[ [WFSMessage class], @"message" ] 40 | 41 | ]]; 42 | } 43 | 44 | + (NSDictionary *)schemaParameterTypes 45 | { 46 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 47 | 48 | @"title" : [NSString class], 49 | @"message" : @[ [WFSMessage class], [NSString class] ] 50 | 51 | }]; 52 | } 53 | 54 | @end 55 | 56 | @implementation WFSCancelButtonItem 57 | 58 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 59 | { 60 | self = [super initWithSchema:schema context:context error:outError]; 61 | if (self) 62 | { 63 | if (self.title.length == 0) 64 | { 65 | self.title = @"OK"; 66 | } 67 | } 68 | return self; 69 | } 70 | 71 | + (NSArray *)mandatorySchemaParameters 72 | { 73 | NSMutableArray *mandatorySchemaParameters = [[super mandatorySchemaParameters] mutableCopy]; 74 | [mandatorySchemaParameters removeObject:@"title"]; 75 | [mandatorySchemaParameters removeObject:@"message"]; 76 | return mandatorySchemaParameters; 77 | } 78 | 79 | @end 80 | 81 | @implementation WFSDestructiveButtonItem; @end 82 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSBarButtonItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSBarButtonItem.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 17/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSAction.h" 11 | 12 | @interface WFSBarButtonItem : UIBarButtonItem 13 | 14 | @property (nonatomic, strong) id message; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // RUIButton.h 3 | // RemoteUserInterface 4 | // 5 | // Created by Simon Booth on 11/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSAction.h" 12 | 13 | @interface WFSButton : UIButton 14 | 15 | @property (nonatomic, strong) id message; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // RUIButton.m 3 | // RemoteUserInterface 4 | // 5 | // Created by Simon Booth on 11/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSButton.h" 10 | #import "WFSMessage.h" 11 | #import "UIView+WFSSchematising.h" 12 | 13 | @implementation WFSButton 14 | 15 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 16 | { 17 | self = [super initWithSchema:schema context:context error:outError]; 18 | if (self) 19 | { 20 | if (self.accessibilityLabel.length == 0) 21 | { 22 | if (outError) *outError = WFSError(@"Buttons must have a title or an accessibility label"); 23 | return nil; 24 | } 25 | 26 | [self addTarget:self action:@selector(tapped:) forControlEvents:UIControlEventTouchUpInside]; 27 | } 28 | return self; 29 | } 30 | 31 | + (NSArray *)defaultSchemaParameters 32 | { 33 | return [[super defaultSchemaParameters] arrayByPrependingObjectsFromArray:@[ 34 | 35 | @[ [NSString class], @"title" ], 36 | @[ [UIImage class], @"image" ] 37 | 38 | ]]; 39 | } 40 | 41 | + (NSArray *)lazilyCreatedSchemaParameters 42 | { 43 | return [[super lazilyCreatedSchemaParameters] arrayByPrependingObject:@"message"]; 44 | } 45 | 46 | + (NSDictionary *)schemaParameterTypes 47 | { 48 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 49 | 50 | @"title" : [NSString class], 51 | @"image" : [UIImage class], 52 | @"message" : @[ [WFSMessage class], [NSString class] ] 53 | 54 | }]; 55 | } 56 | 57 | - (BOOL)setSchemaParameterWithName:(NSString *)name value:(id)value context:(WFSContext *)context error:(NSError *__autoreleasing *)outError 58 | { 59 | if ([name isEqualToString:@"title"]) 60 | { 61 | [self setTitle:value forState:UIControlStateNormal]; 62 | return YES; 63 | } 64 | else if ([name isEqualToString:@"image"]) 65 | { 66 | [self setImage:value forState:UIControlStateNormal]; 67 | return YES; 68 | } 69 | 70 | return [super setSchemaParameterWithName:name value:value context:context error:outError]; 71 | } 72 | 73 | - (void)tapped:(id)sender 74 | { 75 | WFSMutableContext *context = [self.workflowContext mutableCopy]; 76 | context.actionSender = sender; 77 | [self sendMessageFromParameterWithName:@"message" context:context]; 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSComparisonCondition.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSComparisonCondition.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 26/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum { 12 | WFSStrictlyLessThan, 13 | WFSLessThanOrEqual, 14 | WFSGreaterThanOrEqual, 15 | WFSStrictlyGreaterThan 16 | } WFSComparisonType; 17 | 18 | @interface WFSComparisonCondition : WFSCondition 19 | 20 | @property (nonatomic, assign) WFSComparisonType comparisonType; 21 | @property (nonatomic, strong) id otherValue; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSCondition.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSValidateAction.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSchematising.h" 10 | #import "WFSAction.h" 11 | 12 | @interface WFSCondition : NSObject 13 | 14 | @property (nonatomic, strong) NSString *failureMessage; // Used in form validations 15 | @property (nonatomic, strong) WFSSchema *value; 16 | 17 | - (BOOL)evaluateWithContext:(WFSContext *)context; 18 | - (BOOL)evaluateWithValue:(id)value context:(WFSContext *)context; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSCondition.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSValidateAction.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSCondition.h" 10 | 11 | @implementation WFSCondition 12 | 13 | + (NSArray *)lazilyCreatedSchemaParameters 14 | { 15 | return [[super lazilyCreatedSchemaParameters] arrayByPrependingObject:@"value"]; 16 | } 17 | 18 | + (NSDictionary *)schemaParameterTypes 19 | { 20 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 21 | 22 | @"failureMessage" : [NSString class], 23 | @"value" : [NSObject class] 24 | 25 | }]; 26 | } 27 | 28 | - (BOOL)evaluateWithContext:(WFSContext *)context 29 | { 30 | NSError *error = nil; 31 | id value = [self schemaParameterWithName:@"value" context:context error:&error]; 32 | return [self evaluateWithValue:value context:context]; 33 | } 34 | 35 | - (BOOL)evaluateWithValue:(id)value context:(WFSContext *)context 36 | { 37 | return YES; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSConditionalAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSConditionalAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 19/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | #import "WFSCondition.h" 11 | 12 | @interface WFSConditionalAction : WFSAction 13 | 14 | @property (nonatomic, strong) WFSCondition *condition; 15 | @property (nonatomic, strong) WFSAction *successAction; 16 | @property (nonatomic, strong) WFSAction *failureAction; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSConditionalAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSConditionalAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 19/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSConditionalAction.h" 10 | 11 | @implementation WFSConditionalAction 12 | 13 | + (NSArray *)mandatorySchemaParameters 14 | { 15 | return [[super mandatorySchemaParameters] arrayByAddingObject:@"condition"]; 16 | } 17 | 18 | + (NSArray *)defaultSchemaParameters 19 | { 20 | return [[super defaultSchemaParameters] arrayByPrependingObjectsFromArray:@[ 21 | 22 | @[ [WFSCondition class], @"condition" ], 23 | @[ [WFSAction class], @"successAction" ], 24 | 25 | ]]; 26 | } 27 | 28 | + (NSDictionary *)schemaParameterTypes 29 | { 30 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 31 | 32 | @"condition" : [WFSCondition class], 33 | @"successAction" : [WFSAction class], 34 | @"failureAction" : [WFSAction class] 35 | 36 | }]; 37 | } 38 | 39 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 40 | { 41 | if ([self.condition evaluateWithContext:context]) 42 | { 43 | return [self.successAction performActionForController:controller context:context]; 44 | } 45 | else 46 | { 47 | return [self.failureAction performActionForController:controller context:context]; 48 | } 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSConditionalSchema.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSConditionalSchema.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 03/12/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSchema.h" 10 | 11 | @interface WFSConditionalSchema : WFSMutableSchema 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSConditionalSchema.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSConditionalSchema.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 03/12/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSConditionalSchema.h" 10 | #import "WFSCondition.h" 11 | #import "WFSSchema+WFSGroupedParameters.h" 12 | 13 | @implementation WFSConditionalSchema 14 | 15 | - (Class)classForGroupedParameters 16 | { 17 | return [self class]; 18 | } 19 | 20 | + (NSDictionary *)schemaParameterTypes 21 | { 22 | return @{ @"successValue" : [NSObject class], @"failureValue" : [NSObject class], @"condition" : [WFSCondition class] }; 23 | } 24 | 25 | + (NSArray *)defaultSchemaParameters 26 | { 27 | return @[ @[ [WFSCondition class], @"condition" ] ]; 28 | } 29 | 30 | + (NSArray *)lazilyCreatedSchemaParameters 31 | { 32 | return @[ @"successValue", @"failureValue" ]; 33 | } 34 | 35 | + (NSArray *)mandatorySchemaParameters 36 | { 37 | return @[ @"condition" ]; 38 | } 39 | 40 | - (id)createObjectWithContext:(WFSContext *)context error:(NSError **)outError 41 | { 42 | NSError *error = nil; 43 | WFSSchema *schema = nil; 44 | 45 | @try 46 | { 47 | NSDictionary *groupedParameters = [self groupedParametersWithContext:context error:&error]; 48 | WFSCondition *condition = groupedParameters[@"condition"]; 49 | 50 | if ([condition evaluateWithContext:context]) 51 | { 52 | schema = groupedParameters[@"successValue"]; 53 | } 54 | else 55 | { 56 | schema = groupedParameters[@"failureValue"]; 57 | } 58 | } 59 | @catch (NSException *exception) 60 | { 61 | error = WFSErrorFromException(exception); 62 | } 63 | 64 | if (outError) *outError = error; 65 | return error ? nil : [schema createObjectWithContext:context error:outError]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSContainerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // C360DFTContainer.h 3 | // DynamicFormsTest 4 | // 5 | // Created by Simon Booth on 10/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | typedef enum { 13 | WFSContainerViewVerticalLayout = 0, // Lay out one after another, vertically, at preferred size for width, separated by contentPadding 14 | // If numberOfColumns is greater than one, lay out in rows. Columns are sized to widest member. 15 | WFSContainerViewCenterLayout, // Size all to fit and show in center 16 | WFSContainerViewFillLayout // Fill the available space. If there is not enough room for one, expand all to right or bottom. 17 | } WFSContainerViewLayout; 18 | 19 | @interface WFSContainerView : UIView 20 | 21 | // Use this instead of addSubview: 22 | - (void)addContentView:(UIView *)view; 23 | @property (nonatomic, strong, readonly) NSArray *contentViews; 24 | 25 | @property (nonatomic, assign, readonly) WFSContainerViewLayout layout; 26 | 27 | @property (nonatomic, assign) UIEdgeInsets contentEdgeInsets UI_APPEARANCE_SELECTOR; 28 | @property (nonatomic, assign) CGSize contentPadding UI_APPEARANCE_SELECTOR; 29 | @property (nonatomic, assign) CGSize desiredSize UI_APPEARANCE_SELECTOR; 30 | @property (nonatomic, strong) UIImage *backgroundImage UI_APPEARANCE_SELECTOR; 31 | 32 | @property (nonatomic, assign) NSUInteger numberOfColumns; 33 | @property (nonatomic, assign) BOOL rightAlignLastColumn; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSControllerAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSControllerAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 21/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | 11 | @interface WFSControllerAction : WFSAction 12 | 13 | @property (nonatomic, strong) id controller; 14 | 15 | - (WFSResult *)showController:(UIViewController *)controller forController:(UIViewController *)controller context:(WFSContext *)context; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSControllerAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSControllerAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 21/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSControllerAction.h" 10 | #import "WFSLoadSchemaAction.h" 11 | #import "WFSParameterProxy.h" 12 | 13 | @implementation WFSControllerAction 14 | 15 | + (NSArray *)lazilyCreatedSchemaParameters 16 | { 17 | return [[super lazilyCreatedSchemaParameters] arrayByAddingObject:@"controller"]; 18 | } 19 | 20 | + (NSArray *)defaultSchemaParameters 21 | { 22 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [UIViewController class], @"controller" ]]; 23 | } 24 | 25 | + (NSDictionary *)schemaParameterTypes 26 | { 27 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ @"controller" : [UIViewController class] }]; 28 | } 29 | 30 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 31 | { 32 | NSError *error = nil; 33 | UIViewController *controllerToShow = nil; 34 | 35 | if (self.controller) 36 | { 37 | controllerToShow = (UIViewController *)[self schemaParameterWithName:@"controller" context:context error:&error]; 38 | } 39 | else 40 | { 41 | WFSSchema *schema = context.userInfo[WFSLoadSchemaActionSchemaKey]; 42 | 43 | WFSMutableContext *controllerContext = [context mutableCopy]; 44 | NSMutableDictionary *userInfo = [context.userInfo mutableCopy]; 45 | [userInfo removeObjectForKey:WFSLoadSchemaActionSchemaKey]; 46 | controllerContext.userInfo = userInfo; 47 | 48 | controllerToShow = (UIViewController *)[schema createObjectWithContext:controllerContext error:&error]; 49 | } 50 | 51 | if (![controllerToShow isKindOfClass:[UIViewController class]]) 52 | { 53 | if (!error) error = WFSError(@"Parameter of type %@ is not a view controller", [controller class]); 54 | [context sendWorkflowError:error]; 55 | return nil; 56 | } 57 | 58 | return [self showController:controllerToShow forController:controller context:context]; 59 | } 60 | 61 | - (WFSResult *)showController:(UIViewController *)controllerToShow forController:(UIViewController *)controller context:(WFSContext *)context 62 | { 63 | // abstract method 64 | [self doesNotRecognizeSelector:_cmd]; 65 | return nil; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSDatePicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSDatePicker.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSFormInput.h" 12 | 13 | @interface WFSDatePicker : UIDatePicker 14 | 15 | @property (nonatomic, strong) id message; 16 | 17 | @property (nonatomic, strong, readonly) id formValue; 18 | @property (nonatomic, strong) NSArray *validations; 19 | @property (nonatomic, weak) id formInputDelegate; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSDismissControllerAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSDismissControllerAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | 11 | @interface WFSDismissControllerAction : WFSAction 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSDismissControllerAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSDismissControllerAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSDismissControllerAction.h" 10 | 11 | @implementation WFSDismissControllerAction 12 | 13 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 14 | { 15 | BOOL animated = YES; 16 | if ([WFSAction actionAnimationsAreDisabled]) animated = NO; 17 | 18 | if (controller) 19 | { 20 | [controller dismissViewControllerAnimated:animated completion:nil]; 21 | return [WFSResult successResultWithContext:context]; 22 | } 23 | else 24 | { 25 | NSError *error = WFSError(@"Cannot find presenting controller"); 26 | [context sendWorkflowError:error]; 27 | return [WFSResult failureResultWithContext:context]; 28 | } 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSEndEditingAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSEndEditingAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | 11 | @interface WFSEndEditingAction : WFSAction 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSEndEditingAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSEndEditingAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSEndEditingAction.h" 10 | 11 | @implementation WFSEndEditingAction 12 | 13 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 14 | { 15 | [controller.view endEditing:YES]; 16 | return [WFSResult successResultWithContext:context]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSEqualityCondition.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSConfirmationCondition.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSCondition.h" 10 | 11 | @interface WFSEqualityCondition : WFSCondition 12 | 13 | @property (nonatomic, strong) id otherValue; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSEqualityCondition.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSConfirmationCondition.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSEqualityCondition.h" 10 | 11 | @implementation WFSEqualityCondition 12 | 13 | + (NSArray *)mandatorySchemaParameters 14 | { 15 | return [[super mandatorySchemaParameters] arrayByAddingObjectsFromArray:@[ @"otherValue" ]]; 16 | } 17 | 18 | + (NSArray *)lazilyCreatedSchemaParameters 19 | { 20 | return [[super lazilyCreatedSchemaParameters] arrayByAddingObjectsFromArray:@[ @"otherValue" ]]; 21 | } 22 | 23 | + (NSArray *)defaultSchemaParameters 24 | { 25 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [NSObject class], @"otherValue" ]]; 26 | } 27 | 28 | + (NSDictionary *)schemaParameterTypes 29 | { 30 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ @"otherValue" : [NSObject class] }]; 31 | } 32 | 33 | - (BOOL)evaluateWithValue:(id)value context:(WFSContext *)context 34 | { 35 | NSError *error = nil; 36 | 37 | id otherValue = [self schemaParameterWithName:@"otherValue" context:context error:&error]; 38 | if (error) [context sendWorkflowError:error]; 39 | 40 | return ((!value && !otherValue) || [value isEqual:otherValue]); 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSError.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSError.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 17/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class WFSSchema; 12 | @class WFSContext; 13 | 14 | extern NSString * const WFSErrorDomain; 15 | extern NSString * const WFSErrorCodeError; 16 | extern NSString * const WFSErrorCodeException; 17 | 18 | extern NSString * const WFSErrorSelectorKey; 19 | extern NSString * const WFSErrorClassKey; 20 | extern NSString * const WFSErrorFileNameKey; 21 | extern NSString * const WFSErrorLineNumberKey; 22 | extern NSString * const WFSErrorCallStackKey; 23 | extern NSString * const WFSErrorExceptionKey; 24 | extern NSString * const WFSErrorDescriptionKey; 25 | 26 | #define WFSError(X, args...) [WFSError errorWithInfo:@{ \ 27 | WFSErrorSelectorKey:NSStringFromSelector(_cmd), \ 28 | WFSErrorClassKey:(self ? NSStringFromClass([self class]) : [NSNull null]), \ 29 | WFSErrorFileNameKey:[[NSString stringWithUTF8String:__FILE__] lastPathComponent], \ 30 | WFSErrorLineNumberKey:[NSNumber numberWithInt:__LINE__], \ 31 | WFSErrorCallStackKey:[NSThread callStackSymbols], \ 32 | WFSErrorDescriptionKey:[NSString stringWithFormat:X, ##args] }] 33 | 34 | #define WFSErrorFromException(E) [WFSError errorWithInfo:@{ \ 35 | WFSErrorExceptionKey:E, \ 36 | WFSErrorCallStackKey:[E callStackSymbols], \ 37 | WFSErrorDescriptionKey:[NSString stringWithFormat:@"Exception %@: %@", E.name, E.reason] }] 38 | 39 | @interface WFSError : NSError 40 | 41 | + (WFSError *)errorWithInfo:(NSDictionary *)userInfo; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSError.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSError.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 17/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSError.h" 10 | 11 | NSString * const WFSErrorDomain = @"com.credit360.WFSErrorDomain"; 12 | 13 | NSString * const WFSErrorSelectorKey = @"selector"; 14 | NSString * const WFSErrorClassKey = @"class"; 15 | NSString * const WFSErrorFileNameKey = @"fileName"; 16 | NSString * const WFSErrorLineNumberKey = @"lineNumber"; 17 | NSString * const WFSErrorCallStackKey = @"callStack"; 18 | NSString * const WFSErrorExceptionKey = @"exception"; 19 | NSString * const WFSErrorDescriptionKey = @"description"; 20 | 21 | @implementation WFSError 22 | 23 | + (WFSError *)errorWithInfo:(NSDictionary *)userInfo 24 | { 25 | return [self errorWithDomain:WFSErrorDomain code:0 userInfo:userInfo]; 26 | } 27 | 28 | - (NSString *)localizedDescription 29 | { 30 | return self.userInfo[WFSErrorDescriptionKey]; 31 | } 32 | 33 | - (NSString *)localizedFailureReason 34 | { 35 | return self.userInfo[WFSErrorDescriptionKey]; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSFormAccessoryView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSFormAccessoryView.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSFormAccessoryView : UIToolbar 13 | 14 | @property (nonatomic, strong) NSString *previousButtonTitle; 15 | @property (nonatomic, strong) NSString *nextButtonTitle; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSFormController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSFormController.h.h 3 | // 4 | // Created on 2012-10-15 using NibFree 5 | // 6 | 7 | #import 8 | #import "UIViewController+WFSSchematising.h" 9 | #import "WFSSchematising.h" 10 | #import "WFSAction.h" 11 | #import "WFSFormView.h" 12 | #import "WFSFormInput.h" 13 | #import "WFSFormAccessoryView.h" 14 | 15 | // some messages are special-cased for forms 16 | extern NSString * const WFSFormSubmitMessageName; 17 | 18 | // A submitted form will try to perform one of didSubmit or didNotSubmit. 19 | extern NSString * const WFSFormDidSubmitActionName; 20 | extern NSString * const WFSFormDidNotSubmitActionName; 21 | 22 | @interface WFSFormController : UIViewController 23 | 24 | @property (nonatomic, strong) NSArray *triggers; 25 | @property (nonatomic, strong) WFSFormAccessoryView *formAccessoryView; 26 | 27 | @property (nonatomic, strong, readonly) WFSFormView *formView; 28 | 29 | @property (nonatomic, strong, readonly) NSArray *allInputs; 30 | @property (nonatomic, strong, readonly) NSArray *responsiveInputs; 31 | @property (nonatomic, strong, readonly) NSDictionary *namedInputs; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSFormInput.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSFormInput.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @protocol WFSFormInputDelegate; 13 | 14 | @protocol WFSFormInput 15 | 16 | @property (nonatomic, strong, readonly) id formValue; // this MUST NOT return nil 17 | 18 | @property (nonatomic, strong, readonly) NSArray *validations; 19 | 20 | @property (nonatomic, weak) id formInputDelegate; 21 | 22 | @end 23 | 24 | @protocol WFSFormInputDelegate 25 | 26 | - (void)formInputWillBeginEditing:(id)formInput; 27 | - (BOOL)formInputShouldReturn:(id)formInput; 28 | - (void)formInputDidEndEditing:(id)formInput; 29 | 30 | - (BOOL)canFocusPreviousInput:(id)formInput; 31 | - (BOOL)focusPreviousInput:(id)formInput; 32 | 33 | - (BOOL)canFocusNextInput:(id)formInput; 34 | - (BOOL)focusNextInput:(id)formInput; 35 | 36 | @end -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSFormTrigger.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSFormTrigger.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 01/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSFormController.h" 11 | #import "WFSSchematising.h" 12 | #import "WFSCondition.h" 13 | 14 | @interface WFSFormTrigger : NSObject 15 | 16 | @property (nonatomic, strong) WFSCondition *condition; 17 | 18 | @property (nonatomic, strong) id successMessage; 19 | @property (nonatomic, strong) NSArray *successTriggers; 20 | 21 | @property (nonatomic, strong) id failureMessage; 22 | @property (nonatomic, strong) NSArray *failureTriggers; 23 | 24 | - (void)fireWithContext:(WFSContext *)context; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSFormTrigger.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSFormTrigger.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 01/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSFormTrigger.h" 10 | #import "WFSCondition.h" 11 | 12 | @implementation WFSFormTrigger 13 | 14 | + (NSArray *)arraySchemaParameters 15 | { 16 | return [[super arraySchemaParameters] arrayByPrependingObjectsFromArray:@[ 17 | 18 | @"successTriggers", 19 | @"failureTriggers" 20 | 21 | ]]; 22 | } 23 | 24 | + (NSArray *)defaultSchemaParameters 25 | { 26 | return [[super defaultSchemaParameters] arrayByPrependingObjectsFromArray:@[ 27 | 28 | @[ [WFSCondition class], @"condition" ] 29 | 30 | ]]; 31 | } 32 | 33 | + (NSArray *)lazilyCreatedSchemaParameters 34 | { 35 | return [[super lazilyCreatedSchemaParameters] arrayByPrependingObjectsFromArray:@[@"successMessage", @"successMessage"]]; 36 | } 37 | 38 | + (NSDictionary *)schemaParameterTypes 39 | { 40 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 41 | 42 | @"condition" : [WFSCondition class], 43 | 44 | @"successMessage" : @[ [WFSMessage class], [NSString class] ], 45 | @"successTriggers" : [WFSFormTrigger class], 46 | 47 | @"failureMessage" : @[ [WFSMessage class], [NSString class] ], 48 | @"failureTriggers" : [WFSFormTrigger class] 49 | 50 | }]; 51 | } 52 | 53 | - (void)fireWithContext:(WFSContext *)context 54 | { 55 | id message = nil; 56 | NSString *messageParameterName = nil; 57 | NSArray *triggers = nil; 58 | 59 | if (!self.condition || [self.condition evaluateWithContext:context]) 60 | { 61 | message = self.successMessage; 62 | messageParameterName = @"successMessage"; 63 | triggers = self.successTriggers; 64 | } 65 | else 66 | { 67 | message = self.failureMessage; 68 | messageParameterName = @"failureMessage"; 69 | triggers = self.failureTriggers; 70 | } 71 | 72 | if (message) 73 | { 74 | [self sendMessageFromParameterWithName:messageParameterName context:context]; 75 | } 76 | 77 | for (WFSFormTrigger *trigger in triggers) 78 | { 79 | [trigger fireWithContext:context]; 80 | } 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSFormView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSFormView.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSHostView.h" 10 | 11 | @interface WFSFormView : WFSHostView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSFormView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSFormView.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSFormView.h" 10 | 11 | @implementation WFSFormView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSHideViewsAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSHideInputsAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 01/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSViewsAction.h" 10 | 11 | @interface WFSHideViewsAction : WFSViewsAction 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSHideViewsAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSHideInputsAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 01/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSHideViewsAction.h" 10 | #import "UIView+WorkflowSchema.h" 11 | 12 | @implementation WFSHideViewsAction 13 | 14 | + (NSArray *)defaultSchemaParameters 15 | { 16 | return [[super defaultSchemaParameters] arrayByAddingObject:@[ [NSString class], @"viewNames" ]]; 17 | } 18 | 19 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 20 | { 21 | NSArray *views = [controller.view subviewsWithWorkflowNames:self.viewNames]; 22 | 23 | NSMutableArray *visibleViews = [NSMutableArray array]; 24 | for (UIView *view in views) 25 | { 26 | if (!view.hidden) [visibleViews addObject:view]; 27 | } 28 | 29 | BOOL animated = YES; 30 | if ([WFSAction actionAnimationsAreDisabled]) animated = NO; 31 | 32 | if (animated) 33 | { 34 | [UIView animateWithDuration:0.25 animations:^{ 35 | 36 | for (UIView *view in visibleViews) 37 | { 38 | view.alpha = 0; 39 | } 40 | 41 | } completion:^(BOOL finished) { 42 | 43 | for (UIView *view in visibleViews) 44 | { 45 | view.hidden = YES; 46 | } 47 | 48 | [UIView animateWithDuration:0.25 animations:^{ 49 | 50 | [self notifyDidChangeHierarchyOfView:controller.view]; 51 | 52 | }]; 53 | }]; 54 | } 55 | else 56 | { 57 | for (UIView *view in visibleViews) 58 | { 59 | view.hidden = YES; 60 | } 61 | } 62 | 63 | return [WFSResult successResultWithContext:context]; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSHostView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSHostView.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSHostView : UIView 13 | 14 | @property (nonatomic, strong, readonly) id hostedElement; 15 | @property (nonatomic, strong, readonly) UIView *hostedView; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSHostView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSHostView.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSHostView.h" 10 | #import "WFSViewsAction.h" 11 | 12 | @interface WFSHostView () 13 | 14 | @end 15 | 16 | @implementation WFSHostView 17 | 18 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 19 | { 20 | NSError *error = nil; 21 | 22 | self = [super init]; 23 | if (self) 24 | { 25 | self.opaque = YES; 26 | 27 | WFS_SCHEMATISING_PROPERTY_INITITIALISATION 28 | 29 | if (schema) _hostedElement = [schema createObjectWithContext:context error:&error]; 30 | 31 | if ([_hostedElement isKindOfClass:[UIViewController class]]) 32 | { 33 | UIViewController *controller = (UIViewController *)_hostedElement; 34 | [controller willMoveToParentViewController:context.containerController]; 35 | _hostedView = controller.view; 36 | [self addSubview:_hostedView]; 37 | [context.containerController addChildViewController:controller]; 38 | [controller didMoveToParentViewController:context.containerController]; 39 | 40 | } 41 | else if ([_hostedElement isKindOfClass:[UIView class]]) 42 | { 43 | _hostedView = (UIView *)_hostedElement; 44 | [self addSubview:_hostedView]; 45 | } 46 | else if (schema) 47 | { 48 | if (!error) error = WFSError(@"Hosted element of type %@ is not a view or view controller", [_hostedElement class]); 49 | return nil; 50 | } 51 | 52 | _hostedView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 53 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hierarchyChanged:) name:WFSViewsActionDidChangeHierarchyNotification object:nil]; 54 | } 55 | 56 | if (outError) *outError = error; 57 | return self; 58 | } 59 | 60 | - (void)dealloc 61 | { 62 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 63 | } 64 | 65 | - (void)layoutSubviews 66 | { 67 | self.hostedView.frame = self.bounds; 68 | } 69 | 70 | - (void)hierarchyChanged:(NSNotification *)notification 71 | { 72 | UIView *view = notification.userInfo[WFSViewsActionNotificationViewKey]; 73 | if (view && [self isDescendantOfView:view]) 74 | { 75 | [self layoutSubviews]; 76 | } 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSImageView.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSImageView : UIImageView 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSImageView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSImageView.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSImageView.h" 10 | 11 | @implementation WFSImageView 12 | 13 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 14 | { 15 | self = [super initWithSchema:schema context:context error:outError]; 16 | if (self) 17 | { 18 | if (!self.image) 19 | { 20 | if (outError) *outError = WFSError(@"Image views must have an image"); 21 | return nil; 22 | } 23 | } 24 | return self; 25 | } 26 | 27 | + (NSArray *)defaultSchemaParameters 28 | { 29 | return [[super defaultSchemaParameters] arrayByPrependingObjectsFromArray:@[ @[ [NSString class], @"imageName" ], @[ [UIImage class], @"image" ] ]]; 30 | } 31 | 32 | + (NSDictionary *)schemaParameterTypes 33 | { 34 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ @"imageName" : [NSString class], @"image" : [UIImage class] }]; 35 | } 36 | 37 | - (BOOL)setSchemaParameterWithName:(NSString *)name value:(id)value context:(WFSContext *)context error:(NSError *__autoreleasing *)outError 38 | { 39 | if ([name isEqualToString:@"imageName"]) 40 | { 41 | UIImage *image = [UIImage imageNamed:value]; 42 | if (!image) 43 | { 44 | if (outError) *outError = WFSError(@"Cannot find image named %@", value); 45 | return NO; 46 | } 47 | 48 | return [super setSchemaParameterWithName:@"image" value:image context:context error:outError]; 49 | } 50 | 51 | return [super setSchemaParameterWithName:name value:value context:context error:outError]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // RUILabel.h 3 | // RemoteUserInterface 4 | // 5 | // Created by Simon Booth on 11/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSLabel : UILabel 13 | 14 | @property (nonatomic, copy) NSString *name; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // RUILabel.m 3 | // RemoteUserInterface 4 | // 5 | // Created by Simon Booth on 11/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSLabel.h" 10 | 11 | @implementation WFSLabel 12 | 13 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 14 | { 15 | self = [super initWithSchema:schema context:context error:outError]; 16 | if (self) 17 | { 18 | self.opaque = NO; 19 | self.backgroundColor = [UIColor clearColor]; 20 | self.numberOfLines = 0; 21 | } 22 | return self; 23 | } 24 | 25 | + (NSArray *)defaultSchemaParameters 26 | { 27 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[[NSString class], @"text"]]; 28 | } 29 | 30 | + (NSDictionary *)schemaParameterTypes 31 | { 32 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 33 | 34 | @"adjustsFontSizeToFitWidth" : @[ [NSString class], [NSNumber class] ], 35 | @"numberOfLines" : @[ [NSString class], [NSNumber class] ], 36 | @"text" : [NSString class] 37 | 38 | }]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSLoadSchemaAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSShowWorkflowAction.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | 11 | extern NSString * const WFSLoadSchemaActionMessageName; // Tells the message delegate to load a schema 12 | 13 | extern NSString * const WFSLoadSchemaActionPathKey; // The path will be contained in this key 14 | extern NSString * const WFSLoadSchemaActionSchemaKey; // The schema should be returned in this key 15 | 16 | @interface WFSLoadSchemaAction : WFSAction 17 | 18 | @property (nonatomic, strong) NSString *path; 19 | 20 | @property (nonatomic, strong) WFSAction *successAction; 21 | @property (nonatomic, strong) WFSAction *failureAction; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSLongPressGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSLongPressGestureRecognizer.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSAction.h" 12 | 13 | @interface WFSLongPressGestureRecognizer : UILongPressGestureRecognizer 14 | 15 | @property (nonatomic, strong) id beginMessage; 16 | @property (nonatomic, strong) id endMessage; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSMacros.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSMacros.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 14/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #define WFSCastOrNil(X, C) ([X isKindOfClass:[C class]] ? (C *)X : nil) -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSMultipleAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSMultipleAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 21/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | 11 | @interface WFSMultipleAction : WFSAction 12 | 13 | @property (nonatomic, strong) NSArray *actions; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSMultipleAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSMultipleAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 21/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSMultipleAction.h" 10 | #import "UIViewController+WFSSchematising.h" 11 | 12 | @implementation WFSMultipleAction 13 | 14 | + (NSArray *)mandatorySchemaParameters 15 | { 16 | return [[super mandatorySchemaParameters] arrayByAddingObject:@"actions"]; 17 | } 18 | 19 | + (NSArray *)arraySchemaParameters 20 | { 21 | return [[super arraySchemaParameters] arrayByAddingObject:@"actions"]; 22 | } 23 | 24 | + (NSArray *)defaultSchemaParameters 25 | { 26 | return [[super arraySchemaParameters] arrayByAddingObject:@[ [WFSAction class], @"actions" ]]; 27 | } 28 | 29 | + (NSDictionary *)schemaParameterTypes 30 | { 31 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ @"actions" : [WFSAction class] }]; 32 | } 33 | 34 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 35 | { 36 | for (WFSAction *action in self.actions) 37 | { 38 | WFSResult *result = [action performActionForController:controller context:context]; 39 | if (!result.isSuccess) return result; 40 | context = result.context; 41 | } 42 | 43 | return [WFSResult successResultWithContext:context]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSMultipleCondition.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSMultipleCondition.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 01/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSCondition.h" 10 | 11 | typedef enum { 12 | 13 | WFSMultipleConditionAll, 14 | WFSMultipleConditionAny, 15 | WFSMultipleConditionNone 16 | 17 | } WFSMultipleConditionRequirement; 18 | 19 | @interface WFSMultipleCondition : WFSCondition 20 | 21 | @property (nonatomic, assign) WFSMultipleConditionRequirement requirement; 22 | @property (nonatomic, strong) NSArray *conditions; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSMultipleCondition.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSMultipleCondition.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 01/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSMultipleCondition.h" 10 | 11 | @implementation WFSMultipleCondition 12 | 13 | + (NSArray *)arraySchemaParameters 14 | { 15 | return [[super arraySchemaParameters] arrayByPrependingObject:@"conditions"]; 16 | } 17 | 18 | + (NSArray *)mandatorySchemaParameters 19 | { 20 | return [[super mandatorySchemaParameters] arrayByPrependingObject:@"conditions"]; 21 | } 22 | 23 | + (NSArray *)defaultSchemaParameters 24 | { 25 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [WFSCondition class], @"conditions" ]]; 26 | } 27 | 28 | + (NSDictionary *)enumeratedSchemaParameters 29 | { 30 | return [[super enumeratedSchemaParameters] dictionaryByAddingEntriesFromDictionary:@{ 31 | 32 | @"requirement" : @{ 33 | 34 | @"any" : @(WFSMultipleConditionAny), 35 | @"all" : @(WFSMultipleConditionAll) 36 | 37 | } 38 | 39 | }]; 40 | } 41 | 42 | + (NSDictionary *)schemaParameterTypes 43 | { 44 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 45 | 46 | @"conditions" : [WFSCondition class], 47 | @"requirement" : @[ [NSString class], [NSNumber class] ] 48 | 49 | }]; 50 | } 51 | 52 | - (BOOL)evaluateWithValue:(id)value context:(WFSContext *)context 53 | { 54 | for (WFSCondition *condition in self.conditions) 55 | { 56 | BOOL conditionIsTrue; 57 | 58 | if (condition.value) 59 | { 60 | conditionIsTrue = [condition evaluateWithContext:context]; 61 | } 62 | else 63 | { 64 | conditionIsTrue = [condition evaluateWithValue:value context:context]; 65 | } 66 | 67 | if (conditionIsTrue) 68 | { 69 | if (self.requirement == WFSMultipleConditionAny) return YES; 70 | else if (self.requirement == WFSMultipleConditionNone) return NO; 71 | } 72 | else 73 | { 74 | if (self.requirement == WFSMultipleConditionAll) return NO; 75 | } 76 | } 77 | 78 | if (self.requirement == WFSMultipleConditionAny) return NO; 79 | else return YES; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSNavigationBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSNavigationBar.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSNavigationBar : UINavigationBar 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSNavigationBar.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSNavigationBar.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSNavigationBar.h" 10 | 11 | @implementation WFSNavigationBar 12 | 13 | + (NSArray *)arraySchemaParameters 14 | { 15 | return [[super arraySchemaParameters] arrayByAddingObject:@"items"]; 16 | } 17 | 18 | + (NSArray *)defaultSchemaParameters 19 | { 20 | return [[super defaultSchemaParameters] arrayByAddingObject:@[ [UINavigationItem class], @"items" ]]; 21 | } 22 | 23 | + (NSDictionary *)schemaParameterTypes 24 | { 25 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 26 | 27 | @"items" : [UINavigationItem class] 28 | 29 | }]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSNavigationController.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSNavigationController : UINavigationController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSNavigationController.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSNavigationController.h" 10 | #import "UIViewController+WFSSchematising.h" 11 | #import "WFSAction.h" 12 | 13 | @interface WFSNavigationController () 14 | 15 | @end 16 | 17 | @implementation WFSNavigationController 18 | 19 | + (NSArray *)mandatorySchemaParameters 20 | { 21 | return [[super mandatorySchemaParameters] arrayByAddingObjectsFromArray:@[ @"viewControllers" ]]; 22 | } 23 | 24 | + (NSArray *)arraySchemaParameters 25 | { 26 | return [[super arraySchemaParameters] arrayByAddingObjectsFromArray:@[ @"viewControllers" ]]; 27 | } 28 | 29 | + (NSArray *)defaultSchemaParameters 30 | { 31 | return [[super defaultSchemaParameters] arrayByPrependingObjectsFromArray:@[ 32 | 33 | @[ [UIViewController class], @"viewControllers" ] 34 | 35 | ]]; 36 | } 37 | 38 | + (NSDictionary *)schemaParameterTypes 39 | { 40 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 41 | 42 | @"viewControllers" : [UIViewController class], 43 | @"navigationBarHidden" : @[ [NSString class], [NSNumber class] ], 44 | @"toolbarHidden" : @[ [NSString class], [NSNumber class] ] 45 | 46 | }]; 47 | } 48 | 49 | #pragma mark - Actions 50 | 51 | WFS_UIVIEWCONTROLLER_LIFECYCLE 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSNavigationItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSNavigationItem.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "UINavigationItem+WFSSchematising.h" 12 | 13 | @interface WFSNavigationItem : UINavigationItem 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSNavigationItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSNavigationItem.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSNavigationItem.h" 10 | 11 | @implementation WFSNavigationItem 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSNegatedCondition.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSNegatedCondition.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 22/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSCondition.h" 10 | 11 | @interface WFSNegatedCondition : WFSCondition 12 | 13 | @property (nonatomic, strong) WFSCondition *condition; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSNegatedCondition.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSNegatedCondition.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 22/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSNegatedCondition.h" 10 | 11 | @implementation WFSNegatedCondition 12 | 13 | + (NSArray *)defaultSchemaParameters 14 | { 15 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [WFSCondition class], @"condition" ]]; 16 | } 17 | 18 | + (NSDictionary *)schemaParameterTypes 19 | { 20 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ @"condition" : [WFSCondition class] }]; 21 | } 22 | 23 | - (BOOL)evaluateWithValue:(id)value context:(WFSContext *)context 24 | { 25 | BOOL result = [self.condition evaluateWithValue:value context:context]; 26 | return !result; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSParameterProxy.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSProxySchema.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 21/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSchema.h" 10 | 11 | @interface WFSParameterProxy : WFSMutableSchema 12 | 13 | @property (nonatomic, strong, readonly) NSString *parameterKeyPath; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSPopControllerAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSPopControllerAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | 11 | @interface WFSPopControllerAction : WFSAction 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSPopControllerAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSPopControllerAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSPopControllerAction.h" 10 | 11 | @implementation WFSPopControllerAction 12 | 13 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 14 | { 15 | UINavigationController *navigationController = controller.navigationController; 16 | 17 | BOOL animated = YES; 18 | if ([WFSAction actionAnimationsAreDisabled]) animated = NO; 19 | 20 | if (controller && navigationController) 21 | { 22 | [navigationController popToViewController:controller animated:animated]; 23 | return [WFSResult successResultWithContext:context]; 24 | } 25 | else 26 | { 27 | NSError *error = WFSError(@"Cannot find navigation controller"); 28 | [context sendWorkflowError:error]; 29 | return [WFSResult failureResultWithContext:context]; 30 | } 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSPresenceCondition.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSPresenceCondition.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 19/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSCondition.h" 10 | 11 | @interface WFSPresenceCondition : WFSCondition 12 | 13 | 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSPresenceCondition.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSPresenceCondition.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 19/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSPresenceCondition.h" 10 | 11 | @implementation WFSPresenceCondition 12 | 13 | + (NSArray *)defaultSchemaParameters 14 | { 15 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [NSObject class], @"value" ]]; 16 | } 17 | 18 | - (BOOL)evaluateWithValue:(id)value context:(WFSContext *)context 19 | { 20 | if ([value isKindOfClass:[NSString class]]) 21 | { 22 | NSString *stringValue = [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 23 | return (stringValue.length > 0); 24 | } 25 | else if ([value isKindOfClass:[NSNull class]]) 26 | { 27 | return NO; 28 | } 29 | 30 | return (value != nil); 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSPresentControllerAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSPresentControllerAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSControllerAction.h" 10 | 11 | @interface WFSPresentControllerAction : WFSControllerAction 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSPresentControllerAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSPresentControllerAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSPresentControllerAction.h" 10 | #import "WFSLoadSchemaAction.h" 11 | 12 | @implementation WFSPresentControllerAction 13 | 14 | - (WFSResult *)showController:(UIViewController *)controllerToPresent forController:(UIViewController *)presentingController context:(WFSContext *)context 15 | { 16 | BOOL animated = YES; 17 | if ([WFSAction actionAnimationsAreDisabled]) animated = NO; 18 | 19 | if (controllerToPresent && presentingController) 20 | { 21 | [presentingController presentViewController:controllerToPresent animated:animated completion:nil]; 22 | return [WFSResult successResultWithContext:context]; 23 | } 24 | else 25 | { 26 | NSError *error = WFSError(@"Cannot find presenting controller"); 27 | [context sendWorkflowError:error]; 28 | return [WFSResult failureResultWithContext:context]; 29 | } 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSPushControllerAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSPushControllerAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSControllerAction.h" 10 | 11 | @interface WFSPushControllerAction : WFSControllerAction 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSPushControllerAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSPushControllerAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSPushControllerAction.h" 10 | #import "WFSLoadSchemaAction.h" 11 | 12 | @implementation WFSPushControllerAction 13 | 14 | - (WFSResult *)showController:(UIViewController *)controllerToPush forController:(UIViewController *)controller context:(WFSContext *)context 15 | { 16 | UINavigationController *navigationController = controller.navigationController; 17 | 18 | BOOL animated = YES; 19 | if ([WFSAction actionAnimationsAreDisabled]) animated = NO; 20 | 21 | if (navigationController && controllerToPush) 22 | { 23 | [navigationController pushViewController:controllerToPush animated:animated]; 24 | return [WFSResult successResultWithContext:context]; 25 | } 26 | else 27 | { 28 | NSError *error = WFSError(@"Cannot find navigation controller"); 29 | [context sendWorkflowError:error]; 30 | return [WFSResult failureResultWithContext:context]; 31 | } 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSRegularExpressionCondition.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSRegularExpressionCondition.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSCondition.h" 10 | 11 | @interface WFSRegularExpressionCondition : WFSCondition 12 | 13 | @property (nonatomic, strong, readonly) NSString *pattern; 14 | @property (nonatomic, strong, readonly) NSRegularExpression *patternRegex; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSRegularExpressionCondition.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSRegularExpressionCondition.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSRegularExpressionCondition.h" 10 | 11 | @interface WFSRegularExpressionCondition () 12 | 13 | @end 14 | 15 | @implementation WFSRegularExpressionCondition 16 | 17 | + (NSArray *)mandatorySchemaParameters 18 | { 19 | return [[super mandatorySchemaParameters] arrayByAddingObject:@"pattern"]; 20 | } 21 | 22 | + (NSArray *)defaultSchemaParameters 23 | { 24 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [NSString class], @"pattern" ]]; 25 | } 26 | 27 | + (NSDictionary *)schemaParameterTypes 28 | { 29 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ @"pattern" : [NSString class] }]; 30 | } 31 | 32 | - (BOOL)setSchemaParameterWithName:(NSString *)name value:(id)value context:(WFSContext *)context error:(NSError *__autoreleasing *)outError 33 | { 34 | if ([name isEqualToString:@"pattern"]) 35 | { 36 | _pattern = value; 37 | _patternRegex = [NSRegularExpression regularExpressionWithPattern:_pattern options:NSRegularExpressionCaseInsensitive error:outError]; 38 | return (_patternRegex != nil); 39 | } 40 | else return [super setSchemaParameterWithName:name value:value context:context error:outError]; 41 | } 42 | 43 | - (BOOL)evaluateWithValue:(id)value context:(WFSContext *)context 44 | { 45 | NSString *stringValue = nil; 46 | if ([value isKindOfClass:[NSString class]]) 47 | { 48 | stringValue = value; 49 | } 50 | else if ([value respondsToSelector:@selector(stringValue)]) 51 | { 52 | stringValue = [value stringValue]; 53 | } 54 | if (!stringValue) stringValue = @""; 55 | 56 | NSArray *matches = [self.patternRegex matchesInString:stringValue options:0 range:NSMakeRange(0, stringValue.length)]; 57 | 58 | return (matches.count > 0); 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSReplaceRootControllerAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSReplaceRootControllerAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 23/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSControllerAction.h" 10 | 11 | @interface WFSReplaceRootControllerAction : WFSControllerAction 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSReplaceRootControllerAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSReplaceRootControllerAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 23/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSReplaceRootControllerAction.h" 10 | 11 | @implementation WFSReplaceRootControllerAction 12 | 13 | - (WFSResult *)showController:(UIViewController *)controllerToShow forController:(UIViewController *)controller context:(WFSContext *)context 14 | { 15 | UINavigationController *navigationController = (UINavigationController *)controller; 16 | 17 | if ([navigationController isKindOfClass:[UINavigationController class]] && controllerToShow) 18 | { 19 | [navigationController setViewControllers:@[ controllerToShow ]]; 20 | return [WFSResult successResultWithContext:context]; 21 | } 22 | else 23 | { 24 | NSError *error = WFSError(@"WFSReplaceRootControllerAction can only be performed by a navigation controller"); 25 | [context sendWorkflowError:error]; 26 | return [WFSResult failureResultWithContext:context]; 27 | } 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSResult.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSResult.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSContext.h" 11 | 12 | extern NSString * const WFSResultNameSuccess; 13 | extern NSString * const WFSResultNameFailure; 14 | 15 | @interface WFSResult : NSObject 16 | 17 | + (WFSResult *)successResultWithContext:(WFSContext *)context; 18 | + (WFSResult *)failureResultWithContext:(WFSContext *)context; 19 | 20 | + (WFSResult *)resultWithSuccess:(BOOL)success name:(NSString *)name context:(WFSContext *)context; 21 | - (id)initWithSuccess:(BOOL)success name:(NSString *)name context:(WFSContext *)context; 22 | 23 | @property (nonatomic, assign, readonly) BOOL isSuccess; 24 | @property (nonatomic, copy, readonly) NSString *name; 25 | @property (nonatomic, strong, readonly) WFSContext *context; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSResult.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSResult.h" 10 | 11 | NSString * const WFSResultNameSuccess = @"success"; 12 | NSString * const WFSResultNameFailure = @"failure"; 13 | 14 | @implementation WFSResult 15 | 16 | + (WFSResult *)successResultWithContext:(WFSContext *)context 17 | { 18 | return [self resultWithSuccess:YES name:WFSResultNameSuccess context:context]; 19 | } 20 | 21 | + (WFSResult *)failureResultWithContext:(WFSContext *)context 22 | { 23 | return [self resultWithSuccess:NO name:WFSResultNameFailure context:context]; 24 | } 25 | 26 | + (WFSResult *)resultWithSuccess:(BOOL)success name:(NSString *)name context:(WFSContext *)context 27 | { 28 | return [[self alloc] initWithSuccess:success name:name context:context]; 29 | } 30 | 31 | - (id)initWithSuccess:(BOOL)success name:(NSString *)name context:(WFSContext *)context 32 | { 33 | self = [super init]; 34 | if (self) 35 | { 36 | _isSuccess = success; 37 | _name = [name copy]; 38 | _context = context; 39 | } 40 | return self; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSchema+WFSDocumentation.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSchema+WFSDocumentation.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 23/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSchema.h" 10 | 11 | @interface WFSSchema (WFSDocumentation) 12 | 13 | + (NSString *) documentTypeDescription; 14 | + (NSString *) xmlSchemaDefinition; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSchema+WFSGroupedParameters.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSchema+WFSGroupedParameters.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 19/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSchema.h" 10 | 11 | @interface WFSSchema (WFSGroupedParameters) 12 | 13 | - (Class)classForGroupedParameters; 14 | - (NSDictionary *)groupedParametersWithContext:(WFSContext *)context error:(NSError **)outError; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSchema.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSchema.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class WFSContext; 12 | @protocol WFSSchematising; 13 | 14 | @interface WFSSchema : NSObject 15 | 16 | - (id)initWithTypeName:(NSString *)typeName attributes:(NSDictionary *)attributes parameters:(NSArray *)parameters; 17 | 18 | @property (nonatomic, copy, readonly) NSString *typeName; 19 | @property (nonatomic, copy, readonly) NSDictionary *attributes; 20 | @property (nonatomic, strong, readonly) NSArray *parameters; 21 | 22 | @property (nonatomic, readonly) Class schemaClass; 23 | 24 | @property (nonatomic, retain) NSLocale *locale; 25 | 26 | @property (nonatomic, readonly) NSString *styleName; 27 | @property (nonatomic, readonly) NSString *workflowName; 28 | 29 | + (void)registerClass:(Class)schemaClass forTypeName:(NSString *)typeName; 30 | + (Class)registeredClassForTypeName:(NSString *)typeName; 31 | + (NSArray *)registeredTypeNames; 32 | 33 | - (id)createObjectWithContext:(WFSContext *)context error:(NSError **)outError; 34 | 35 | @end 36 | 37 | @interface WFSMutableSchema : WFSSchema 38 | 39 | - (id)initWithTypeName:(NSString *)typeName attributes:(NSDictionary *)attributes; 40 | - (void)addParameter:(id)parameter; 41 | 42 | @end 43 | 44 | @protocol WFSSchemaDelegate 45 | 46 | - (void)schema:(WFSSchema *)schema didCreateObject:(id)object withContext:(WFSContext *)context; 47 | 48 | @end -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSchemaParameter.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSchemaParameter.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 19/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WFSSchemaParameter : NSObject 12 | 13 | @property (nonatomic, copy) NSString *name; 14 | @property (nonatomic, strong) id value; 15 | 16 | - (id)initWithName:(NSString *)name; 17 | - (id)initWithName:(NSString *)name value:(id)value; 18 | 19 | - (void)addValue:(id)value; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSchemaParameter.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSchemaParameter.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 19/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSchemaParameter.h" 10 | #import "WFSSchematising.h" 11 | 12 | @implementation WFSSchemaParameter 13 | 14 | - (id)initWithName:(NSString *)name 15 | { 16 | return [self initWithName:name value:nil]; 17 | } 18 | 19 | - (id)initWithName:(NSString *)name value:(id)value 20 | { 21 | self = [super init]; 22 | if (self) 23 | { 24 | _name = name; 25 | _value = value; 26 | } 27 | return self; 28 | } 29 | 30 | - (void)addValue:(id)value 31 | { 32 | if (self.value) 33 | { 34 | self.value = [[self.value flattenedArray] arrayByAddingObject:value]; 35 | } 36 | else self.value = value; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSchematising.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSchema.h" 10 | #import "WFSContext.h" 11 | #import "NSObject+WFSSchematising.h" 12 | 13 | /* 14 | * Defines the initialiser used when creating objects from a schema. 15 | * 16 | * See also the NSObject(WFSSchematising) category for the methods that an object should 17 | * override in order to tell the schema how to create it. 18 | */ 19 | @protocol WFSSchematising 20 | 21 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError; 22 | 23 | // these are implemented by NSObject(WFSSchematising) so there's no need to synthesize them. 24 | - (WFSSchema *)workflowSchema; 25 | - (WFSContext *)workflowContext; 26 | - (NSString *)workflowName; 27 | 28 | @end 29 | 30 | #define WFS_SCHEMATISING_PROPERTY_INITITIALISATION \ 31 | self.workflowSchema = schema; \ 32 | self.workflowContext = context; \ 33 | self.workflowName = schema.workflowName; 34 | 35 | #define WFS_SCHEMATISING_PARAMETER_INITIALISATION \ 36 | if (![self setParametersForSchema:schema context:context error:outError]) return nil; 37 | 38 | #define WFS_SCHEMATISING_INITIALISATION \ 39 | WFS_SCHEMATISING_PROPERTY_INITITIALISATION \ 40 | WFS_SCHEMATISING_PARAMETER_INITIALISATION -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSScreenController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RUIRemoteController.h.h 3 | // 4 | // Created on 2012-10-11 using NibFree 5 | // 6 | 7 | #import 8 | #import "WFSSchematising.h" 9 | #import "WFSScreenView.h" 10 | 11 | @interface WFSScreenController : UIViewController 12 | 13 | @property (nonatomic, retain) NSArray *actions; 14 | 15 | @property (nonatomic, strong) WFSScreenView *screenView; 16 | @property (nonatomic, strong) WFSToolbar *toolbar; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSScreenView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RUIRemoteView.h.h 3 | // 4 | // Created on 2012-10-11 using NibFree 5 | // 6 | 7 | #import 8 | #import "WFSHostView.h" 9 | #import "WFSToolbar.h" 10 | 11 | @interface WFSScreenView : WFSHostView 12 | 13 | @property (nonatomic, strong) WFSToolbar *toolbar; 14 | 15 | @property (nonatomic, assign) UIInterfaceOrientation interfaceOrientation; 16 | @property (nonatomic, strong) UIImage *backgroundImage UI_APPEARANCE_SELECTOR; 17 | @property (nonatomic, strong) UIImage *portraitBackgroundImage UI_APPEARANCE_SELECTOR; 18 | @property (nonatomic, strong) UIImage *landscapeBackgroundImage UI_APPEARANCE_SELECTOR; 19 | 20 | @end 21 | 22 | 23 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSearchBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSearchBar.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 15/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSFormInput.h" 12 | 13 | extern NSString * WFSSearchBarTextKey; 14 | extern NSString * WFSSearchBarScopeKey; 15 | 16 | @interface WFSSearchBar : UISearchBar 17 | 18 | @property (nonatomic, strong, readonly) id formValue; 19 | @property (nonatomic, strong) NSArray *validations; 20 | @property (nonatomic, weak) id formInputDelegate; 21 | @property (nonatomic, strong) NSArray *scopeButtonItems; 22 | 23 | @property (nonatomic, copy) id searchMessage; 24 | @property (nonatomic, copy) id cancelMessage; 25 | @property (nonatomic, copy) id bookmarkMessage; 26 | @property (nonatomic, copy) id resultsListMessage; 27 | @property (nonatomic, copy) id textDidChangeMessage; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSegment.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSegment.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSSegment : NSObject 13 | 14 | @property (nonatomic, copy) NSString *title; 15 | @property (nonatomic, strong) UIImage *image; 16 | @property (nonatomic, strong) id message; 17 | @property (nonatomic, assign) BOOL enabled; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSegment.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSegment.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSegment.h" 10 | #import "WFSMessage.h" 11 | 12 | @implementation WFSSegment 13 | 14 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 15 | { 16 | self = [super initWithSchema:schema context:context error:outError]; 17 | if (self) 18 | { 19 | if ((self.title.length == 0) && (self.image.accessibilityLabel.length == 0)) 20 | { 21 | if (outError) *outError = WFSError(@"Segments must have a title or an accessibilityLabel"); 22 | return nil; 23 | } 24 | 25 | _enabled = YES; 26 | } 27 | return self; 28 | } 29 | 30 | + (NSArray *)defaultSchemaParameters 31 | { 32 | return [[super defaultSchemaParameters] arrayByPrependingObjectsFromArray:@[ 33 | 34 | @[ [NSString class], @"title" ], 35 | @[ [UIImage class], @"image" ], 36 | @[ [WFSMessage class], @"message" ] 37 | 38 | ]]; 39 | } 40 | 41 | + (NSArray *)lazilyCreatedSchemaParameters 42 | { 43 | return [[super lazilyCreatedSchemaParameters] arrayByAddingObject:@"message"]; 44 | } 45 | 46 | + (NSDictionary *)schemaParameterTypes 47 | { 48 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 49 | 50 | @"title" : [NSString class], 51 | @"image" : [UIImage class], 52 | @"message" : @[ [WFSMessage class], [NSString class] ], 53 | @"enabled" : @[ [NSString class], [NSNumber class] ] 54 | 55 | }]; 56 | } 57 | 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSegmentedControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSegmentedControl.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSSegment.h" 12 | 13 | @interface WFSSegmentedControl : UISegmentedControl 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSendMessageAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSendMessageAction.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | 11 | @interface WFSSendMessageAction : WFSAction 12 | 13 | @property (nonatomic, strong) id message; // The message to send 14 | 15 | @property (nonatomic, strong) NSArray *actions; // Actions to perform based on the response to the message 16 | @property (nonatomic, strong) NSArray *valueNames; // If set, the message context will be restricted to the keys with matching names 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSShowActionSheetAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSActionSheetAction.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | #import "WFSActionButtonItem.h" 11 | 12 | @interface WFSShowActionSheetAction : WFSAction 13 | 14 | @property (nonatomic, strong) id title; 15 | @property (nonatomic, strong) WFSActionButtonItem *cancelButtonItem; 16 | @property (nonatomic, strong) WFSActionButtonItem *destructiveButtonItem; 17 | @property (nonatomic, strong) NSArray *otherButtonItems; 18 | 19 | - (UIActionSheet *)actionSheetWithContext:(WFSContext *)context error:(NSError **)outError; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSShowAlertAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSAlertAction.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 16/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | #import "WFSActionButtonItem.h" 11 | 12 | @interface WFSShowAlertAction : WFSAction 13 | 14 | @property (nonatomic, strong) id title; 15 | @property (nonatomic, strong) id message; 16 | @property (nonatomic, strong) WFSActionButtonItem *cancelButtonItem; 17 | @property (nonatomic, strong) NSArray *otherButtonItems; 18 | 19 | - (UIAlertView *)alertViewWithContext:(WFSContext *)context error:(NSError **)outError; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSShowViewsAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSShowInputsAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 01/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSViewsAction.h" 10 | 11 | @interface WFSShowViewsAction : WFSViewsAction 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSShowViewsAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSShowInputsAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 01/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSShowViewsAction.h" 10 | #import "UIView+WorkflowSchema.h" 11 | 12 | @implementation WFSShowViewsAction 13 | 14 | + (NSArray *)defaultSchemaParameters 15 | { 16 | return [[super defaultSchemaParameters] arrayByAddingObject:@[ [NSString class], @"viewNames" ]]; 17 | } 18 | 19 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 20 | { 21 | NSArray *views = [controller.view subviewsWithWorkflowNames:self.viewNames]; 22 | 23 | NSMutableArray *hiddenViews = [NSMutableArray array]; 24 | for (UIView *view in views) 25 | { 26 | if (view.hidden) [hiddenViews addObject:view]; 27 | } 28 | 29 | BOOL animated = YES; 30 | if ([WFSAction actionAnimationsAreDisabled]) animated = NO; 31 | 32 | if (animated) 33 | { 34 | for (UIView *view in hiddenViews) 35 | { 36 | view.hidden = NO; 37 | view.alpha = 0; 38 | } 39 | 40 | [UIView animateWithDuration:0.25 animations:^{ 41 | 42 | [self notifyDidChangeHierarchyOfView:controller.view]; 43 | 44 | } completion:^(BOOL finished) { 45 | 46 | [UIView animateWithDuration:0.25 animations:^{ 47 | 48 | for (UIView *view in hiddenViews) 49 | { 50 | view.alpha = 1; 51 | } 52 | 53 | }]; 54 | 55 | }]; 56 | } 57 | else 58 | { 59 | for (UIView *view in hiddenViews) 60 | { 61 | view.hidden = NO; 62 | view.alpha = 1; 63 | } 64 | } 65 | 66 | return [WFSResult successResultWithContext:context]; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSlider.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSlider.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 26/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSFormInput.h" 12 | 13 | @interface WFSSlider : UISlider 14 | 15 | @property (nonatomic, strong) id message; 16 | 17 | @property (nonatomic, strong, readonly) id formValue; 18 | @property (nonatomic, strong) NSArray *validations; 19 | @property (nonatomic, weak) id formInputDelegate; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSStoreValueAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSetVariableAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 12/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | 11 | @interface WFSStoreValueAction : WFSAction 12 | 13 | @property (nonatomic, strong) NSString *name; // Where to store the value 14 | @property (nonatomic, strong) id value; // The value to store 15 | @property (nonatomic, assign) BOOL transient; // If true, the value is only stored in the result's context. If false, it is also stored to the controller. 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSStoreValueAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSetVariableAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 12/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSStoreValueAction.h" 10 | #import "UIViewController+WFSSchematising.h" 11 | 12 | @implementation WFSStoreValueAction 13 | 14 | + (NSArray *)mandatorySchemaParameters 15 | { 16 | return [[super mandatorySchemaParameters] arrayByAddingObject:@"name"]; 17 | } 18 | 19 | + (NSArray *)defaultSchemaParameters 20 | { 21 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [NSString class], @"name" ]]; 22 | } 23 | 24 | + (NSArray *)lazilyCreatedSchemaParameters 25 | { 26 | return [[super lazilyCreatedSchemaParameters] arrayByAddingObject:@"value"]; 27 | } 28 | 29 | + (NSDictionary *)schemaParameterTypes 30 | { 31 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 32 | 33 | @"name" : [NSString class], 34 | @"value" : [NSObject class], 35 | @"transient" : @[ [NSString class], [NSNumber class] ] 36 | 37 | }]; 38 | } 39 | 40 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 41 | { 42 | NSError *error = nil; 43 | 44 | id value = nil; 45 | if (self.value) 46 | { 47 | value = [self schemaParameterWithName:@"value" context:context error:&error]; 48 | 49 | if (error) 50 | { 51 | [context sendWorkflowError:error]; 52 | return [WFSResult failureResultWithContext:context]; 53 | } 54 | } 55 | else 56 | { 57 | value = context.userInfo; 58 | } 59 | 60 | if (!value) value = [NSNull null]; 61 | NSDictionary *valuesToStore = @{ self.name : value }; 62 | 63 | // Store the value in the controller 64 | if (!self.transient) [controller storeValues:valuesToStore]; 65 | 66 | // *also* store it in the current context 67 | WFSMutableContext *responseContext = [context mutableCopy]; 68 | responseContext.userInfo = [context.userInfo dictionaryByAddingEntriesFromDictionary:valuesToStore]; 69 | 70 | return [WFSResult successResultWithContext:responseContext]; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSwipeGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSwipeGestureRecognizer.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSAction.h" 12 | 13 | @interface WFSSwipeGestureRecognizer : UISwipeGestureRecognizer 14 | 15 | @property (nonatomic, strong) id message; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSwipeGestureRecognizer.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSwipeGestureRecognizer.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSwipeGestureRecognizer.h" 10 | #import "WFSSchematising.h" 11 | 12 | @implementation WFSSwipeGestureRecognizer 13 | 14 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 15 | { 16 | self = [super initWithSchema:schema context:context error:outError]; 17 | if (self) 18 | { 19 | [self addTarget:self action:@selector(handleWorkflowSwipe:)]; 20 | } 21 | return self; 22 | } 23 | 24 | + (NSArray *)mandatorySchemaParameters 25 | { 26 | return [[super mandatorySchemaParameters] arrayByPrependingObject:@"message"]; 27 | } 28 | 29 | + (NSArray *)lazilyCreatedSchemaParameters 30 | { 31 | return [[super lazilyCreatedSchemaParameters] arrayByPrependingObject:@"message"]; 32 | } 33 | 34 | + (NSDictionary *)schemaParameterTypes 35 | { 36 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 37 | 38 | @"message" : @[ [WFSMessage class], [NSString class] ], 39 | @"numberOfTouchesRequired" : @[ [NSString class], [NSNumber class] ], 40 | @"direction" : @[ [NSString class], [NSNumber class] ] 41 | 42 | }]; 43 | } 44 | 45 | + (NSDictionary *)enumeratedSchemaParameters 46 | { 47 | return [[super enumeratedSchemaParameters] dictionaryByAddingEntriesFromDictionary:@{ 48 | 49 | @"direction" : @{ 50 | 51 | @"up": @(UISwipeGestureRecognizerDirectionUp), 52 | @"down": @(UISwipeGestureRecognizerDirectionDown), 53 | @"left": @(UISwipeGestureRecognizerDirectionLeft), 54 | @"right": @(UISwipeGestureRecognizerDirectionRight) 55 | 56 | } 57 | 58 | }]; 59 | } 60 | 61 | - (void)handleWorkflowSwipe:(WFSSwipeGestureRecognizer *)sender 62 | { 63 | switch (sender.state) { 64 | case UIGestureRecognizerStateRecognized: 65 | { 66 | WFSMutableContext *context = [self.workflowContext mutableCopy]; 67 | context.actionSender = sender.view; 68 | [self sendMessageFromParameterWithName:@"message" context:context]; 69 | } 70 | 71 | default: 72 | break; 73 | } 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSwitch.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSwitch.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 03/12/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSFormInput.h" 12 | 13 | @interface WFSSwitch : UISwitch 14 | 15 | @property (nonatomic, strong, readonly) id formValue; 16 | @property (nonatomic, strong) NSArray *validations; 17 | @property (nonatomic, weak) id formInputDelegate; 18 | 19 | @property (nonatomic, strong) id message; 20 | 21 | @property (nonatomic, strong) NSObject *onValue; 22 | @property (nonatomic, strong) NSObject *offValue; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSSwitch.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSwitch.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 03/12/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSwitch.h" 10 | #import "WFSMessage.h" 11 | 12 | @implementation WFSSwitch 13 | 14 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 15 | { 16 | self = [super initWithSchema:schema context:context error:outError]; 17 | if (self) 18 | { 19 | if (self.accessibilityLabel.length == 0) 20 | { 21 | if (outError) *outError = WFSError(@"Switches must have an accessibilityLabel"); 22 | return nil; 23 | } 24 | 25 | if ((self.onValue && !self.offValue) || (self.offValue && !self.onValue)) 26 | { 27 | if (outError) *outError = WFSError(@"Switches must have both an onValue and an offValue, or neither"); 28 | return nil; 29 | } 30 | 31 | [self addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; 32 | } 33 | return self; 34 | } 35 | 36 | + (NSArray *)lazilyCreatedSchemaParameters 37 | { 38 | return [[super lazilyCreatedSchemaParameters] arrayByPrependingObject:@"message"]; 39 | } 40 | 41 | + (NSArray *)defaultSchemaParameters 42 | { 43 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [WFSMessage class], @"message" ]]; 44 | } 45 | 46 | + (NSDictionary *)schemaParameterTypes 47 | { 48 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 49 | 50 | @"on" : @[ [NSString class], [NSNumber class] ], 51 | @"onValue" : [NSObject class], 52 | @"offValue" : [NSObject class], 53 | @"message" : @[ [WFSMessage class], [NSString class] ] 54 | 55 | }]; 56 | } 57 | 58 | - (id)formValue 59 | { 60 | if (self.onValue && self.offValue) 61 | { 62 | return (self.on) ? self.onValue : self.offValue; 63 | } 64 | else return [NSNumber numberWithBool:self.on]; 65 | } 66 | 67 | - (void)valueChanged:(id)sender 68 | { 69 | [self.formInputDelegate formInputDidEndEditing:self]; 70 | 71 | if (self.message) 72 | { 73 | WFSMutableContext *context = [self.workflowContext mutableCopy]; 74 | context.actionSender = sender; 75 | [self sendMessageFromParameterWithName:@"message" context:context]; 76 | } 77 | } 78 | 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTabBarController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTabBarController.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSTabBarController : UITabBarController 13 | 14 | @property (nonatomic, retain) NSArray *actions; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTabBarController.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTabBarController.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSTabBarController.h" 10 | #import "UIViewController+WFSSchematising.h" 11 | #import "WFSAction.h" 12 | 13 | @interface WFSTabBarController () 14 | 15 | @end 16 | 17 | @implementation WFSTabBarController 18 | 19 | + (NSArray *)mandatorySchemaParameters 20 | { 21 | return [[super mandatorySchemaParameters] arrayByAddingObjectsFromArray:@[ @"viewControllers" ]]; 22 | } 23 | 24 | + (NSArray *)arraySchemaParameters 25 | { 26 | return [[super arraySchemaParameters] arrayByAddingObjectsFromArray:@[ @"viewControllers" ]]; 27 | } 28 | 29 | + (NSArray *)defaultSchemaParameters 30 | { 31 | return [[super defaultSchemaParameters] arrayByPrependingObjectsFromArray:@[ 32 | 33 | @[ [UIViewController class], @"viewControllers" ] 34 | 35 | ]]; 36 | } 37 | 38 | + (NSDictionary *)schemaParameterTypes 39 | { 40 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 41 | 42 | @"viewControllers" : [UIViewController class] 43 | 44 | }]; 45 | } 46 | 47 | #pragma mark - Actions 48 | 49 | WFS_UIVIEWCONTROLLER_LIFECYCLE 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTabBarItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTabBarItem.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 17/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSTabBarItem : UITabBarItem 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTabBarItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTabBarItem.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 17/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSTabBarItem.h" 10 | #import "WFSSchema+WFSGroupedParameters.h" 11 | 12 | @implementation WFSTabBarItem 13 | 14 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 15 | { 16 | NSDictionary *groupedParameters = [schema groupedParametersWithContext:context error:outError]; 17 | if (!groupedParameters) return nil; 18 | 19 | NSString *title = groupedParameters[@"title"]; 20 | UIImage *image = groupedParameters[@"image"]; 21 | 22 | self = [super initWithTitle:title image:image tag:0]; 23 | if (self) 24 | { 25 | WFS_SCHEMATISING_INITIALISATION 26 | } 27 | return self; 28 | } 29 | 30 | + (NSArray *)mandatorySchemaParameters 31 | { 32 | return [[super mandatorySchemaParameters] arrayByPrependingObjectsFromArray:@[ @"title", @"image" ]]; 33 | } 34 | 35 | + (NSArray *)defaultSchemaParameters 36 | { 37 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [UIImage class], @"image" ]]; 38 | } 39 | 40 | + (NSDictionary *)schemaParameterTypes 41 | { 42 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ @"image" : [UIImage class], @"title" : [NSString class], @"badgeValue" : [NSString class] }]; 43 | } 44 | 45 | - (BOOL)setSchemaParameterWithName:(NSString *)name value:(id)value context:(WFSContext *)context error:(NSError *__autoreleasing *)outError 46 | { 47 | if ([@[ @"image", @"title" ] containsObject:name]) 48 | { 49 | // we had to deal with these in advance 50 | return YES; 51 | } 52 | 53 | return [super setSchemaParameterWithName:name value:value context:context error:outError]; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTableCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTableCell.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 18/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSTableCellSchematising.h" 11 | #import "WFSAction.h" 12 | 13 | @interface WFSTableCell : UITableViewCell 14 | 15 | @property (nonatomic, assign, readonly) UITableViewCellStyle style; 16 | 17 | @property (nonatomic, strong) id message; 18 | @property (nonatomic, strong) NSString *detailDisclosureMessage; 19 | @property (nonatomic, copy, readwrite) NSString *name; 20 | @property (nonatomic, assign, getter = isSelectable) BOOL selectable; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTableCellSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTableCellSchematising.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 18/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSAction.h" 12 | 13 | @protocol WFSTableCellSchematising 14 | 15 | @property (nonatomic, strong) id message; 16 | @property (nonatomic, strong) id detailDisclosureMessage; 17 | @property (nonatomic, assign, getter = isSelectable) BOOL selectable; 18 | 19 | @end -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTableController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTableViewController.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 17/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | extern NSString * const WFSTableReloadDataMessageName; 13 | extern NSString * const WFSTableDidSelectCellActionName; 14 | 15 | @interface WFSTableController : UITableViewController 16 | 17 | @property (nonatomic, strong) id tableHeaderView; 18 | @property (nonatomic, strong) id sections; 19 | @property (nonatomic, strong) id tableFooterView; 20 | 21 | @end -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTableSection.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTableSection.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 17/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSTableSection : NSObject 13 | 14 | @property (nonatomic, strong, readonly) NSString *headerTitle; 15 | @property (nonatomic, strong, readonly) NSArray *cells; 16 | @property (nonatomic, strong, readonly) NSString *footerTitle; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTableSection.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTableSection.m 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 17/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSTableSection.h" 10 | #import "WFSTableCell.h" 11 | 12 | @interface WFSTableSection () 13 | 14 | @property (nonatomic, strong, readwrite) NSString *headerTitle; 15 | @property (nonatomic, strong, readwrite) NSArray *cells; 16 | @property (nonatomic, strong, readwrite) NSString *footerTitle; 17 | 18 | @end 19 | 20 | @implementation WFSTableSection 21 | 22 | + (NSArray *)arraySchemaParameters 23 | { 24 | return [[super arraySchemaParameters] arrayByPrependingObject:@"cells"]; 25 | } 26 | 27 | + (NSArray *)defaultSchemaParameters 28 | { 29 | return [[super defaultSchemaParameters] arrayByPrependingObjectsFromArray:@[ @[ [NSString class], @"headerTitle" ], @[ [UITableViewCell class], @"cells" ] ]]; 30 | } 31 | 32 | + (NSDictionary *)schemaParameterTypes 33 | { 34 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ @"headerTitle" : [NSString class], @"footerTitle" : [NSString class], @"cells" : [UITableViewCell class] }]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTapGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTapGestureRecognizer.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSAction.h" 12 | 13 | @interface WFSTapGestureRecognizer : UITapGestureRecognizer 14 | 15 | @property (nonatomic, strong) id message; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTapGestureRecognizer.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTapGestureRecognizer.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSTapGestureRecognizer.h" 10 | #import "WFSSchematising.h" 11 | 12 | @implementation WFSTapGestureRecognizer 13 | 14 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 15 | { 16 | self = [super initWithSchema:schema context:context error:outError]; 17 | if (self) 18 | { 19 | [self addTarget:self action:@selector(handleWorkflowSwipe:)]; 20 | } 21 | return self; 22 | } 23 | 24 | + (NSArray *)mandatorySchemaParameters 25 | { 26 | return [[super mandatorySchemaParameters] arrayByPrependingObject:@"message"]; 27 | } 28 | 29 | + (NSArray *)lazilyCreatedSchemaParameters 30 | { 31 | return [[super lazilyCreatedSchemaParameters] arrayByPrependingObject:@"message"]; 32 | } 33 | 34 | 35 | + (NSDictionary *)schemaParameterTypes 36 | { 37 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 38 | 39 | @"message" : @[ [WFSMessage class], [NSString class] ], 40 | @"numberOfTapsRequired" : @[ [NSString class], [NSNumber class] ], 41 | @"numberOfTouchesRequired" : @[ [NSString class], [NSNumber class] ] 42 | 43 | }]; 44 | } 45 | 46 | - (void)handleWorkflowSwipe:(WFSTapGestureRecognizer *)sender 47 | { 48 | if (sender.state == UIGestureRecognizerStateRecognized) 49 | { 50 | WFSMutableContext *context = [self.workflowContext mutableCopy]; 51 | context.actionSender = sender.view; 52 | [self sendMessageFromParameterWithName:@"message" context:context]; 53 | } 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // C360LTTextField.h 3 | // LoginTest 4 | // 5 | // Created by Simon Booth on 04/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSFormInput.h" 12 | #import "UIView+WorkflowSchema.h" 13 | 14 | @interface WFSTextField : UITextField 15 | 16 | @property (nonatomic, strong, readonly) id formValue; 17 | @property (nonatomic, strong) NSArray *validations; 18 | @property (nonatomic, weak) id formInputDelegate; 19 | 20 | @property (nonatomic, strong) UIImage *backgroundImage UI_APPEARANCE_SELECTOR; // UITextField misnames this as 'background' 21 | @property (nonatomic, assign) UIEdgeInsets textInsets UI_APPEARANCE_SELECTOR; // default is 4,8,4,8 22 | 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTextView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTextView.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 28/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | #import "WFSFormInput.h" 12 | 13 | @interface WFSTextView : UITextView 14 | 15 | @property (nonatomic, strong, readonly) id formValue; 16 | @property (nonatomic, strong) NSArray *validations; 17 | @property (nonatomic, weak) id formInputDelegate; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSToolbar.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSToolbar.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 22/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchematising.h" 11 | 12 | @interface WFSToolbar : UIToolbar 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSToolbar.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSToolbar.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 22/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSToolbar.h" 10 | 11 | @implementation WFSToolbar 12 | 13 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError *__autoreleasing *)outError 14 | { 15 | self = [super initWithSchema:schema context:context error:outError]; 16 | [self sizeToFit]; 17 | return self; 18 | } 19 | 20 | + (NSArray *)arraySchemaParameters 21 | { 22 | return [[super arraySchemaParameters] arrayByPrependingObject:@"items"]; 23 | } 24 | 25 | + (NSArray *)defaultSchemaParameters 26 | { 27 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [UIBarButtonItem class], @"items"]]; 28 | } 29 | 30 | + (NSDictionary *)schemaParameterTypes 31 | { 32 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 33 | 34 | @"items" : [UIBarButtonItem class] 35 | 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTruthinessCondition.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTruthinessCondition.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 13/12/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSCondition.h" 10 | 11 | @interface WFSTruthinessCondition : WFSCondition 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSTruthinessCondition.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSTruthinessCondition.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 13/12/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSTruthinessCondition.h" 10 | 11 | @implementation WFSTruthinessCondition 12 | 13 | + (NSArray *)defaultSchemaParameters 14 | { 15 | return [[super defaultSchemaParameters] arrayByPrependingObject:@[ [NSObject class], @"value" ]]; 16 | } 17 | 18 | - (BOOL)evaluateWithValue:(id)value context:(WFSContext *)context 19 | { 20 | if ([value respondsToSelector:@selector(boolValue)]) 21 | { 22 | return [value boolValue]; 23 | } 24 | else if ([value isKindOfClass:[NSNull class]]) 25 | { 26 | return NO; 27 | } 28 | else 29 | { 30 | return (value != nil); 31 | } 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSUpdateViewsAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSUpdateViewsAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 22/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSViewsAction.h" 10 | 11 | @interface WFSUpdateViewsAction : WFSViewsAction 12 | 13 | @property (nonatomic, copy) NSString *parameterName; 14 | @property (nonatomic, strong) id value; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSViewsAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSViewsAction.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 02/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSAction.h" 10 | #import "UIView+WorkflowSchema.h" 11 | 12 | extern NSString * const WFSViewsActionDidChangeHierarchyNotification; 13 | extern NSString * const WFSViewsActionNotificationViewKey; 14 | 15 | @interface WFSViewsAction : WFSAction 16 | 17 | @property (nonatomic, strong) NSArray *viewNames; 18 | - (void)notifyDidChangeHierarchyOfView:(UIView *)view; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSViewsAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSViewsAction.m 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 02/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSViewsAction.h" 10 | 11 | NSString * const WFSViewsActionDidChangeHierarchyNotification = @"WFSViewsActionDidChangeHierarchyNotification"; 12 | NSString * const WFSViewsActionNotificationViewKey = @"view"; 13 | 14 | @implementation WFSViewsAction 15 | 16 | + (NSArray *)arraySchemaParameters 17 | { 18 | return [[super arraySchemaParameters] arrayByPrependingObject:@"viewNames"]; 19 | } 20 | 21 | + (NSArray *)mandatorySchemaParameters 22 | { 23 | return [[super mandatorySchemaParameters] arrayByPrependingObject:@"viewNames"]; 24 | } 25 | 26 | + (NSDictionary *)schemaParameterTypes 27 | { 28 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 29 | 30 | @"viewNames" : [NSString class] 31 | 32 | }]; 33 | } 34 | 35 | - (void)notifyDidChangeHierarchyOfView:(UIView *)view 36 | { 37 | [[NSNotificationCenter defaultCenter] postNotificationName:WFSViewsActionDidChangeHierarchyNotification 38 | object:self 39 | userInfo:@{ WFSViewsActionNotificationViewKey : view }]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSWorkflowMessageDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSContextDelegate.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 17/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSMessage.h" 11 | 12 | @class WFSResult; 13 | 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WFSXMLParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSXMLParser.h 3 | // WFSWorkflow 4 | // 5 | // Created by Simon Booth on 15/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WFSSchema.h" 11 | 12 | extern NSString * const WFSXMLParserException; 13 | extern NSString * const WFSXMLParserStackKey; 14 | 15 | @interface WFSXMLParser : NSObject 16 | 17 | - (id)initWithParser:(NSXMLParser *)parser; 18 | - (id)initWithContentsOfURL:(NSURL *)url; 19 | - (id)initWithString:(NSString *)string; 20 | 21 | - (WFSSchema *)parse:(NSError **)outError; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /WorkflowSchema/Code/WorkflowSchema.h: -------------------------------------------------------------------------------- 1 | // 2 | // WorkflowSchema.h 3 | // WorkflowSchema 4 | // 5 | // Created by Simon Booth on 20/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSContext.h" 10 | #import "WFSError.h" 11 | #import "WFSSchema.h" 12 | #import "WFSSchema+WFSDocumentation.h" 13 | #import "WFSSchemaParameter.h" 14 | #import "WFSConditionalSchema.h" 15 | #import "WFSParameterProxy.h" 16 | #import "WFSSchematising.h" 17 | 18 | #import "WFSButton.h" 19 | #import "WFSContainerView.h" 20 | #import "WFSDatePicker.h" 21 | #import "WFSImageView.h" 22 | #import "WFSLabel.h" 23 | #import "WFSNavigationBar.h" 24 | #import "WFSSearchBar.h" 25 | #import "WFSSegmentedControl.h" 26 | #import "WFSSlider.h" 27 | #import "WFSSwitch.h" 28 | #import "WFSTextField.h" 29 | #import "WFSTextView.h" 30 | #import "WFSToolbar.h" 31 | 32 | #import "WFSTapGestureRecognizer.h" 33 | #import "WFSLongPressGestureRecognizer.h" 34 | #import "WFSSwipeGestureRecognizer.h" 35 | 36 | #import "WFSFormController.h" 37 | #import "WFSNavigationController.h" 38 | #import "WFSScreenController.h" 39 | #import "WFSTabBarController.h" 40 | #import "WFSTableController.h" 41 | 42 | #import "WFSCondition.h" 43 | #import "WFSNegatedCondition.h" 44 | #import "WFSComparisonCondition.h" 45 | #import "WFSEqualityCondition.h" 46 | #import "WFSMultipleCondition.h" 47 | #import "WFSPresenceCondition.h" 48 | #import "WFSTruthinessCondition.h" 49 | #import "WFSRegularExpressionCondition.h" 50 | 51 | #import "WFSAction.h" 52 | #import "WFSConditionalAction.h" 53 | #import "WFSMultipleAction.h" 54 | #import "WFSSendMessageAction.h" 55 | #import "WFSShowAlertAction.h" 56 | #import "WFSShowActionSheetAction.h" 57 | #import "WFSLoadSchemaAction.h" 58 | #import "WFSPushControllerAction.h" 59 | #import "WFSPresentControllerAction.h" 60 | #import "WFSPopControllerAction.h" 61 | #import "WFSDismissControllerAction.h" 62 | #import "WFSReplaceRootControllerAction.h" 63 | #import "WFSShowViewsAction.h" 64 | #import "WFSHideViewsAction.h" 65 | #import "WFSUpdateViewsAction.h" 66 | #import "WFSStoreValueAction.h" 67 | #import "WFSEndEditingAction.h" 68 | 69 | #import "WFSFormTrigger.h" 70 | #import "WFSFormInput.h" 71 | #import "WFSFormAccessoryView.h" 72 | 73 | #import "WFSActionButtonItem.h" 74 | #import "WFSBarButtonItem.h" 75 | #import "WFSNavigationItem.h" 76 | #import "WFSTabBarItem.h" 77 | #import "WFSTableSection.h" 78 | #import "WFSTableCell.h" 79 | 80 | #import "WFSXMLParser.h" 81 | -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code/DTAttributedTextView+WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTAttributedTextView+WFSSchematising.h 3 | // WorkflowSchema+DTCoreText 4 | // 5 | // Created by Simon Booth on 28/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "DTCoreText.h" 10 | #import 11 | 12 | @interface DTAttributedTextView (WFSSchematising) 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code/DTAttributedTextView+WFSSchematising.m: -------------------------------------------------------------------------------- 1 | // 2 | // DTAttributedTextView+WFSSchematising.m 3 | // WorkflowSchema+DTCoreText 4 | // 5 | // Created by Simon Booth on 28/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "DTAttributedTextView+WFSSchematising.h" 10 | 11 | @implementation DTAttributedTextView (WFSSchematising) 12 | 13 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 14 | { 15 | self = [super initWithSchema:schema context:context error:outError]; 16 | if (self) 17 | { 18 | self.isAccessibilityElement = YES; 19 | 20 | if (!self.accessibilityLabel) 21 | { 22 | self.accessibilityLabel = [self.attributedString string]; 23 | } 24 | } 25 | return self; 26 | } 27 | 28 | + (NSArray *)mandatorySchemaParameters 29 | { 30 | return [[super mandatorySchemaParameters] arrayByAddingObject:@"attributedString"]; 31 | } 32 | 33 | + (NSArray *)defaultSchemaParameters 34 | { 35 | return [[super mandatorySchemaParameters] arrayByPrependingObjectsFromArray:@[ 36 | 37 | @[ [NSAttributedString class], @"attributedString" ], 38 | @[ [NSString class], @"attributedString" ] 39 | 40 | ]]; 41 | } 42 | 43 | + (NSDictionary *)schemaParameterTypes 44 | { 45 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 46 | 47 | @"attributedString" : @[ [NSAttributedString class], [NSString class] ] 48 | 49 | }]; 50 | } 51 | 52 | - (BOOL)setSchemaParameterWithName:(NSString *)name value:(id)value context:(WFSContext *)context error:(NSError **)outError 53 | { 54 | if ([name isEqualToString:@"attributedString"] && [value isKindOfClass:[NSString class]]) 55 | { 56 | NSData *data = [value dataUsingEncoding:NSUTF8StringEncoding]; 57 | value = [[NSAttributedString alloc] initWithHTMLData:data documentAttributes:nil]; 58 | } 59 | 60 | return [super setSchemaParameterWithName:name value:value context:context error:outError]; 61 | } 62 | 63 | - (CGSize)sizeThatFits:(CGSize)size 64 | { 65 | return [self.contentView sizeThatFits:size]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code/NSAttributedString+WFSSchematising.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedString+WFSSchematising.h 3 | // WorkflowSchema+DTCoreText 4 | // 5 | // Created by Simon Booth on 28/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "DTCoreText.h" 10 | #import 11 | 12 | @interface NSAttributedString (WFSSchematising) 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code/NSAttributedString+WFSSchematising.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedString+WFSSchematising.m 3 | // WorkflowSchema+DTCoreText 4 | // 5 | // Created by Simon Booth on 28/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "NSAttributedString+WFSSchematising.h" 10 | #import 11 | 12 | @implementation NSAttributedString (WFSSchematising) 13 | 14 | - (id)initWithSchema:(WFSSchema *)schema context:(WFSContext *)context error:(NSError **)outError 15 | { 16 | NSDictionary *groupedParameters = [schema groupedParametersWithContext:context error:outError]; 17 | id value = [groupedParameters objectForKey:@"value"]; 18 | 19 | if ([value isKindOfClass:[NSString class]]) 20 | { 21 | value = [value dataUsingEncoding:NSUTF8StringEncoding]; 22 | } 23 | 24 | if ([value isKindOfClass:[NSData class]]) 25 | { 26 | value = [[NSAttributedString alloc] initWithHTMLData:value documentAttributes:nil]; 27 | } 28 | 29 | if ([value isKindOfClass:[NSAttributedString class]]) 30 | { 31 | self = value; 32 | } 33 | 34 | if (self) 35 | { 36 | WFS_SCHEMATISING_INITIALISATION; 37 | } 38 | return self; 39 | } 40 | 41 | + (NSArray *)mandatorySchemaParameters 42 | { 43 | return [[super mandatorySchemaParameters] arrayByAddingObject:@"value"]; 44 | } 45 | 46 | + (NSArray *)defaultSchemaParameters 47 | { 48 | return [[super mandatorySchemaParameters] arrayByPrependingObjectsFromArray:@[ 49 | 50 | @[ [NSAttributedString class], @"value" ], 51 | @[ [NSString class], @"value" ], 52 | @[ [NSData class], @"value" ], 53 | 54 | ]]; 55 | } 56 | 57 | + (NSDictionary *)schemaParameterTypes 58 | { 59 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ 60 | 61 | @"value" : @[ [NSAttributedString class], [NSString class], [NSData class] ] 62 | 63 | }]; 64 | } 65 | 66 | - (BOOL)setSchemaParameterWithName:(NSString *)name value:(id)value context:(WFSContext *)context error:(NSError **)outError 67 | { 68 | if ([name isEqualToString:@"value"]) return YES; 69 | return [super setSchemaParameterWithName:name value:value context:context error:outError]; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code/WFSSchema+DTCoreText.h: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSchema+DTCoreText.h 3 | // WorkflowSchema+DTCoreText 4 | // 5 | // Created by Simon Booth on 28/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WFSSchema (DTCoreText) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code/WFSSchema+DTCoreText.m: -------------------------------------------------------------------------------- 1 | // 2 | // WFSSchema+DTCoreText.m 3 | // WorkflowSchema+DTCoreText 4 | // 5 | // Created by Simon Booth on 28/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WFSSchema+DTCoreText.h" 10 | #import "WorkflowSchema+DTCoreText.h" 11 | 12 | @implementation WFSSchema (DTCoreText) 13 | 14 | + (void)load 15 | { 16 | [self registerClass:[NSAttributedString class] forTypeName:@"attributedString"]; 17 | [self registerClass:[DTAttributedTextView class] forTypeName:@"attributedTextView"]; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code/WorkflowSchema+DTCoreText-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.credit360.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code/WorkflowSchema+DTCoreText-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'WorkflowSchema+DTCoreText' target in the 'WorkflowSchema+DTCoreText' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code/WorkflowSchema+DTCoreText.h: -------------------------------------------------------------------------------- 1 | // 2 | // WorkflowSchema+DTCoreText.h 3 | // WorkflowSchema+DTCoreText 4 | // 5 | // Created by Simon Booth on 28/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "DTAttributedTextView+WFSSchematising.h" -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/Code/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /WorkflowSchema/Modules/WorkflowSchema+DTCoreText/WorkflowSchema+DTCoreText.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WorkflowSchema/WorkflowSchema-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.credit360.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /WorkflowSchema/WorkflowSchema-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'WorkflowSchema' target in the 'WorkflowSchema' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /WorkflowSchema/WorkflowSchema.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WorkflowSchema/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/.gitignore: -------------------------------------------------------------------------------- 1 | Pods/* 2 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTActionSheetTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTActionSheetTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTActionSheetTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTAlertViewTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTAlertViewTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTAlertViewTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTAttributedTextViewUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTAttributedTextViewUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 28/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTAttributedTextViewUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTButtonUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTViewUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTComparisonConditionTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTComparisonConditionTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTComparisonConditionTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTConditionalActionTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTConditionalActionTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 19/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTConditionalActionTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTConditionalSchemaUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTConditionalSchemaUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 03/12/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTConditionalSchemaUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTContainerUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTViewUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTControllerFunctionalTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTTabControllerTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 22/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTControllerFunctionalTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTDatePickerTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTDatePickerTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTDatePickerTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTDatePickerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTDatePickerTests.m 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario+WSTDatePickerTests.h" 10 | #import "KIFTestStep+WSTShared.h" 11 | #import "WSTAssert.h" 12 | #import "WSTTestAction.h" 13 | #import "WSTTestContext.h" 14 | #import 15 | 16 | @implementation KIFTestScenario (WSTDatePickerTests) 17 | 18 | + (id)scenarioUnitTestCreateDatePicker 19 | { 20 | KIFTestScenario *scenario = [KIFTestScenario scenarioWithDescription:@"Test date picker creation"]; 21 | 22 | [scenario addStep:[KIFTestStep stepWithDescription:scenario.description executionBlock:^KIFTestStepResult(KIFTestStep *step, NSError **outError) { 23 | 24 | NSError *error = nil; 25 | 26 | WFSSchema *pickerSchema = [[WFSSchema alloc] initWithTypeName:@"datePicker" attributes:nil parameters:@[ 27 | [[WFSSchemaParameter alloc] initWithName:@"date" value:@"2012/11/10"], 28 | [[WFSSchemaParameter alloc] initWithName:@"minimumDate" value:@"2011/11/10"], 29 | [[WFSSchemaParameter alloc] initWithName:@"maximumDate" value:@"2013/11/10"], 30 | [[WFSSchema alloc] initWithTypeName:@"message" attributes:nil parameters:@[ @"didPickDate" ]] 31 | ]]; 32 | 33 | WSTTestContext *context = [[WSTTestContext alloc] init]; 34 | 35 | WFSDatePicker *picker = (WFSDatePicker *)[pickerSchema createObjectWithContext:context error:&error]; 36 | WSTFailOnError(error); 37 | 38 | [picker sendActionsForControlEvents:UIControlEventValueChanged]; 39 | WSTAssert([[[context.messages lastObject] name] isEqual:@"didPickDate"]); 40 | 41 | return KIFTestStepResultSuccess; 42 | 43 | }]]; 44 | 45 | return scenario; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTDateTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTDateTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTDateTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTDocumentationTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTDocumentationTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 30/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTDocumentationTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTFormControllerUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTFormControllerUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTFormControllerUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTImageViewUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTViewUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTLabelUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTViewUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTMultipleActionsTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTMultipleActionsTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTMultipleActionsTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTNavigationBarTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTNavigationBarTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTNavigationBarTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTNavigationControllerTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTNavigationControllerTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTNavigationControllerTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTNavigationControllerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTNavigationControllerTests.m 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario+WSTNavigationControllerTests.h" 10 | #import "KIFTestStep+WSTShared.h" 11 | #import "WSTAssert.h" 12 | #import "WSTTestAction.h" 13 | #import "WSTTestContext.h" 14 | 15 | @implementation KIFTestScenario (WSTNavigationControllerTests) 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTNumberTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTNumberTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 25/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTNumberTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTParameterProxyTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTParameterProxyTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 05/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTParameterProxyTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTSchemaStyleTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTSchemaStyleTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 30/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTSchemaStyleTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTScreenControllerUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTScreenControllerUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTScreenControllerUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTSearchBarUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTSearchBarUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 16/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTSearchBarUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTSegmentedControlTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTSegmentedControlTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 27/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTSegmentedControlTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTSendMessageActionTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTSendMessageActionTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTSendMessageActionTests) 12 | 13 | 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTSliderTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTSliderTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTSliderTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTStoreValueActionTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTStoreValueActionTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTStoreValueActionTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTStringTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTStringTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 21/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTStringTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTSwitchUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTSwitchUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 03/12/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTSwitchUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTTabControllerTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTTabControllerTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTTabControllerTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTTabControllerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTTabControllerTests.m 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario+WSTTabControllerTests.h" 10 | #import "KIFTestStep+WSTShared.h" 11 | #import "WSTAssert.h" 12 | #import "WSTTestAction.h" 13 | #import "WSTTestContext.h" 14 | 15 | @implementation KIFTestScenario (WSTTabControllerTests) 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTTableControllerUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTTableControllerUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTTableControllerUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTTextFieldUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTTextFieldUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTTextFieldUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTTextViewUnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTTextViewUnitTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 28/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTTextViewUnitTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTToolbarTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTToolbarTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 22/11/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTToolbarTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTViewSharedPropertyTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTViewSharedPropertyTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 31/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTViewSharedPropertyTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestScenario+WSTXMLParserTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestScenario+WSTXMLParserTests.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 30/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestScenario.h" 10 | 11 | @interface KIFTestScenario (WSTXMLParserTests) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/KIFTestStep+WSTShared.h: -------------------------------------------------------------------------------- 1 | // 2 | // KIFTestStep+WSTShared.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 22/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestStep.h" 10 | 11 | @interface KIFTestStep (WSTShared) 12 | 13 | + (KIFTestStep *)stepToSetupWindowWithWorkflow:(NSString *)fileName; 14 | + (KIFTestStep *)stepToExamineWindow:(KIFTestStepResult(^)(UIWindow *window, NSError **outError))block; 15 | 16 | + (KIFTestStep *)stepToSetupMessageWithTarget:(NSString *)type name:(NSString *)name data:(NSDictionary *)data; 17 | 18 | + (KIFTestStep *)stepToWaitForAbsenceOfViewWithAccessibilityLabel:(NSString *)label zeroSizeIsAbsent:(BOOL)zeroSizeIsAbsent; 19 | + (NSArray *)stepsToWaitForViewWithAccessibilityLabel:(NSString *)waitLabel dismissedByTappingViewWithAccessibilityLabel:(NSString *)dismissLabel; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/WSTAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSTAppDelegate.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 22/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WSTAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | - (void)setupWindowWithWorkflowFile:(NSString *)fileName; 15 | 16 | @property (strong, nonatomic) NSDictionary *messageData; // keys are message types; values should also be dictionaries with keys being message names; values should also be dictionaries to be returned as response parameters 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/WSTAssert.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSTAssert.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | // There are some tests that we'd have liked to see as proper unit tests, 9 | // but which rely on the application environment to exist. So instead we 10 | // run them as a step in a KIF scenario. 11 | 12 | /* nested macro to get the value of the macro, not the macro name */ 13 | #define WST_MACRO_VALUE_TO_STRING_( m ) #m 14 | #define WST_MACRO_VALUE_TO_STRING( m ) WST_MACRO_VALUE_TO_STRING_( m ) 15 | 16 | #define WSTFailOnError(E) { if (E) { if (outError) *outError = E; return KIFTestStepResultFailure; } } 17 | #define WSTAssert(X) if (!(X)) { if (outError) *outError = WFSError(@"Assertion failed at line %d: " WST_MACRO_VALUE_TO_STRING(X), __LINE__); return KIFTestStepResultFailure; } 18 | 19 | #define WSTAssertEqualImages(X, Y) WSTAssert( [UIImagePNGRepresentation(X) isEqual:UIImagePNGRepresentation(Y)] ) -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/WSTTestAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSTTestAction.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WSTTestAction : WFSAction 12 | 13 | + (void)clearRecentTestActions; 14 | + (NSArray *)recentTestActions; 15 | + (WSTTestAction *)lastTestAction; 16 | 17 | @property (nonatomic, assign) BOOL shouldFail; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/WSTTestAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // WSTTestAction.m 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 26/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WSTTestAction.h" 10 | 11 | static NSMutableArray *WSTTestActions = nil; 12 | 13 | @implementation WSTTestAction 14 | 15 | + (void)initialize 16 | { 17 | WSTTestActions = [NSMutableArray array]; 18 | } 19 | 20 | + (NSArray *)recentTestActions 21 | { 22 | return WSTTestActions; 23 | } 24 | 25 | + (void)clearRecentTestActions 26 | { 27 | [WSTTestActions removeAllObjects]; 28 | } 29 | 30 | + (WSTTestAction *)lastTestAction 31 | { 32 | return [WSTTestActions lastObject]; 33 | } 34 | 35 | + (NSDictionary *)schemaParameterTypes 36 | { 37 | return [[super schemaParameterTypes] dictionaryByAddingEntriesFromDictionary:@{ @"shouldFail" : @[ [NSString class], [NSNumber class] ] }]; 38 | } 39 | 40 | + (NSArray *)defaultSchemaParameters 41 | { 42 | return [[super defaultSchemaParameters] arrayByPrependingObjectsFromArray:@[ 43 | 44 | @[ [NSString class], @"shouldFail" ], 45 | @[ [NSNumber class], @"shouldFail" ], 46 | 47 | ]]; 48 | } 49 | 50 | - (WFSResult *)performActionForController:(UIViewController *)controller context:(WFSContext *)context 51 | { 52 | [WSTTestActions addObject:self]; 53 | 54 | if (self.shouldFail) return [WFSResult failureResultWithContext:context]; 55 | else return [WFSResult successResultWithContext:context]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/WSTTestContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSTTestContext.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WSTTestContext : WFSMutableContext 12 | 13 | @property (nonatomic, strong) NSArray *errors; 14 | @property (nonatomic, strong) NSArray *messages; 15 | @property (nonatomic, strong) WFSResult *messageResult; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/WSTTestContext.m: -------------------------------------------------------------------------------- 1 | // 2 | // WSTTestContext.m 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 29/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WSTTestContext.h" 10 | 11 | @interface WSTTestContextDelegate : NSObject 12 | 13 | @property (nonatomic, weak) WSTTestContext *testContext; 14 | 15 | @end; 16 | 17 | @implementation WSTTestContextDelegate 18 | 19 | - (void)context:(WFSContext *)contect didReceiveWorkflowError:(NSError *)error 20 | { 21 | self.testContext.errors = [self.testContext.errors arrayByAddingObject:error]; 22 | } 23 | 24 | - (BOOL)context:(WFSContext *)contect didReceiveWorkflowMessage:(WFSMessage *)message 25 | { 26 | self.testContext.messages = [self.testContext.messages arrayByAddingObject:message]; 27 | [message respondWithResult:self.testContext.messageResult]; 28 | return YES; 29 | } 30 | 31 | @end 32 | 33 | @interface WSTTestContext () 34 | 35 | @property (nonatomic, strong) WSTTestContextDelegate *testContextDelegate; 36 | 37 | @end 38 | 39 | @implementation WSTTestContext 40 | 41 | - (id)init 42 | { 43 | WSTTestContextDelegate *testContextDelegate = [[WSTTestContextDelegate alloc] init]; 44 | 45 | self = [super initWithDelegate:testContextDelegate]; 46 | if (self) 47 | { 48 | _messages = [NSArray array]; 49 | _errors = [NSArray array]; 50 | 51 | _testContextDelegate = testContextDelegate; 52 | _testContextDelegate.testContext = self; 53 | 54 | _messageResult = [WFSResult successResultWithContext:self]; 55 | } 56 | return self; 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/WSTTestController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSTTestController.h 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 22/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "KIFTestController.h" 10 | 11 | @interface WSTTestController : KIFTestController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/WSTTestController.m: -------------------------------------------------------------------------------- 1 | // 2 | // WSTTestController.m 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 22/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import "WSTTestController.h" 10 | 11 | @implementation WSTTestController 12 | 13 | - (void)initializeScenarios 14 | { 15 | NSString *prefix = [[[NSProcessInfo processInfo] environment] objectForKey:@"WST_TEST_PREFIX"]; 16 | 17 | if (prefix) 18 | { 19 | [self addAllScenariosWithSelectorPrefix:prefix fromClass:[KIFTestScenario class]]; 20 | } 21 | else 22 | { 23 | [self addAllScenarios]; 24 | } 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Code/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // WorkflowSchemaTests 4 | // 5 | // Created by Simon Booth on 22/10/2012. 6 | // Copyright (c) 2012 CRedit360. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "WSTAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([WSTAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/form_tests_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Form test 5 |
6 | 7 | 8 | 9 | screenTitle 10 | 11 | . 12 | Enter a screen title 13 | 14 | 15 | 16 | 17 | confirmScreenTitle 18 | 19 | 20 | Titles must match 21 | 22 | 23 | 27 | 28 | 29 | 30 | form_tests_2.xml 31 | 32 | 33 | 34 | YES 35 | 36 | 37 | Failed to load screen 2 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 |
46 |
47 |
-------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/form_tests_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | <string keyPath="screenTitle" /> 4 |
5 | 6 | 7 | 8 | Enter an animal 9 | . 10 | 11 | 12 | 13 | Enter a snack 14 | . 15 | 16 | 17 | 18 | 19 | Enter a fruit 20 | . 21 | 22 | 23 | 27 | 28 | 29 | 30 | form_tests_3.xml 31 | 32 | 33 | 34 | Failed to load screen 3 35 | 36 | 37 | All fields must be filled 38 | 39 | form2done 40 | 41 |
42 | form2done 43 |
44 |
-------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/form_tests_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Results 4 | 5 | YES 6 | 7 | 8 | Done 9 | doneButtonTapped 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | form3done 22 | 23 | 24 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/gesture_recognizer_tests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | fill 5 | 32 | 33 | 34 | Long press 35 | 2 taps 36 | 3 taps 37 | 4 taps 38 | Left swipe 39 | Right swipe 40 | 41 | 42 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/load_tests_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Screen 1 5 | 6 | Loading screen 1... 7 | loadScreen 8 | 9 | 10 | load_tests_screen1.xml 11 | 12 | Failed to load screen 1 13 | 14 | 15 | 16 | Screen 2 17 | 18 | Loading screen 2... 19 | loadScreen 20 | 21 | 22 | load_tests_screen2.xml 23 | 24 | Failed to load screen 2 25 | 26 | 27 | 28 | Screen 3 29 | 30 | Loading screen 3... 31 | loadScreen 32 | 33 | 34 | there_is_no_screen3.xml 35 | 36 | Failed to load screen 3 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/load_tests_screen1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Screen 1 title 4 | 5 | center 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/load_tests_screen2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Screen 2 title 4 | 5 | center 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/navigation_stack_tests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Screen 1 title 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | Screen 2 NI title 16 | S2 17 | Screen 2 NI prompt 18 | 19 | 20 | 21 | 25 | 26 | 27 | 28 | Screen 3 title 29 | 30 | Screen 3 NI title 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/stored_value_tests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | This goes at the top 7 | 8 | 9 | 10 | 11 | 12 | Push me! 13 | performNextStep 14 | 15 | 16 | 17 | 31 | 32 | 33 | This goes at the bottom 34 | 35 | 36 | 37 | 38 | 39 | performNextStep 40 | rootDelegate 41 | scenarioFunctionalTestStoredValues 42 | 43 | 44 | 45 | sections 46 | 47 | 48 | 49 | 50 | self 51 | reloadData 52 | 53 | 54 | 55 | 56 | 57 |
58 |
-------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/style_tests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/tab_tests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | center 6 | 7 | 8 | 9 | 10 | Screen 2 title 11 | 12 | center 13 | 14 | 15 | 16 | 17 | 18 | Screen 3 tabItem title 19 | first 20 | 21 | Screen 3 title 22 | 23 | center 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Example XML/updating_views_tests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 13 | 17 | 18 | 19 | 20 | theLabel 21 | text 22 | You pressed button 1. 23 | 24 | 25 | theLabel 26 | text 27 | You pressed button 2. 28 | 29 | 30 | theLabel 31 | text 32 | You pressed button 3. 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '5.0' 2 | xcodeproj "WorkflowSchemaTests.xcodeproj" 3 | 4 | pod 'DTCoreText', '~> 1.0' 5 | pod 'UISS', "~> 1.0" 6 | pod 'MBProgressHUD', '~> 0.5' 7 | 8 | pod do |s| 9 | s.name = 'KIF' 10 | s.version = '0.0.2' 11 | s.license = 'Apache' 12 | s.summary = 'Keep It Functional - iOS Test Framework.' 13 | s.homepage = 'https://github.com/square/KIF' 14 | s.author = { 'Square' => 'https://squareup.com/' } 15 | s.source = { :git => 'https://github.com/percysnoodle/KIF.git', :commit => '1bf5459f6e' } 16 | 17 | s.description = 'KIF, which stands for Keep It Functional, is an iOS integration test framework. It allows for easy automation of iOS apps by leveraging the accessibility attributes that the OS makes available for those with visual disabilities.' 18 | s.platform = :ios 19 | 20 | s.source_files = 'Classes', 'Additions' 21 | s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) RUN_KIF_TESTS=1' } 22 | end 23 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Podfile.lock: -------------------------------------------------------------------------------- 1 | 2 | PODS: 3 | - DTCoreText (1.0.2) 4 | - KIF (0.0.2) 5 | - MBProgressHUD (0.5) 6 | - UISS (1.0.0) 7 | 8 | DEPENDENCIES: 9 | - DTCoreText (~> 1.0) 10 | - KIF (defined in Podfile) 11 | - MBProgressHUD (~> 0.5) 12 | - UISS (~> 1.0) 13 | 14 | SPEC CHECKSUMS: 15 | DTCoreText: 4f2b9d62554c62dd7cd412c9f50ece1e70a548b9 16 | MBProgressHUD: b23ee11c42253d6d804e8e0bfabdc334e8b2571f 17 | UISS: 591b2eec5cbbc13ea1698a2879a3d314dc23e43e 18 | 19 | COCOAPODS: 0.16.0 20 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/Default.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/Default@2x.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/Icon.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/Icon@2x.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | WorkflowSchemaTests 4 | 5 | Created by Simon Booth on 21/11/2012. 6 | Copyright (c) 2012 CRedit360. All rights reserved. 7 | */ 8 | 9 | "key_1" = "value_1"; 10 | "key_2" = "value_2"; -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/Test.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Test.strings 3 | WorkflowSchemaTests 4 | 5 | Created by Simon Booth on 21/11/2012. 6 | Copyright (c) 2012 CRedit360. All rights reserved. 7 | */ 8 | 9 | "key_1" = "test"; 10 | // key_2 not defined 11 | 12 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/button_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/button_bg.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/button_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/button_bg@2x.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/first.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/first.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/first@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/first@2x.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/second.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/second.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/second@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/second@2x.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/text_field_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/text_field_bg.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/text_field_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CRedit360/WorkflowSchema/536f4e9cab9e6e5917f871ae6b14ce63ec73d21e/WorkflowSchemaTests/Resources/text_field_bg@2x.png -------------------------------------------------------------------------------- /WorkflowSchemaTests/Resources/uiss.json: -------------------------------------------------------------------------------- 1 | { 2 | "Variables": { 3 | "tintColor" : "blue", 4 | "backgroundColor" : "white" 5 | }, 6 | 7 | "UINavigationBar" : { 8 | "tintColor" : "$tintColor" 9 | }, 10 | 11 | "WFSScreenView" : { 12 | "backgroundColor" : "$backgroundColor" 13 | }, 14 | 15 | "WFSTextField" : { 16 | "backgroundImage" : [["text_field_bg", 11, 8, 18, 8]], 17 | }, 18 | 19 | "WFSButton" : { 20 | "backgroundImage" : [["button_bg", 11, 4, 12, 4], "normal"], 21 | "contentEdgeInsets" : [[12, 4, 12, 4]], 22 | }, 23 | 24 | "WFSLabel.red" : { 25 | "textAttributes" : { 26 | "font": 24, 27 | "textColor": "red" 28 | } 29 | }, 30 | 31 | "WFSLabel.green" : { 32 | "textAttributes" : { 33 | "font": ["bold", 12], 34 | "textColor": "green" 35 | } 36 | }, 37 | 38 | "WFSLabel.blue" : { 39 | "textAttributes" : { 40 | "font": ["italic", 12], 41 | "textColor": "blue" 42 | } 43 | }, 44 | 45 | "WFSContainerView.inner" : { 46 | "contentEdgeInsets" : [[0, 0, 0, 0]] 47 | }, 48 | 49 | "WFSContainerView.textView" : { 50 | "backgroundImage" : [["text_field_bg", 11, 8, 18, 8]], 51 | "contentEdgeInsets" : [[8, 0, 8, 0]], 52 | "desiredSize" : [[0, 88]] 53 | } 54 | } -------------------------------------------------------------------------------- /WorkflowSchemaTests/WorkflowSchemaTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.credit360.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/WorkflowSchemaTests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'WorkflowSchemaTests' target in the 'WorkflowSchemaTests' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/WorkflowSchemaTests.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/WorkflowSchemaTests.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/WorkflowSchemaTests.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WorkflowSchemaTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | --------------------------------------------------------------------------------