├── README.md ├── Tests ├── FacilaTests │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── FacilaTests-Prefix.pch │ ├── Context │ │ ├── FirstCustomContext.m │ │ ├── SecondCustomContext.m │ │ ├── SecondCustomContext.h │ │ ├── FirstCustomContext.h │ │ └── FacilaContextTests.m │ ├── ActionCallingModule.h │ ├── ActionCallingModule.m │ ├── ActionHandlingModule.h │ ├── FacilaTests-Info.plist │ ├── FacilaTests.m │ ├── ActionHandlingModule.m │ └── Dispatcher │ │ └── FacilaDispatcherTests.m ├── Tests.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── project.pbxproj ├── Podfile └── Podfile.lock ├── Facila.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── Classes ├── Facila-Prefix.pch ├── Facila.h ├── FacilaModule.h ├── FacilaModule.m ├── FacilaModuleProtocol.h ├── FacilaContext.h ├── FacilaActionHandler.h ├── FacilaLayoutProtocol.h ├── FacilaActionHandler.m ├── FacilaContext.m ├── FacilaDispatcher.h └── FacilaDispatcher.m ├── .wikia-dev-enabled-pod ├── .gitignore ├── Facila.xcworkspace └── contents.xcworkspacedata ├── Facila.podspec ├── LICENSE └── Warnings.xcconfig /README.md: -------------------------------------------------------------------------------- 1 | Facila 2 | ====== 3 | 4 | iOS Application Framework 5 | -------------------------------------------------------------------------------- /Tests/FacilaTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Facila.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Classes/Facila-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /Tests/FacilaTests/FacilaTests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import 10 | #endif 11 | -------------------------------------------------------------------------------- /.wikia-dev-enabled-pod: -------------------------------------------------------------------------------- 1 | This file exists for a script to recognize a wikia internal pod. 2 | 3 | Those pods have a few restrictions: 4 | * classes shipped only in the Classes/ directory 5 | * resources shipped only in the Resources/ directory 6 | * Podfile "pod something" command doesn't have leading spaces 7 | -------------------------------------------------------------------------------- /Tests/Podfile: -------------------------------------------------------------------------------- 1 | inhibit_all_warnings! 2 | 3 | xcodeproj 'Tests' 4 | workspace '../Facila' 5 | 6 | def import_facila_pod 7 | pod 'Facila', :path => '../' 8 | end 9 | 10 | target 'FacilaTests' do 11 | platform :ios, '6.0' 12 | import_facila_pod 13 | pod 'XCAsyncTestCase' 14 | end 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | */build/* 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | profile 14 | *.moved-aside 15 | DerivedData 16 | .idea/ 17 | *.hmap 18 | *.xccheckout 19 | 20 | #CocoaPods 21 | Pods 22 | -------------------------------------------------------------------------------- /Tests/FacilaTests/Context/FirstCustomContext.m: -------------------------------------------------------------------------------- 1 | // 2 | // FirstCustomContext 3 | // Tests 4 | // 5 | // Created by Grzegorz Nowicki on 28.04.2014. 6 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 7 | // 8 | 9 | #import "FirstCustomContext.h" 10 | 11 | @implementation FirstCustomContext { 12 | 13 | } 14 | 15 | @end -------------------------------------------------------------------------------- /Tests/FacilaTests/Context/SecondCustomContext.m: -------------------------------------------------------------------------------- 1 | // 2 | // SecondCustomContext 3 | // Tests 4 | // 5 | // Created by Grzegorz Nowicki on 28.04.2014. 6 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 7 | // 8 | 9 | #import "SecondCustomContext.h" 10 | 11 | @implementation SecondCustomContext { 12 | 13 | } 14 | 15 | @end -------------------------------------------------------------------------------- /Tests/FacilaTests/Context/SecondCustomContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondCustomContext 3 | // Tests 4 | // 5 | // Created by Grzegorz Nowicki on 28.04.2014. 6 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Facila.h" 11 | 12 | @interface SecondCustomContext : FacilaContext 13 | @end -------------------------------------------------------------------------------- /Tests/FacilaTests/Context/FirstCustomContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // FirstCustomContext 3 | // Tests 4 | // 5 | // Created by Grzegorz Nowicki on 28.04.2014. 6 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Facila.h" 11 | 12 | 13 | @interface FirstCustomContext : FacilaContext 14 | @end -------------------------------------------------------------------------------- /Tests/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Facila (0.0.4) 3 | - XCAsyncTestCase (0.0.1) 4 | 5 | DEPENDENCIES: 6 | - Facila (from `../`) 7 | - XCAsyncTestCase 8 | 9 | EXTERNAL SOURCES: 10 | Facila: 11 | :path: ../ 12 | 13 | SPEC CHECKSUMS: 14 | Facila: a5f16688f2fe39688336fb7d75bb4078296741c8 15 | XCAsyncTestCase: ba895cb121b4d9fddceccd7c06f46a402241351f 16 | 17 | COCOAPODS: 0.33.1 18 | -------------------------------------------------------------------------------- /Facila.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Tests/FacilaTests/ActionCallingModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // ActionCallingModule 3 | // Tests 4 | // 5 | // Created by Grzegorz Nowicki on 17.01.2014. 6 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | @interface ActionCallingModule : NSObject 14 | @end -------------------------------------------------------------------------------- /Classes/Facila.h: -------------------------------------------------------------------------------- 1 | // 2 | // Facila.h 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki 6 | // Aleksander Balicki 7 | // Copyright (c) 2014 Wikia. All rights reserved. 8 | // 9 | 10 | #import "FacilaLayoutProtocol.h" 11 | #import "FacilaModuleProtocol.h" 12 | #import "FacilaDispatcher.h" 13 | #import "FacilaModule.h" 14 | #import "FacilaContext.h" 15 | 16 | -------------------------------------------------------------------------------- /Classes/FacilaModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaModule 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki 6 | // Aleksander Balicki 7 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 8 | // 9 | 10 | #import 11 | #import "FacilaModuleProtocol.h" 12 | 13 | 14 | @interface FacilaModule : NSObject 15 | @end 16 | -------------------------------------------------------------------------------- /Classes/FacilaModule.m: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaModule 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki 6 | // Aleksander Balicki 7 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 8 | // 9 | 10 | #import "FacilaModule.h" 11 | 12 | 13 | @implementation FacilaModule { 14 | 15 | } 16 | 17 | - (void)registerActions:(FacilaDispatcher *)dispatcher { 18 | 19 | } 20 | 21 | // Returns actions supported by module 22 | - (NSArray *)supportedActions { 23 | return @[]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Tests/FacilaTests/ActionCallingModule.m: -------------------------------------------------------------------------------- 1 | // 2 | // ActionCallingModule 3 | // Tests 4 | // 5 | // Created by Grzegorz Nowicki on 17.01.2014. 6 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ActionCallingModule.h" 11 | 12 | 13 | @implementation ActionCallingModule { 14 | 15 | } 16 | 17 | - (void)registerActions:(FacilaDispatcher *)dispatcher { 18 | [dispatcher registerAction:@"test" withBlock:^(NSDictionary *params, FacilaDispatcher *dispatcher) { 19 | NSLog(@"ACM Test action block"); 20 | }]; 21 | } 22 | 23 | @end -------------------------------------------------------------------------------- /Classes/FacilaModuleProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaModuleProtocol.h 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki 6 | // Aleksander Balicki 7 | // Copyright (c) 2014 Wikia. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @class FacilaDispatcher; 13 | 14 | @protocol FacilaModuleProtocol 15 | @required 16 | - (void)registerActions:(FacilaDispatcher *)dispatcher; 17 | 18 | @optional 19 | // Returns array of supported actions 20 | - (NSArray *)supportedActions; 21 | - (void)handleAction:(NSString *)actionName params:(NSDictionary *)params; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Tests/FacilaTests/ActionHandlingModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // ActionHandlingModule 3 | // Tests 4 | // 5 | // Created by Grzegorz Nowicki on 17.01.2014. 6 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | static NSString *AHMSampleActionName = @"SampleActionName"; 13 | 14 | @interface ActionHandlingModule : NSObject 15 | 16 | @property (nonatomic, assign) NSInteger methodCallsCount; 17 | @property (nonatomic, strong) NSString *actionName; 18 | @property (nonatomic, strong) NSDictionary *params; 19 | 20 | - (void)handleActionParams:(NSDictionary *)params; 21 | 22 | @end -------------------------------------------------------------------------------- /Facila.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "Facila" 3 | s.version = "0.0.4" 4 | s.summary = "Facila is easy to use iOS Application Framework" 5 | s.description = <<-DESC 6 | Facila is easy to use iOS Application Framework. 7 | DESC 8 | 9 | s.homepage = "https://github.com/wikia-gregor/Facila" 10 | s.license = 'MIT' 11 | s.author = { "Grzegorz Nowicki" => "grzegorz@wikia-inc.com" } 12 | s.source = { :git => "https://github.com/wikia-gregor/Facila.git", :tag => s.version.to_s } 13 | 14 | s.requires_arc = true 15 | 16 | s.source_files = 'Classes' 17 | s.public_header_files = 'Classes/**/*.h' 18 | s.platform = :ios, '7.0' 19 | end 20 | -------------------------------------------------------------------------------- /Tests/FacilaTests/FacilaTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.wikia.enterprise.testingapp.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Classes/FacilaContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaContext 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki on 15.04.2014. 6 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FacilaDispatcher; 12 | @protocol FacilaLayoutProtocol; 13 | 14 | @interface FacilaContext : NSObject 15 | 16 | @property (nonatomic, strong) FacilaDispatcher *dispatcher; 17 | @property (nonatomic, strong) UIViewController *layout; 18 | 19 | @property (nonatomic, strong) NSMutableDictionary *strongRegister; 20 | @property (nonatomic, strong) NSMapTable *weakRegister; 21 | 22 | + (instancetype)sharedInstance; 23 | 24 | + (void)setSharedInstance:(FacilaContext *)sharedInstance; 25 | + (void)resetAllInstances; 26 | + (void)resetInstance; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Tests/FacilaTests/FacilaTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaTests.m 3 | // FacilaTests 4 | // 5 | // Created by Gregor on 16.01.2014. 6 | // 7 | // 8 | 9 | #import 10 | #import "FacilaModule.h" 11 | 12 | @interface FacilaTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation FacilaTests 17 | 18 | - (void)setUp 19 | { 20 | [super setUp]; 21 | // Put setup code here. This method is called before the invocation of each test method in the class. 22 | } 23 | 24 | - (void)tearDown 25 | { 26 | // Put teardown code here. This method is called after the invocation of each test method in the class. 27 | [super tearDown]; 28 | } 29 | 30 | - (void)testFacilaModueSampleTest 31 | { 32 | FacilaModule *module = [[FacilaModule alloc] init]; 33 | XCTAssertTrue([module isKindOfClass:[FacilaModule class]], @"Testing FacilaModule Class"); 34 | } 35 | 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Tests/FacilaTests/ActionHandlingModule.m: -------------------------------------------------------------------------------- 1 | // 2 | // ActionHandlingModule 3 | // Tests 4 | // 5 | // Created by Grzegorz Nowicki on 17.01.2014. 6 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ActionHandlingModule.h" 11 | 12 | 13 | @implementation ActionHandlingModule { 14 | 15 | } 16 | 17 | - (id)init { 18 | self = [super init]; 19 | if (self) { 20 | self.methodCallsCount = 0; 21 | } 22 | 23 | return self; 24 | } 25 | 26 | - (void)handleActionParams:(NSDictionary *)params { 27 | self.methodCallsCount++; 28 | self.params = params; 29 | } 30 | 31 | - (void)registerActions:(FacilaDispatcher *)dispatcher { 32 | 33 | // Register sample action 34 | [dispatcher registerAction:AHMSampleActionName withBlock:^(NSDictionary *params, FacilaDispatcher *facilaDispatcher) { 35 | [self handleActionParams:params]; 36 | }]; 37 | 38 | } 39 | 40 | @end -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Grzegorz Nowicki 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // MoreWarnings.xcconfig 3 | // 4 | // Created by Steven Fisher: 5 | // http://tewha.net/2010/11/xcode-warnings/ 6 | // See also: 7 | // http://boredzo.org/blog/archives/2009-11-07/warnings 8 | // 9 | 10 | GCC_WARN_CHECK_SWITCH_STATEMENTS = YES 11 | GCC_WARN_SHADOW = YES 12 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES 13 | CLANG_WARN_ENUM_CONVERSION = YES 14 | CLANG_WARN_INT_CONVERSION = YES 15 | CLANG_WARN_CONSTANT_CONVERSION = YES 16 | GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES 17 | GCC_WARN_ABOUT_RETURN_TYPE = YES 18 | GCC_WARN_MISSING_PARENTHESES = YES 19 | GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES 20 | GCC_WARN_ABOUT_MISSING_NEWLINE = YES 21 | GCC_WARN_SIGN_COMPARE = YES 22 | GCC_WARN_UNDECLARED_SELECTOR = YES 23 | GCC_WARN_UNUSED_FUNCTION = YES 24 | GCC_WARN_UNUSED_LABEL = YES 25 | GCC_WARN_UNUSED_VALUE = YES 26 | GCC_WARN_UNUSED_VARIABLE = YES 27 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES 28 | GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES 29 | GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES 30 | GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES 31 | GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES 32 | GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES 33 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES 34 | CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES 35 | CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES 36 | CLANG_WARN_EMPTY_BODY = YES 37 | CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES 38 | OTHER_CFLAGS = -Wextra -Wno-unused-parameter -Wformat=2 39 | GCC_TREAT_WARNINGS_AS_ERRORS = YES 40 | RUN_CLANG_STATIC_ANALYZER = YES 41 | -------------------------------------------------------------------------------- /Classes/FacilaActionHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaActionHandler 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki 6 | // Aleksander Balicki 7 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @class FacilaDispatcher; 13 | 14 | /** 15 | `FacilaDispatcherActionBlock` Block to handle action 16 | 17 | @param params Dictionary with action params 18 | @param dispatcher Current dispatcher 19 | */ 20 | typedef void (^FacilaDispatcherActionBlock)(NSDictionary *params, FacilaDispatcher *dispatcher); 21 | 22 | /** 23 | `FacilaDispatcherCompletionBlock` Block that will be called after calling action 24 | 25 | @param dispatcher Current dispatcher 26 | */ 27 | typedef void (^FacilaDispatcherCompletionBlock)(FacilaDispatcher *dispatcher); 28 | 29 | 30 | @interface FacilaActionHandler : NSObject 31 | 32 | @property (nonatomic, readonly, strong) NSString *actionName; 33 | 34 | /** Calling properties */ 35 | @property (nonatomic, readonly, strong) FacilaDispatcherActionBlock block; 36 | @property (nonatomic, readonly, assign) dispatch_queue_t queue; 37 | 38 | @property (nonatomic, strong) FacilaDispatcher *dispatcher; 39 | 40 | - (instancetype)initWithActionName:(NSString *)actionName 41 | handlerBlock:(FacilaDispatcherActionBlock) handlerBlock 42 | queue:(dispatch_queue_t)queue; 43 | 44 | - (BOOL)canBeCalled; 45 | 46 | - (void)callWithParams:(NSDictionary *)params; 47 | - (void)callWithParams:(NSDictionary *)params sync:(BOOL)sync; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Classes/FacilaLayoutProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaLayoutProtocol 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki 6 | // Aleksander Balicki 7 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 8 | // 9 | 10 | #import 11 | #import 12 | 13 | @protocol FacilaLayoutProtocol 14 | 15 | @optional 16 | - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated; // Uses a horizontal slide transition. Has no effect if the view controller is already in the stack. 17 | - (UIViewController *)popViewControllerAnimated:(BOOL)animated; // Returns the popped controller. 18 | - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated; // Pops view controllers until the one specified is on top. Returns the popped controllers. 19 | - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated; // Pops until there's only a single view controller left on the stack. Returns the popped controllers. 20 | 21 | /* 22 | Defines the transition style that will be used for this view controller when it is presented modally. Set 23 | this property on the view controller to be presented, not the presenter. Defaults to 24 | UIModalTransitionStyleCoverVertical. 25 | */ 26 | - (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion NS_AVAILABLE_IOS(5_0); 27 | // The completion handler, if provided, will be invoked after the dismissed controller's viewDidDisappear: callback is invoked. 28 | - (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^)(void))completion; 29 | - (UIViewController *)topViewController; 30 | 31 | - (NSArray *)viewControllers; // The current view controller stack. 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Classes/FacilaActionHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaActionHandler 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki 6 | // Aleksander Balicki 7 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 8 | // 9 | 10 | #import "FacilaActionHandler.h" 11 | 12 | 13 | @interface FacilaActionHandler () 14 | 15 | @property (nonatomic, readwrite, strong) NSString *actionName; 16 | 17 | @property (nonatomic, readwrite, strong) FacilaDispatcherActionBlock block; 18 | @property (nonatomic, readwrite, assign) dispatch_queue_t queue; 19 | 20 | 21 | @end 22 | 23 | @implementation FacilaActionHandler { 24 | 25 | } 26 | 27 | - (instancetype)initWithActionName:(NSString *)actionName handlerBlock:(FacilaDispatcherActionBlock)handlerBlock queue:(dispatch_queue_t)queue { 28 | self = [super init]; 29 | if (self) { 30 | self.actionName = actionName; 31 | self.block = handlerBlock; 32 | self.queue = queue; 33 | } 34 | 35 | if (!self.block || !self.actionName) { 36 | return nil; 37 | } 38 | 39 | return self; 40 | } 41 | 42 | - (BOOL)canBeCalled { 43 | 44 | if (!self.dispatcher) { 45 | return NO; 46 | } 47 | 48 | return (self.block != nil); 49 | } 50 | 51 | - (void)callWithParams:(NSDictionary *)params { 52 | [self callWithParams:params sync:NO]; 53 | } 54 | 55 | - (void)callWithParams:(NSDictionary *)params sync:(BOOL)sync { 56 | 57 | if (!self.canBeCalled) { 58 | [NSException raise:@"FacilaInternalInconsistencyException" format:@"Calling a handler to action %@ that can't be called", self.actionName]; 59 | } 60 | 61 | 62 | if (sync) { 63 | [self callSync:params]; 64 | } else { 65 | [self callAsync:params]; 66 | } 67 | } 68 | 69 | - (void)callSync:(NSDictionary *)params { 70 | self.block(params, self.dispatcher); 71 | } 72 | 73 | - (void)callAsync:(NSDictionary *)params { 74 | dispatch_async(self.queue ?: dispatch_get_main_queue(), ^{ 75 | self.block(params, self.dispatcher); 76 | }); 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Classes/FacilaContext.m: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaContext 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki on 15.04.2014. 6 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 7 | // 8 | 9 | #import "FacilaContext.h" 10 | #import "FacilaDispatcher.h" 11 | #import "FacilaLayoutProtocol.h" 12 | 13 | static NSMutableDictionary* _singletons; 14 | 15 | @implementation FacilaContext { 16 | FacilaDispatcher *_dispatcher; 17 | id _layout; 18 | } 19 | 20 | #pragma mark Singleton methods 21 | + (instancetype)singleton { 22 | static dispatch_once_t onceToken; 23 | dispatch_once(&onceToken, ^{ 24 | _singletons = [NSMutableDictionary dictionary]; 25 | }); 26 | 27 | id instance = nil; 28 | @synchronized(self) { 29 | NSString* klass = NSStringFromClass(self); 30 | instance = _singletons[klass]; 31 | if (!instance) { 32 | instance = [self new]; 33 | _singletons[klass] = instance; 34 | } 35 | } 36 | return instance; 37 | } 38 | 39 | + (instancetype)sharedInstance { 40 | return [self singleton]; 41 | } 42 | 43 | + (void)setSharedInstance:(FacilaContext *)sharedInstance { 44 | NSString *klass = NSStringFromClass([sharedInstance class]); 45 | _singletons[klass] = sharedInstance; 46 | } 47 | 48 | + (void)resetAllInstances { 49 | @synchronized (self) { 50 | [_singletons removeAllObjects]; 51 | } 52 | } 53 | 54 | + (void)resetInstance { 55 | @synchronized (self) { 56 | NSString* klass = NSStringFromClass(self); 57 | if (_singletons[klass]) { 58 | [_singletons removeObjectForKey:klass]; 59 | } 60 | } 61 | } 62 | 63 | #pragma mark - Initialization 64 | 65 | - (instancetype)init { 66 | self = [super init]; 67 | 68 | if (self) { 69 | self.strongRegister = [NSMutableDictionary new]; 70 | self.weakRegister = [NSMapTable strongToWeakObjectsMapTable]; 71 | } 72 | 73 | return self; 74 | } 75 | 76 | #pragma mark - 77 | 78 | - (FacilaDispatcher *)dispatcher { 79 | if (_dispatcher == nil && ![[self class] isEqual:[FacilaContext class]]) { 80 | return [FacilaContext sharedInstance].dispatcher; 81 | } 82 | 83 | return _dispatcher; 84 | } 85 | 86 | - (void)setDispatcher:(FacilaDispatcher *)dispatcher { 87 | _dispatcher = dispatcher; 88 | } 89 | 90 | - (id )layout { 91 | if (_layout == nil && ![[self class] isEqual:[FacilaContext class]]) { 92 | return [FacilaContext sharedInstance].layout; 93 | } 94 | 95 | return _layout; 96 | } 97 | 98 | - (void)setLayout:(id )layout { 99 | _layout = layout; 100 | } 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /Tests/FacilaTests/Context/FacilaContextTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaContextTests.m 3 | // Tests 4 | // 5 | // Created by Gregor on 28.04.2014. 6 | // 7 | // 8 | 9 | #import 10 | #import "Facila.h" 11 | #import "FirstCustomContext.h" 12 | #import "SecondCustomContext.h" 13 | 14 | @interface FacilaContextTests : XCTestCase 15 | 16 | @end 17 | 18 | @implementation FacilaContextTests 19 | 20 | - (void)setUp { 21 | [super setUp]; 22 | 23 | [FacilaContext resetAllInstances]; 24 | } 25 | 26 | - (void)tearDown { 27 | [super tearDown]; 28 | 29 | [FacilaContext resetAllInstances]; 30 | } 31 | 32 | - (void)testSingleton 33 | { 34 | XCTAssertEqual([FacilaContext sharedInstance], [FacilaContext sharedInstance]); 35 | XCTAssertNotEqual([FacilaContext sharedInstance], [[FacilaContext alloc] init]); 36 | } 37 | 38 | - (void)testSettingSharedInstance { 39 | FacilaContext *context = [FacilaContext sharedInstance]; 40 | FacilaContext *secondContext = [[FacilaContext alloc] init]; 41 | 42 | XCTAssertNotEqual(context, secondContext); 43 | [FacilaContext setSharedInstance:secondContext]; 44 | 45 | XCTAssertNotEqual(context, [FacilaContext sharedInstance]); 46 | XCTAssertEqual(secondContext, [FacilaContext sharedInstance]); 47 | } 48 | 49 | - (void)testResetingSingletons 50 | { 51 | FacilaContext *context = [FacilaContext sharedInstance]; 52 | [FacilaContext resetInstance]; 53 | FacilaContext *secondContext = [FacilaContext sharedInstance]; 54 | 55 | XCTAssertNotEqual(context, secondContext); 56 | 57 | FirstCustomContext *customContext = [FirstCustomContext sharedInstance]; 58 | [FirstCustomContext resetInstance]; 59 | FirstCustomContext *secondCustomContext = [FirstCustomContext sharedInstance]; 60 | 61 | XCTAssertNotEqual(customContext, secondCustomContext); 62 | 63 | [FacilaContext resetAllInstances]; 64 | XCTAssertNotEqual(secondContext, [FacilaContext sharedInstance]); 65 | XCTAssertNotEqual(secondCustomContext, [FirstCustomContext sharedInstance]); 66 | } 67 | 68 | 69 | - (void)testCustomSingleton 70 | { 71 | FacilaDispatcher *dispatcher = [[FacilaDispatcher alloc] init]; 72 | FacilaContext *facilaContext = [FacilaContext sharedInstance]; 73 | facilaContext.dispatcher = dispatcher; 74 | 75 | FirstCustomContext *firstCustomContext = [FirstCustomContext sharedInstance]; 76 | 77 | XCTAssertNotEqual(facilaContext, firstCustomContext); 78 | XCTAssertEqual(facilaContext.dispatcher, firstCustomContext.dispatcher); 79 | 80 | SecondCustomContext *secondCustomContext = [SecondCustomContext sharedInstance]; 81 | XCTAssertNotEqual(facilaContext, secondCustomContext); 82 | XCTAssertEqual(facilaContext.dispatcher, secondCustomContext.dispatcher); 83 | } 84 | 85 | - (void)testOverridingSuperSingletonParams 86 | { 87 | FacilaDispatcher *dispatcher = [[FacilaDispatcher alloc] init]; 88 | FacilaContext *facilaContext = [FacilaContext sharedInstance]; 89 | facilaContext.dispatcher = dispatcher; 90 | 91 | FirstCustomContext *firstCustomContext = [FirstCustomContext sharedInstance]; 92 | 93 | XCTAssertNotEqual(facilaContext, firstCustomContext); 94 | XCTAssertEqual(facilaContext.dispatcher, firstCustomContext.dispatcher); 95 | 96 | FacilaDispatcher *differentDispatcher = [[FacilaDispatcher alloc] init]; 97 | XCTAssertNotEqual(dispatcher, differentDispatcher); 98 | XCTAssertNotEqual(firstCustomContext.dispatcher, differentDispatcher); 99 | firstCustomContext.dispatcher = differentDispatcher; 100 | 101 | XCTAssertEqual(firstCustomContext.dispatcher, differentDispatcher); 102 | XCTAssertNotEqual(facilaContext.dispatcher, firstCustomContext.dispatcher); 103 | } 104 | 105 | - (void)testWeakRegister 106 | { 107 | FirstCustomContext *testingContext = [[FirstCustomContext alloc] init]; 108 | FacilaContext *facilaContext = [FacilaContext sharedInstance]; 109 | 110 | [facilaContext.weakRegister setObject:testingContext forKey:@"testObject"]; 111 | XCTAssertEqual(testingContext, [facilaContext.weakRegister objectForKey:@"testObject"]); 112 | 113 | testingContext = nil; 114 | XCTAssertNotEqual(testingContext, [facilaContext.weakRegister objectForKey:@"testObject"]); 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /Classes/FacilaDispatcher.h: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaDispatcher 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki 6 | // Aleksander Balicki 7 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 8 | // 9 | 10 | #import 11 | #import "FacilaActionHandler.h" 12 | 13 | @protocol FacilaModuleProtocol; 14 | @class FacilaDispatcher; 15 | @protocol FacilaLayoutProtocol; 16 | 17 | /** 18 | `FacilaDispatcher` handle communication between modules. 19 | */ 20 | @interface FacilaDispatcher : NSObject 21 | 22 | /** Registered modules */ 23 | @property (nonatomic, readonly, strong) NSArray *modules; 24 | 25 | /** Registered actions */ 26 | @property (nonatomic, readonly, strong) NSDictionary *actions; 27 | 28 | /** Default queue to call blocks by dispatcher */ 29 | @property (nonatomic, assign) dispatch_queue_t dispatchQueue; 30 | 31 | /** Layout controller class */ 32 | @property (nonatomic, strong) id layout; 33 | 34 | /** 35 | Initialize Facila with layout handler 36 | @param layout Layout object (ex. UINavigationController) 37 | */ 38 | - (instancetype)initWithLayout:(id )layout; 39 | 40 | /** 41 | Register module 42 | 43 | @param module Module object with FacilaModuleProtocol interface 44 | @returns NO if module is already registered otherwise returns YES 45 | */ 46 | - (BOOL)registerModule:(id )module; 47 | 48 | /** 49 | Register module with particular actions from it 50 | Instead of action names nil can be passed to register module without any action 51 | 52 | @param module Module object with FacilaModuleProtocol interface 53 | @param actionNames Array with action names to register from module 54 | @returns NO if module is already registered otherwise returns YES 55 | */ 56 | - (BOOL)registerModule:(id )module withActions:(NSArray *)actionNames; 57 | 58 | /** 59 | Unregister module 60 | 61 | @param module Module to unregister 62 | @returns YES if module was successfully unregistered 63 | */ 64 | - (BOOL)unregisterModule:(id )module; 65 | 66 | /** 67 | Check if module is registered 68 | 69 | @param module Module with FacilaModuleProtocol interface 70 | @returns YES if module is already registered 71 | */ 72 | - (BOOL)isModuleRegistered:(id )module; 73 | 74 | /** 75 | Register an action that can be called 76 | @see [dispatchQueue] Action Block will be called in `dispatchQueue` 77 | 78 | @param actionName Name of action 79 | @param actionBlock Block handler for action 80 | @returns NO if action is already registered or if block is empty 81 | */ 82 | - (BOOL)registerAction:(NSString *)actionName withBlock:(FacilaDispatcherActionBlock)actionBlock; 83 | 84 | /** 85 | Register an action that can be called 86 | 87 | @param actionName Name of action 88 | @param actionBlock Block handler for action 89 | @param queue Queue to call action block 90 | @returns NO if action is already registered 91 | */ 92 | - (BOOL)registerAction:(NSString *)actionName withBlock:(FacilaDispatcherActionBlock)actionBlock queue:(dispatch_queue_t)queue; 93 | 94 | /** 95 | Unregister action 96 | 97 | @param actionName Name of action 98 | @returns YES if action has been successfully unregistered 99 | */ 100 | - (BOOL)unregisterAction:(NSString *)actionName; 101 | 102 | /** 103 | Check if action is registered 104 | 105 | @param actionName Name of action 106 | @returns YES if action is already register 107 | */ 108 | - (BOOL)isActionRegistered:(NSString *)actionName; 109 | 110 | /** 111 | Call action with params 112 | 113 | @param actionName Name of action to call 114 | @param params Dictionary with named params 115 | */ 116 | - (void)callAction:(NSString *)actionName withParams:(NSDictionary *)params; 117 | 118 | /** 119 | Call action with params possibly synchronously 120 | 121 | @param actionName Name of action to call 122 | @param params Dictionary with named params 123 | @param sync Should dispatch_sync be used instead of dispatch_async 124 | */ 125 | - (void)callAction:(NSString *)actionName withParams:(NSDictionary *)params sync:(BOOL)sync; 126 | 127 | /** 128 | Check if action can be performed 129 | 130 | @returns YES if action is registered 131 | */ 132 | - (BOOL)canDispatchAction:(NSString *)actionName; 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /Tests/FacilaTests/Dispatcher/FacilaDispatcherTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaDispatcherTests.m 3 | // Tests 4 | // 5 | // Created by Gregor on 16.01.2014. 6 | // 7 | // 8 | 9 | #import 10 | #import "FacilaDispatcher.h" 11 | #import "ActionHandlingModule.h" 12 | #import "ActionCallingModule.h" 13 | #import "XCTestCase+AsyncTesting.h" 14 | 15 | @interface FacilaDispatcherTests : XCTestCase 16 | 17 | @property (nonatomic, strong) FacilaDispatcher *dispatcher; 18 | @property (nonatomic, strong) ActionHandlingModule *actionHandlingModule; 19 | @property (nonatomic, strong) ActionCallingModule *actionCallingModule; 20 | 21 | @end 22 | 23 | @implementation FacilaDispatcherTests 24 | 25 | - (void)setUp 26 | { 27 | [super setUp]; 28 | 29 | _dispatcher = [[FacilaDispatcher alloc] init]; 30 | _actionHandlingModule = [[ActionHandlingModule alloc] init]; 31 | _actionCallingModule = [[ActionCallingModule alloc] init]; 32 | } 33 | 34 | - (void)tearDown 35 | { 36 | [super tearDown]; 37 | 38 | _dispatcher = nil; 39 | _actionHandlingModule = nil; 40 | _actionCallingModule = nil; 41 | } 42 | 43 | - (void)testFacilaDispatcherInstance 44 | { 45 | XCTAssertTrue([self.dispatcher isKindOfClass:[FacilaDispatcher class]], @"FacilaDispatcher instance problem."); 46 | } 47 | 48 | - (void)testFacilaDispatcher_RegisterAndUnregisterModule 49 | { 50 | [self registerActionHandlingModule]; 51 | XCTAssertEqual([self.dispatcher.modules count], (NSUInteger)1, @"Modules count is wrong after module registration."); 52 | XCTAssertEqual([self.dispatcher.modules firstObject], self.actionHandlingModule, @"Problem with adding module."); 53 | 54 | [self registerActionCallingModule]; 55 | XCTAssertEqual([self.dispatcher.modules count], (NSUInteger)2); 56 | XCTAssertEqual([self.dispatcher.modules lastObject], self.actionCallingModule); 57 | 58 | BOOL moduleUnregistrationSuccess = [self.dispatcher unregisterModule:self.actionHandlingModule]; 59 | BOOL secondModuleUnregisterSuccess = [self.dispatcher unregisterModule:self.actionCallingModule]; 60 | XCTAssertTrue(moduleUnregistrationSuccess); 61 | XCTAssertTrue(secondModuleUnregisterSuccess); 62 | XCTAssertEqual([self.dispatcher.modules count], (NSUInteger)0, @"Modules count is wrong after module unregistration."); 63 | XCTAssertFalse([self.dispatcher isModuleRegistered:self.actionHandlingModule]); 64 | XCTAssertFalse([self.dispatcher isModuleRegistered:self.actionCallingModule]); 65 | } 66 | 67 | - (void)testFacilaDispatcher_ActionRegistrationAndUnregistration 68 | { 69 | 70 | NSString *rawActionName = @"rawAction"; 71 | NSDictionary *testParams = @{ 72 | @"first": @1, 73 | @"second": @2 74 | }; 75 | 76 | BOOL actionRegistration = [self.dispatcher registerAction:rawActionName withBlock:^(NSDictionary *params, FacilaDispatcher *dispatcher) { 77 | XCTAssertEqual(self.dispatcher, dispatcher); 78 | XCTAssertEqual(testParams, params); 79 | }]; 80 | 81 | XCTAssertTrue(actionRegistration); 82 | [self.dispatcher callAction:rawActionName withParams:testParams completion:^(FacilaDispatcher *dispatcher) { 83 | XCTAssertEqual(self.dispatcher, dispatcher); 84 | }]; 85 | 86 | [self waitForTimeout:1]; 87 | } 88 | 89 | 90 | - (void)testFacilaDispatcher_ActionCalling 91 | { 92 | [self registerActionHandlingModule]; 93 | 94 | NSDictionary *testingParams = @{ 95 | @"param1": @1, 96 | @"param2": @2 97 | }; 98 | 99 | [self.dispatcher callAction:AHMSampleActionName withParams:testingParams]; 100 | [self waitForTimeout:1]; 101 | 102 | XCTAssertEqual(self.actionHandlingModule.methodCallsCount, 1); 103 | XCTAssertEqual(self.actionHandlingModule.params, testingParams); 104 | 105 | FacilaDispatcherCompletionBlock completionBlock = ^(FacilaDispatcher *dispatcher) { 106 | XCTAssertEqual(self.dispatcher, dispatcher); 107 | }; 108 | 109 | [self.dispatcher callAction:AHMSampleActionName withParams:testingParams completion:completionBlock]; 110 | [self.dispatcher callAction:AHMSampleActionName withParams:testingParams completion:completionBlock queue:dispatch_get_main_queue()]; 111 | [self waitForTimeout:1]; 112 | XCTAssertEqual(self.actionHandlingModule.methodCallsCount, 3); 113 | } 114 | 115 | #pragma mark ------ Helper Methods ------- 116 | 117 | - (void)registerActionHandlingModule 118 | { 119 | BOOL moduleRegistrationSuccess = [self.dispatcher registerModule:self.actionHandlingModule]; 120 | XCTAssertTrue(moduleRegistrationSuccess); 121 | XCTAssertTrue([self.dispatcher isModuleRegistered:self.actionHandlingModule], @"Is module register dosent work!"); 122 | XCTAssertTrue([self.dispatcher isActionRegistered:AHMSampleActionName]); 123 | XCTAssertTrue([self.dispatcher canDispatchAction:AHMSampleActionName]); 124 | 125 | } 126 | 127 | - (void)registerActionCallingModule 128 | { 129 | BOOL moduleRegistrationSuccess = [self.dispatcher registerModule:self.actionCallingModule]; 130 | XCTAssertTrue(moduleRegistrationSuccess); 131 | XCTAssertTrue([self.dispatcher isModuleRegistered:self.actionCallingModule]); 132 | } 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /Classes/FacilaDispatcher.m: -------------------------------------------------------------------------------- 1 | // 2 | // FacilaDispatcher 3 | // Facila 4 | // 5 | // Created by Grzegorz Nowicki 6 | // Aleksander Balicki 7 | // Copyright (c) 2014 Wikia Sp. z o.o. All rights reserved. 8 | // 9 | 10 | #import "FacilaDispatcher.h" 11 | #import "FacilaModuleProtocol.h" 12 | #import "FacilaLayoutProtocol.h" 13 | 14 | @interface FacilaDispatcher() 15 | 16 | /** Registered modules */ 17 | @property (nonatomic, strong) NSArray *modules; 18 | 19 | /** Registered actions */ 20 | @property (nonatomic, strong) NSDictionary *actions; 21 | 22 | @end 23 | 24 | 25 | @implementation FacilaDispatcher { 26 | 27 | } 28 | 29 | #pragma mark Initialization 30 | 31 | - (instancetype)init { 32 | self = [super init]; 33 | if (self) { 34 | 35 | } 36 | 37 | return self; 38 | } 39 | 40 | #pragma mark Public API 41 | 42 | - (instancetype)initWithLayout:(id )layout { 43 | self = [super init]; 44 | if (self) { 45 | _layout = layout; 46 | } 47 | 48 | return self; 49 | } 50 | 51 | - (BOOL)registerModule:(id )module { 52 | if (![self isModuleRegistered:module]) { 53 | [self addModule:module]; 54 | [module registerActions:self]; 55 | return YES; 56 | } 57 | 58 | return NO; 59 | } 60 | 61 | - (BOOL)registerModule:(id )module withActions:(NSArray *)actionNames { 62 | return NO; 63 | } 64 | 65 | - (BOOL)unregisterModule:(id )module { 66 | if ([self isModuleRegistered:module]) { 67 | [self removeModule:module]; 68 | return YES; 69 | } 70 | 71 | return NO; 72 | } 73 | 74 | - (BOOL)isModuleRegistered:(id )module { 75 | return [self.modules containsObject:module]; 76 | } 77 | 78 | - (BOOL)registerAction:(NSString *)actionName withBlock:(FacilaDispatcherActionBlock)actionBlock { 79 | if (![self isActionRegistered:actionName] && actionBlock != nil) { 80 | [self addAction:actionName handler:[[FacilaActionHandler alloc] initWithActionName:actionName handlerBlock:actionBlock queue:self.dispatchQueue]]; 81 | return YES; 82 | } 83 | 84 | return NO; 85 | } 86 | 87 | - (BOOL)registerAction:(NSString *)actionName withBlock:(FacilaDispatcherActionBlock)actionBlock queue:(dispatch_queue_t)queue { 88 | if (![self isActionRegistered:actionName]) { 89 | [self addAction:actionName handler:[[FacilaActionHandler alloc] initWithActionName:actionName handlerBlock:actionBlock queue:queue]]; 90 | return YES; 91 | } 92 | return NO; 93 | } 94 | 95 | 96 | - (BOOL)unregisterAction:(NSString *)actionName { 97 | if ([self isActionRegistered:actionName]) { 98 | [self removeAction:actionName]; 99 | return YES; 100 | } 101 | 102 | return NO; 103 | } 104 | 105 | - (BOOL)isActionRegistered:(NSString *)actionName { 106 | return [self.actions objectForKey:actionName] != nil; 107 | } 108 | 109 | - (void)callAction:(NSString *)actionName withParams:(NSDictionary *)params { 110 | [self callAction:actionName withParams:params sync:NO]; 111 | } 112 | 113 | - (void)callAction:(NSString *)actionName withParams:(NSDictionary *)params sync:(BOOL)sync { 114 | 115 | FacilaActionHandler *actionHandler = self.actions[actionName]; 116 | 117 | actionHandler.dispatcher = self; 118 | 119 | if (!actionHandler || !actionHandler.canBeCalled) { 120 | [[[UIAlertView alloc] initWithTitle:@"Facila action not found" message:[NSString stringWithFormat:@"action: %@ params: %@", actionName, params] 121 | delegate:nil 122 | cancelButtonTitle:@"OK" 123 | otherButtonTitles:nil] show]; 124 | } 125 | 126 | [actionHandler callWithParams:params sync:sync]; 127 | } 128 | 129 | 130 | - (BOOL)canDispatchAction:(NSString *)actionName { 131 | // TODO: rethink purpose of that method 132 | return [self isActionRegistered:actionName]; 133 | } 134 | 135 | - (dispatch_queue_t)dispatchQueue { 136 | if (!_dispatchQueue) { 137 | _dispatchQueue = dispatch_get_main_queue(); 138 | } 139 | 140 | return _dispatchQueue; 141 | } 142 | 143 | #pragma mark --- Private methods --- 144 | 145 | 146 | #pragma mark Modules 147 | 148 | - (void)addModule:(id )module { 149 | self.modules = [[[NSMutableArray alloc] initWithArray:self.modules] arrayByAddingObject:module]; 150 | } 151 | 152 | - (void)removeModule:(id )module { 153 | NSMutableArray *modules = [NSMutableArray arrayWithArray:self.modules]; 154 | [modules removeObject:module]; 155 | self.modules = [NSArray arrayWithArray:modules]; 156 | } 157 | 158 | - (void)registerActions:(id )module withNames:(NSArray *)names { 159 | 160 | } 161 | 162 | #pragma mark Actions 163 | 164 | - (void)addAction:(NSString *)actionName handler:(FacilaActionHandler *)handler { 165 | NSMutableDictionary *newActions = [NSMutableDictionary dictionaryWithDictionary:self.actions]; 166 | [newActions setObject:handler forKey:actionName]; 167 | self.actions = [NSDictionary dictionaryWithDictionary:newActions]; 168 | } 169 | 170 | - (void)removeAction:(NSString *)actionName { 171 | NSMutableDictionary *newActions = [NSMutableDictionary dictionaryWithDictionary:self.actions]; 172 | [newActions removeObjectForKey:actionName]; 173 | self.actions = [NSDictionary dictionaryWithDictionary:newActions]; 174 | } 175 | 176 | @end 177 | -------------------------------------------------------------------------------- /Facila.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3BA684C518884523004E2B45 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BA684C418884523004E2B45 /* Foundation.framework */; }; 11 | 6BE4659FE4A2D55AFF954E64 /* FacilaModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BE468689F5B7F710CEF1BE9 /* FacilaModule.m */; }; 12 | 6BE466E47062850BE9ED94A1 /* FacilaContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BE460ABAE50FBC64BA01EDA /* FacilaContext.m */; }; 13 | 6BE46AC00DAD928944D950AC /* FacilaDispatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BE4649086D627717D081DFE /* FacilaDispatcher.m */; }; 14 | 6BE46E59C57F3D3E1FBADC9D /* FacilaActionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BE46DB2BC54CDDF69A51E7A /* FacilaActionHandler.m */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXCopyFilesBuildPhase section */ 18 | 3BA684BF18884523004E2B45 /* CopyFiles */ = { 19 | isa = PBXCopyFilesBuildPhase; 20 | buildActionMask = 2147483647; 21 | dstPath = "include/$(PRODUCT_NAME)"; 22 | dstSubfolderSpec = 16; 23 | files = ( 24 | ); 25 | runOnlyForDeploymentPostprocessing = 0; 26 | }; 27 | /* End PBXCopyFilesBuildPhase section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 3BA684C118884523004E2B45 /* libFacila.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFacila.a; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 3BA684C418884523004E2B45 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 32 | 3BA684D518884523004E2B45 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 33 | 3BA6853018884745004E2B45 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 34 | 5B705CA9190BCA6A008E9522 /* Warnings.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 35 | 6BE460ABAE50FBC64BA01EDA /* FacilaContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FacilaContext.m; sourceTree = ""; }; 36 | 6BE460F29A3D9E9197451996 /* FacilaLayoutProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacilaLayoutProtocol.h; sourceTree = ""; }; 37 | 6BE46314A09911A883D565D3 /* FacilaModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacilaModule.h; sourceTree = ""; }; 38 | 6BE4649086D627717D081DFE /* FacilaDispatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FacilaDispatcher.m; sourceTree = ""; }; 39 | 6BE46618F2552B2F126546C5 /* Facila-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Facila-Prefix.pch"; sourceTree = ""; }; 40 | 6BE46700C18FD05D99CB42BC /* FacilaContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacilaContext.h; sourceTree = ""; }; 41 | 6BE468689F5B7F710CEF1BE9 /* FacilaModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FacilaModule.m; sourceTree = ""; }; 42 | 6BE468BD7D2D8059969F42E5 /* FacilaActionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacilaActionHandler.h; sourceTree = ""; }; 43 | 6BE46AEAF8B62F60BD5D2023 /* Facila.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Facila.h; sourceTree = ""; }; 44 | 6BE46C7EB985F3A6D6805AF2 /* FacilaModuleProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacilaModuleProtocol.h; sourceTree = ""; }; 45 | 6BE46DB2BC54CDDF69A51E7A /* FacilaActionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FacilaActionHandler.m; sourceTree = ""; }; 46 | 6BE46EDC4EC2EC11F397D861 /* FacilaDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacilaDispatcher.h; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 3BA684BE18884523004E2B45 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | 3BA684C518884523004E2B45 /* Foundation.framework in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 3BA684B818884523004E2B45 = { 62 | isa = PBXGroup; 63 | children = ( 64 | 5B705CA9190BCA6A008E9522 /* Warnings.xcconfig */, 65 | 3BA684C318884523004E2B45 /* Frameworks */, 66 | 3BA684C218884523004E2B45 /* Products */, 67 | 6BE46E4A6ED215E66EBADD26 /* Classes */, 68 | ); 69 | sourceTree = ""; 70 | }; 71 | 3BA684C218884523004E2B45 /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 3BA684C118884523004E2B45 /* libFacila.a */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 3BA684C318884523004E2B45 /* Frameworks */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 3BA684C418884523004E2B45 /* Foundation.framework */, 83 | 3BA684D518884523004E2B45 /* UIKit.framework */, 84 | 3BA6853018884745004E2B45 /* XCTest.framework */, 85 | ); 86 | name = Frameworks; 87 | sourceTree = ""; 88 | }; 89 | 6BE46E4A6ED215E66EBADD26 /* Classes */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 6BE46AEAF8B62F60BD5D2023 /* Facila.h */, 93 | 6BE46314A09911A883D565D3 /* FacilaModule.h */, 94 | 6BE468689F5B7F710CEF1BE9 /* FacilaModule.m */, 95 | 6BE46618F2552B2F126546C5 /* Facila-Prefix.pch */, 96 | 6BE46EDC4EC2EC11F397D861 /* FacilaDispatcher.h */, 97 | 6BE4649086D627717D081DFE /* FacilaDispatcher.m */, 98 | 6BE468BD7D2D8059969F42E5 /* FacilaActionHandler.h */, 99 | 6BE46DB2BC54CDDF69A51E7A /* FacilaActionHandler.m */, 100 | 6BE460F29A3D9E9197451996 /* FacilaLayoutProtocol.h */, 101 | 6BE46C7EB985F3A6D6805AF2 /* FacilaModuleProtocol.h */, 102 | 6BE460ABAE50FBC64BA01EDA /* FacilaContext.m */, 103 | 6BE46700C18FD05D99CB42BC /* FacilaContext.h */, 104 | ); 105 | path = Classes; 106 | sourceTree = ""; 107 | }; 108 | /* End PBXGroup section */ 109 | 110 | /* Begin PBXNativeTarget section */ 111 | 3BA684C018884523004E2B45 /* Facila */ = { 112 | isa = PBXNativeTarget; 113 | buildConfigurationList = 3BA684E418884523004E2B45 /* Build configuration list for PBXNativeTarget "Facila" */; 114 | buildPhases = ( 115 | 3BA684BD18884523004E2B45 /* Sources */, 116 | 3BA684BE18884523004E2B45 /* Frameworks */, 117 | 3BA684BF18884523004E2B45 /* CopyFiles */, 118 | ); 119 | buildRules = ( 120 | ); 121 | dependencies = ( 122 | ); 123 | name = Facila; 124 | productName = Facila; 125 | productReference = 3BA684C118884523004E2B45 /* libFacila.a */; 126 | productType = "com.apple.product-type.library.static"; 127 | }; 128 | /* End PBXNativeTarget section */ 129 | 130 | /* Begin PBXProject section */ 131 | 3BA684B918884523004E2B45 /* Project object */ = { 132 | isa = PBXProject; 133 | attributes = { 134 | LastUpgradeCheck = 0510; 135 | ORGANIZATIONNAME = Wikia; 136 | }; 137 | buildConfigurationList = 3BA684BC18884523004E2B45 /* Build configuration list for PBXProject "Facila" */; 138 | compatibilityVersion = "Xcode 3.2"; 139 | developmentRegion = English; 140 | hasScannedForEncodings = 0; 141 | knownRegions = ( 142 | en, 143 | ); 144 | mainGroup = 3BA684B818884523004E2B45; 145 | productRefGroup = 3BA684C218884523004E2B45 /* Products */; 146 | projectDirPath = ""; 147 | projectRoot = ""; 148 | targets = ( 149 | 3BA684C018884523004E2B45 /* Facila */, 150 | ); 151 | }; 152 | /* End PBXProject section */ 153 | 154 | /* Begin PBXSourcesBuildPhase section */ 155 | 3BA684BD18884523004E2B45 /* Sources */ = { 156 | isa = PBXSourcesBuildPhase; 157 | buildActionMask = 2147483647; 158 | files = ( 159 | 6BE4659FE4A2D55AFF954E64 /* FacilaModule.m in Sources */, 160 | 6BE46AC00DAD928944D950AC /* FacilaDispatcher.m in Sources */, 161 | 6BE46E59C57F3D3E1FBADC9D /* FacilaActionHandler.m in Sources */, 162 | 6BE466E47062850BE9ED94A1 /* FacilaContext.m in Sources */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXSourcesBuildPhase section */ 167 | 168 | /* Begin XCBuildConfiguration section */ 169 | 3BA684E218884523004E2B45 /* Debug */ = { 170 | isa = XCBuildConfiguration; 171 | baseConfigurationReference = 5B705CA9190BCA6A008E9522 /* Warnings.xcconfig */; 172 | buildSettings = { 173 | ALWAYS_SEARCH_USER_PATHS = NO; 174 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 175 | CLANG_CXX_LIBRARY = "libc++"; 176 | CLANG_ENABLE_MODULES = YES; 177 | CLANG_ENABLE_OBJC_ARC = YES; 178 | CLANG_WARN_BOOL_CONVERSION = YES; 179 | CLANG_WARN_CONSTANT_CONVERSION = YES; 180 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 181 | CLANG_WARN_EMPTY_BODY = YES; 182 | CLANG_WARN_ENUM_CONVERSION = YES; 183 | CLANG_WARN_INT_CONVERSION = YES; 184 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 185 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 186 | COPY_PHASE_STRIP = NO; 187 | GCC_C_LANGUAGE_STANDARD = gnu99; 188 | GCC_DYNAMIC_NO_PIC = NO; 189 | GCC_OPTIMIZATION_LEVEL = 0; 190 | GCC_PREPROCESSOR_DEFINITIONS = ( 191 | "DEBUG=1", 192 | "$(inherited)", 193 | ); 194 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 195 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 196 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 197 | GCC_WARN_UNDECLARED_SELECTOR = YES; 198 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 199 | GCC_WARN_UNUSED_FUNCTION = YES; 200 | GCC_WARN_UNUSED_VARIABLE = YES; 201 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 202 | ONLY_ACTIVE_ARCH = YES; 203 | SDKROOT = iphoneos; 204 | }; 205 | name = Debug; 206 | }; 207 | 3BA684E318884523004E2B45 /* Release */ = { 208 | isa = XCBuildConfiguration; 209 | baseConfigurationReference = 5B705CA9190BCA6A008E9522 /* Warnings.xcconfig */; 210 | buildSettings = { 211 | ALWAYS_SEARCH_USER_PATHS = NO; 212 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 213 | CLANG_CXX_LIBRARY = "libc++"; 214 | CLANG_ENABLE_MODULES = YES; 215 | CLANG_ENABLE_OBJC_ARC = YES; 216 | CLANG_WARN_BOOL_CONVERSION = YES; 217 | CLANG_WARN_CONSTANT_CONVERSION = YES; 218 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 219 | CLANG_WARN_EMPTY_BODY = YES; 220 | CLANG_WARN_ENUM_CONVERSION = YES; 221 | CLANG_WARN_INT_CONVERSION = YES; 222 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 223 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 224 | COPY_PHASE_STRIP = YES; 225 | ENABLE_NS_ASSERTIONS = NO; 226 | GCC_C_LANGUAGE_STANDARD = gnu99; 227 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 228 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 229 | GCC_WARN_UNDECLARED_SELECTOR = YES; 230 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 231 | GCC_WARN_UNUSED_FUNCTION = YES; 232 | GCC_WARN_UNUSED_VARIABLE = YES; 233 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 234 | SDKROOT = iphoneos; 235 | VALIDATE_PRODUCT = YES; 236 | }; 237 | name = Release; 238 | }; 239 | 3BA684E518884523004E2B45 /* Debug */ = { 240 | isa = XCBuildConfiguration; 241 | baseConfigurationReference = 5B705CA9190BCA6A008E9522 /* Warnings.xcconfig */; 242 | buildSettings = { 243 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 244 | DSTROOT = /tmp/Facila.dst; 245 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 246 | GCC_PREFIX_HEADER = "Classes/Facila-Prefix.pch"; 247 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 248 | OTHER_LDFLAGS = "-ObjC"; 249 | PRODUCT_NAME = "$(TARGET_NAME)"; 250 | SKIP_INSTALL = YES; 251 | }; 252 | name = Debug; 253 | }; 254 | 3BA684E618884523004E2B45 /* Release */ = { 255 | isa = XCBuildConfiguration; 256 | baseConfigurationReference = 5B705CA9190BCA6A008E9522 /* Warnings.xcconfig */; 257 | buildSettings = { 258 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 259 | DSTROOT = /tmp/Facila.dst; 260 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 261 | GCC_PREFIX_HEADER = "Classes/Facila-Prefix.pch"; 262 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 263 | OTHER_LDFLAGS = "-ObjC"; 264 | PRODUCT_NAME = "$(TARGET_NAME)"; 265 | SKIP_INSTALL = YES; 266 | }; 267 | name = Release; 268 | }; 269 | /* End XCBuildConfiguration section */ 270 | 271 | /* Begin XCConfigurationList section */ 272 | 3BA684BC18884523004E2B45 /* Build configuration list for PBXProject "Facila" */ = { 273 | isa = XCConfigurationList; 274 | buildConfigurations = ( 275 | 3BA684E218884523004E2B45 /* Debug */, 276 | 3BA684E318884523004E2B45 /* Release */, 277 | ); 278 | defaultConfigurationIsVisible = 0; 279 | defaultConfigurationName = Release; 280 | }; 281 | 3BA684E418884523004E2B45 /* Build configuration list for PBXNativeTarget "Facila" */ = { 282 | isa = XCConfigurationList; 283 | buildConfigurations = ( 284 | 3BA684E518884523004E2B45 /* Debug */, 285 | 3BA684E618884523004E2B45 /* Release */, 286 | ); 287 | defaultConfigurationIsVisible = 0; 288 | defaultConfigurationName = Release; 289 | }; 290 | /* End XCConfigurationList section */ 291 | }; 292 | rootObject = 3BA684B918884523004E2B45 /* Project object */; 293 | } 294 | -------------------------------------------------------------------------------- /Tests/Tests.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3502A9BDB8C04722B98EDC3B /* libPods-FacilaTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 483DE46A07A74B18BF32C03F /* libPods-FacilaTests.a */; }; 11 | 3B21EE9F190EB0B90094F01B /* FacilaContextTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B21EE9E190EB0B90094F01B /* FacilaContextTests.m */; }; 12 | 3BA6856218886057004E2B45 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BA6854918884875004E2B45 /* XCTest.framework */; }; 13 | 3BA6856318886057004E2B45 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BA6854B18884875004E2B45 /* Foundation.framework */; }; 14 | 3BA6856418886057004E2B45 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BA6854D18884875004E2B45 /* UIKit.framework */; }; 15 | 3BA6856A18886058004E2B45 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3BA6856818886058004E2B45 /* InfoPlist.strings */; }; 16 | 3BA6856C18886058004E2B45 /* FacilaTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BA6856B18886058004E2B45 /* FacilaTests.m */; }; 17 | 6BE4654E14F7DD93FFFB1D29 /* FirstCustomContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BE46890A9C7DB1B01648957 /* FirstCustomContext.m */; }; 18 | 6BE46686576D03F51D7A2C0A /* FacilaDispatcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BE46982D59070E34C41AB4D /* FacilaDispatcherTests.m */; }; 19 | 6BE46A7E809B1149CB2643BF /* ActionHandlingModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BE460187E0A76EC209B19B0 /* ActionHandlingModule.m */; }; 20 | 6BE46BA3BCD2BD97CBED6AB1 /* SecondCustomContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BE463042F19E345C6A48524 /* SecondCustomContext.m */; }; 21 | 6BE46E1B75E1FE03D8A370D8 /* ActionCallingModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BE4662878A7E80930A1DFD0 /* ActionCallingModule.m */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 3B21EE9E190EB0B90094F01B /* FacilaContextTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FacilaContextTests.m; sourceTree = ""; }; 26 | 3BA6854918884875004E2B45 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 27 | 3BA6854B18884875004E2B45 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 28 | 3BA6854D18884875004E2B45 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 29 | 3BA6855B1888492F004E2B45 /* libFacila.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libFacila.a; path = "../Facila/build/Debug-iphoneos/libFacila.a"; sourceTree = ""; }; 30 | 3BA6856118886057004E2B45 /* FacilaTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FacilaTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 3BA6856718886057004E2B45 /* FacilaTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FacilaTests-Info.plist"; sourceTree = ""; }; 32 | 3BA6856918886058004E2B45 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 33 | 3BA6856B18886058004E2B45 /* FacilaTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FacilaTests.m; sourceTree = ""; }; 34 | 3BA6856D18886058004E2B45 /* FacilaTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FacilaTests-Prefix.pch"; sourceTree = ""; }; 35 | 483DE46A07A74B18BF32C03F /* libPods-FacilaTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FacilaTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 6BE460187E0A76EC209B19B0 /* ActionHandlingModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ActionHandlingModule.m; sourceTree = ""; }; 37 | 6BE460870C936B04B664D453 /* FirstCustomContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FirstCustomContext.h; sourceTree = ""; }; 38 | 6BE463042F19E345C6A48524 /* SecondCustomContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondCustomContext.m; sourceTree = ""; }; 39 | 6BE465E0CBD10E622D539A74 /* SecondCustomContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecondCustomContext.h; sourceTree = ""; }; 40 | 6BE4662878A7E80930A1DFD0 /* ActionCallingModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ActionCallingModule.m; sourceTree = ""; }; 41 | 6BE46890A9C7DB1B01648957 /* FirstCustomContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FirstCustomContext.m; sourceTree = ""; }; 42 | 6BE46982D59070E34C41AB4D /* FacilaDispatcherTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FacilaDispatcherTests.m; sourceTree = ""; }; 43 | 6BE46AE18BFEBE464133F14A /* ActionCallingModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionCallingModule.h; sourceTree = ""; }; 44 | 6BE46DE023A048A70DEAB4EC /* ActionHandlingModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionHandlingModule.h; sourceTree = ""; }; 45 | F4653BC1E17D4FB4989FD81C /* Pods-FacilaTests.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FacilaTests.xcconfig"; path = "Pods/Pods-FacilaTests.xcconfig"; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | 3BA6855E18886057004E2B45 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | 3BA6856218886057004E2B45 /* XCTest.framework in Frameworks */, 54 | 3BA6856418886057004E2B45 /* UIKit.framework in Frameworks */, 55 | 3BA6856318886057004E2B45 /* Foundation.framework in Frameworks */, 56 | 3502A9BDB8C04722B98EDC3B /* libPods-FacilaTests.a in Frameworks */, 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | 3BA684B118884250004E2B45 = { 64 | isa = PBXGroup; 65 | children = ( 66 | 3BA6856518886057004E2B45 /* FacilaTests */, 67 | 3BA6854818884875004E2B45 /* Frameworks */, 68 | 3BA6854718884875004E2B45 /* Products */, 69 | F4653BC1E17D4FB4989FD81C /* Pods-FacilaTests.xcconfig */, 70 | ); 71 | sourceTree = ""; 72 | }; 73 | 3BA6854718884875004E2B45 /* Products */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 3BA6856118886057004E2B45 /* FacilaTests.xctest */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | 3BA6854818884875004E2B45 /* Frameworks */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 3BA6855B1888492F004E2B45 /* libFacila.a */, 85 | 3BA6854918884875004E2B45 /* XCTest.framework */, 86 | 3BA6854B18884875004E2B45 /* Foundation.framework */, 87 | 3BA6854D18884875004E2B45 /* UIKit.framework */, 88 | 483DE46A07A74B18BF32C03F /* libPods-FacilaTests.a */, 89 | ); 90 | name = Frameworks; 91 | sourceTree = ""; 92 | }; 93 | 3BA6856518886057004E2B45 /* FacilaTests */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 3BA6856618886057004E2B45 /* Supporting Files */, 97 | 3BA6856B18886058004E2B45 /* FacilaTests.m */, 98 | 6BE464ED678DA64C45B73CD3 /* Dispatcher */, 99 | 6BE460187E0A76EC209B19B0 /* ActionHandlingModule.m */, 100 | 6BE46DE023A048A70DEAB4EC /* ActionHandlingModule.h */, 101 | 6BE4662878A7E80930A1DFD0 /* ActionCallingModule.m */, 102 | 6BE46AE18BFEBE464133F14A /* ActionCallingModule.h */, 103 | 6BE466C3282C1DCCD7BC8349 /* Context */, 104 | ); 105 | path = FacilaTests; 106 | sourceTree = ""; 107 | }; 108 | 3BA6856618886057004E2B45 /* Supporting Files */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 3BA6856718886057004E2B45 /* FacilaTests-Info.plist */, 112 | 3BA6856818886058004E2B45 /* InfoPlist.strings */, 113 | 3BA6856D18886058004E2B45 /* FacilaTests-Prefix.pch */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | 6BE464ED678DA64C45B73CD3 /* Dispatcher */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 6BE46982D59070E34C41AB4D /* FacilaDispatcherTests.m */, 122 | ); 123 | path = Dispatcher; 124 | sourceTree = ""; 125 | }; 126 | 6BE466C3282C1DCCD7BC8349 /* Context */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 3B21EE9E190EB0B90094F01B /* FacilaContextTests.m */, 130 | 6BE46890A9C7DB1B01648957 /* FirstCustomContext.m */, 131 | 6BE460870C936B04B664D453 /* FirstCustomContext.h */, 132 | 6BE463042F19E345C6A48524 /* SecondCustomContext.m */, 133 | 6BE465E0CBD10E622D539A74 /* SecondCustomContext.h */, 134 | ); 135 | path = Context; 136 | sourceTree = ""; 137 | }; 138 | /* End PBXGroup section */ 139 | 140 | /* Begin PBXNativeTarget section */ 141 | 3BA6856018886057004E2B45 /* FacilaTests */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = 3BA6856E18886058004E2B45 /* Build configuration list for PBXNativeTarget "FacilaTests" */; 144 | buildPhases = ( 145 | 9D94F42C84334342837F8522 /* Check Pods Manifest.lock */, 146 | 3BA6855D18886057004E2B45 /* Sources */, 147 | 3BA6855E18886057004E2B45 /* Frameworks */, 148 | 3BA6855F18886057004E2B45 /* Resources */, 149 | 9B73648611A14D4599149488 /* Copy Pods Resources */, 150 | ); 151 | buildRules = ( 152 | ); 153 | dependencies = ( 154 | ); 155 | name = FacilaTests; 156 | productName = FacilaTests; 157 | productReference = 3BA6856118886057004E2B45 /* FacilaTests.xctest */; 158 | productType = "com.apple.product-type.bundle.unit-test"; 159 | }; 160 | /* End PBXNativeTarget section */ 161 | 162 | /* Begin PBXProject section */ 163 | 3BA684B218884250004E2B45 /* Project object */ = { 164 | isa = PBXProject; 165 | attributes = { 166 | LastUpgradeCheck = 0500; 167 | }; 168 | buildConfigurationList = 3BA684B518884250004E2B45 /* Build configuration list for PBXProject "Tests" */; 169 | compatibilityVersion = "Xcode 3.2"; 170 | developmentRegion = English; 171 | hasScannedForEncodings = 0; 172 | knownRegions = ( 173 | en, 174 | ); 175 | mainGroup = 3BA684B118884250004E2B45; 176 | productRefGroup = 3BA6854718884875004E2B45 /* Products */; 177 | projectDirPath = ""; 178 | projectRoot = ""; 179 | targets = ( 180 | 3BA6856018886057004E2B45 /* FacilaTests */, 181 | ); 182 | }; 183 | /* End PBXProject section */ 184 | 185 | /* Begin PBXResourcesBuildPhase section */ 186 | 3BA6855F18886057004E2B45 /* Resources */ = { 187 | isa = PBXResourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 3BA6856A18886058004E2B45 /* InfoPlist.strings in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXShellScriptBuildPhase section */ 197 | 9B73648611A14D4599149488 /* Copy Pods Resources */ = { 198 | isa = PBXShellScriptBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | ); 202 | inputPaths = ( 203 | ); 204 | name = "Copy Pods Resources"; 205 | outputPaths = ( 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "\"${SRCROOT}/Pods/Pods-FacilaTests-resources.sh\"\n"; 210 | showEnvVarsInLog = 0; 211 | }; 212 | 9D94F42C84334342837F8522 /* Check Pods Manifest.lock */ = { 213 | isa = PBXShellScriptBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | ); 217 | inputPaths = ( 218 | ); 219 | name = "Check Pods Manifest.lock"; 220 | outputPaths = ( 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | shellPath = /bin/sh; 224 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 225 | showEnvVarsInLog = 0; 226 | }; 227 | /* End PBXShellScriptBuildPhase section */ 228 | 229 | /* Begin PBXSourcesBuildPhase section */ 230 | 3BA6855D18886057004E2B45 /* Sources */ = { 231 | isa = PBXSourcesBuildPhase; 232 | buildActionMask = 2147483647; 233 | files = ( 234 | 3BA6856C18886058004E2B45 /* FacilaTests.m in Sources */, 235 | 3B21EE9F190EB0B90094F01B /* FacilaContextTests.m in Sources */, 236 | 6BE46686576D03F51D7A2C0A /* FacilaDispatcherTests.m in Sources */, 237 | 6BE46A7E809B1149CB2643BF /* ActionHandlingModule.m in Sources */, 238 | 6BE46E1B75E1FE03D8A370D8 /* ActionCallingModule.m in Sources */, 239 | 6BE4654E14F7DD93FFFB1D29 /* FirstCustomContext.m in Sources */, 240 | 6BE46BA3BCD2BD97CBED6AB1 /* SecondCustomContext.m in Sources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | /* End PBXSourcesBuildPhase section */ 245 | 246 | /* Begin PBXVariantGroup section */ 247 | 3BA6856818886058004E2B45 /* InfoPlist.strings */ = { 248 | isa = PBXVariantGroup; 249 | children = ( 250 | 3BA6856918886058004E2B45 /* en */, 251 | ); 252 | name = InfoPlist.strings; 253 | sourceTree = ""; 254 | }; 255 | /* End PBXVariantGroup section */ 256 | 257 | /* Begin XCBuildConfiguration section */ 258 | 3BA684B618884250004E2B45 /* Debug */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | }; 262 | name = Debug; 263 | }; 264 | 3BA684B718884250004E2B45 /* Release */ = { 265 | isa = XCBuildConfiguration; 266 | buildSettings = { 267 | }; 268 | name = Release; 269 | }; 270 | 3BA6856F18886058004E2B45 /* Debug */ = { 271 | isa = XCBuildConfiguration; 272 | baseConfigurationReference = F4653BC1E17D4FB4989FD81C /* Pods-FacilaTests.xcconfig */; 273 | buildSettings = { 274 | ALWAYS_SEARCH_USER_PATHS = NO; 275 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 276 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 277 | CLANG_CXX_LIBRARY = "libc++"; 278 | CLANG_ENABLE_MODULES = YES; 279 | CLANG_ENABLE_OBJC_ARC = YES; 280 | CLANG_WARN_BOOL_CONVERSION = YES; 281 | CLANG_WARN_CONSTANT_CONVERSION = YES; 282 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 283 | CLANG_WARN_EMPTY_BODY = YES; 284 | CLANG_WARN_ENUM_CONVERSION = YES; 285 | CLANG_WARN_INT_CONVERSION = YES; 286 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 287 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 288 | COPY_PHASE_STRIP = NO; 289 | FRAMEWORK_SEARCH_PATHS = ( 290 | "$(SDKROOT)/Developer/Library/Frameworks", 291 | "$(inherited)", 292 | "$(DEVELOPER_FRAMEWORKS_DIR)", 293 | ); 294 | GCC_C_LANGUAGE_STANDARD = gnu99; 295 | GCC_DYNAMIC_NO_PIC = NO; 296 | GCC_OPTIMIZATION_LEVEL = 0; 297 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 298 | GCC_PREFIX_HEADER = "FacilaTests/FacilaTests-Prefix.pch"; 299 | GCC_PREPROCESSOR_DEFINITIONS = ( 300 | "DEBUG=1", 301 | "$(inherited)", 302 | ); 303 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 304 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 305 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 306 | GCC_WARN_UNDECLARED_SELECTOR = YES; 307 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 308 | GCC_WARN_UNUSED_FUNCTION = YES; 309 | GCC_WARN_UNUSED_VARIABLE = YES; 310 | INFOPLIST_FILE = "FacilaTests/FacilaTests-Info.plist"; 311 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 312 | ONLY_ACTIVE_ARCH = YES; 313 | PRODUCT_NAME = "$(TARGET_NAME)"; 314 | SDKROOT = iphoneos; 315 | WRAPPER_EXTENSION = xctest; 316 | }; 317 | name = Debug; 318 | }; 319 | 3BA6857018886058004E2B45 /* Release */ = { 320 | isa = XCBuildConfiguration; 321 | baseConfigurationReference = F4653BC1E17D4FB4989FD81C /* Pods-FacilaTests.xcconfig */; 322 | buildSettings = { 323 | ALWAYS_SEARCH_USER_PATHS = NO; 324 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 325 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 326 | CLANG_CXX_LIBRARY = "libc++"; 327 | CLANG_ENABLE_MODULES = YES; 328 | CLANG_ENABLE_OBJC_ARC = YES; 329 | CLANG_WARN_BOOL_CONVERSION = YES; 330 | CLANG_WARN_CONSTANT_CONVERSION = YES; 331 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 332 | CLANG_WARN_EMPTY_BODY = YES; 333 | CLANG_WARN_ENUM_CONVERSION = YES; 334 | CLANG_WARN_INT_CONVERSION = YES; 335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 336 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 337 | COPY_PHASE_STRIP = YES; 338 | ENABLE_NS_ASSERTIONS = NO; 339 | FRAMEWORK_SEARCH_PATHS = ( 340 | "$(SDKROOT)/Developer/Library/Frameworks", 341 | "$(inherited)", 342 | "$(DEVELOPER_FRAMEWORKS_DIR)", 343 | ); 344 | GCC_C_LANGUAGE_STANDARD = gnu99; 345 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 346 | GCC_PREFIX_HEADER = "FacilaTests/FacilaTests-Prefix.pch"; 347 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 348 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 349 | GCC_WARN_UNDECLARED_SELECTOR = YES; 350 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 351 | GCC_WARN_UNUSED_FUNCTION = YES; 352 | GCC_WARN_UNUSED_VARIABLE = YES; 353 | INFOPLIST_FILE = "FacilaTests/FacilaTests-Info.plist"; 354 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 355 | PRODUCT_NAME = "$(TARGET_NAME)"; 356 | SDKROOT = iphoneos; 357 | VALIDATE_PRODUCT = YES; 358 | WRAPPER_EXTENSION = xctest; 359 | }; 360 | name = Release; 361 | }; 362 | /* End XCBuildConfiguration section */ 363 | 364 | /* Begin XCConfigurationList section */ 365 | 3BA684B518884250004E2B45 /* Build configuration list for PBXProject "Tests" */ = { 366 | isa = XCConfigurationList; 367 | buildConfigurations = ( 368 | 3BA684B618884250004E2B45 /* Debug */, 369 | 3BA684B718884250004E2B45 /* Release */, 370 | ); 371 | defaultConfigurationIsVisible = 0; 372 | defaultConfigurationName = Release; 373 | }; 374 | 3BA6856E18886058004E2B45 /* Build configuration list for PBXNativeTarget "FacilaTests" */ = { 375 | isa = XCConfigurationList; 376 | buildConfigurations = ( 377 | 3BA6856F18886058004E2B45 /* Debug */, 378 | 3BA6857018886058004E2B45 /* Release */, 379 | ); 380 | defaultConfigurationIsVisible = 0; 381 | defaultConfigurationName = Release; 382 | }; 383 | /* End XCConfigurationList section */ 384 | }; 385 | rootObject = 3BA684B218884250004E2B45 /* Project object */; 386 | } 387 | --------------------------------------------------------------------------------