All Projects → imjoych → Jcnavigator

imjoych / Jcnavigator

Licence: mit
A decoupled navigator framework of jumping between modules or apps for iOS development.

Projects that are alternatives of or similar to Jcnavigator

Sun
Android-Sun-Framework 模块化开发框架
Stars: ✭ 123 (+272.73%)
Mutual labels:  framework, modules, component
kaptain
👨‍✈️ multi-module navigation on Android has never been so easier!
Stars: ✭ 24 (-27.27%)
Mutual labels:  module, navigation, navigator
React Modern Library Boilerplate
Boilerplate for publishing modern React modules with Rollup
Stars: ✭ 285 (+763.64%)
Mutual labels:  module, component
Native Navigation
Native navigation library for React Native applications
Stars: ✭ 3,126 (+9372.73%)
Mutual labels:  navigation, navigator
Preferencesfx
A framework for easily creating a UI for application settings / preferences.
Stars: ✭ 449 (+1260.61%)
Mutual labels:  framework, component
LibPQ
Detach your M code from workbooks to reuse it! Import modules from local or web storage (unlimited number of sources)
Stars: ✭ 55 (+66.67%)
Mutual labels:  module, modules
Circuits
circuits is a Lightweight Event driven and Asynchronous Application Framework for the Python Programming Language with a strong Component Architecture.
Stars: ✭ 256 (+675.76%)
Mutual labels:  framework, component
Element Queries Spec
A spec for a Container-Style Element Query Syntax
Stars: ✭ 375 (+1036.36%)
Mutual labels:  module, component
shopyo
shopyo.readthedocs.org
Stars: ✭ 66 (+100%)
Mutual labels:  module, modules
Vuesax
New Framework Components for Vue.js 2
Stars: ✭ 5,293 (+15939.39%)
Mutual labels:  framework, component
React Router Navigation
⛵️ A complete navigation library for React Native, React DOM and React Router
Stars: ✭ 498 (+1409.09%)
Mutual labels:  navigation, navigator
Velocityx
A minimalist Flutter framework for rapidly building custom designs.
Stars: ✭ 595 (+1703.03%)
Mutual labels:  framework, component
laravel-module-loader
THIS PACKAGE HAS BEEN DEPRECATED — A lightweight package to organize your code into contextual modules.
Stars: ✭ 76 (+130.3%)
Mutual labels:  module, modules
Hybrid Navigation
React Native Navigation that supports seamless navigation between Native and React.
Stars: ✭ 258 (+681.82%)
Mutual labels:  navigation, navigator
nuxt-modules
AX2's Nuxt modules
Stars: ✭ 30 (-9.09%)
Mutual labels:  module, modules
Modclean
Remove unwanted files and directories from your node_modules folder
Stars: ✭ 309 (+836.36%)
Mutual labels:  module, modules
Resolve
Implements the node.js require.resolve() algorithm
Stars: ✭ 622 (+1784.85%)
Mutual labels:  module, modules
laravel-admin
Laravel Admin panel with theme , modules ,artisan commands and helper classess.Laravel admin boilerplate with theme and modules
Stars: ✭ 22 (-33.33%)
Mutual labels:  module, modules
RandomProxyRuby
Tiny Library for get random proxy (free).
Stars: ✭ 16 (-51.52%)
Mutual labels:  module, modules
San
A fast, portable, flexible JavaScript component framework
Stars: ✭ 4,514 (+13578.79%)
Mutual labels:  framework, component

JCNavigator

A decoupled navigator framework of jumping between modules or apps for iOS development.

Features

This framework supports the development of iOS 8.0+ in ARC.

  • JCNavigator configs.
  • Implement module maps.
  • Jump operations with method openURL: or openWithMapKey:.
  • Parameters passing between modules.

JCNavigator configs

Set URL jump rules with hostList for scheme

[[JCNavigator sharedNavigator] addURLScheme:@"joych" hostList:@[@"com.joych.JCNavigatorDemo"]];

Set rootViewController

ViewController *vc = [[ViewController alloc] init];
[[JCNavigator sharedNavigator] setRootViewController:vc];

Implement module maps

JCTestModuleMap class is declared as the subclass of JCModuleMap.

  • Map key should be defined with the same prefix and appended with "_".
  • Map key will be used in the category of JCNavigator which associated with this module.
//  JCTestModuleMap.h

FOUNDATION_EXPORT NSString *const JCFirstLevelMapKey;
FOUNDATION_EXPORT NSString *const JCSecondLevelMapKey;
FOUNDATION_EXPORT NSString *const JCThirdLevelMapKey;
FOUNDATION_EXPORT NSString *const JCContentDetailMapKey;

@interface JCTestModuleMap : JCModuleMap

@end
//  JCTestModuleMap.m

NSString *const JCFirstLevelMapKey = @"JC_firstLevel";
NSString *const JCSecondLevelMapKey = @"JC_secondLevel";
NSString *const JCThirdLevelMapKey = @"JC_thirdLevel";
NSString *const JCContentDetailMapKey = @"JC_contentDetail";

@implementation JCTestModuleMap

- (NSDictionary<NSString *,Class> *)classesForMapKeys
{
    return @{JCFirstLevelMapKey: NSClassFromString(@"JCFirstLevelViewController"),
             JCSecondLevelMapKey: NSClassFromString(@"JCSecondLevelViewController"),
             JCThirdLevelMapKey: NSClassFromString(@"JCThirdLevelViewController"),
             JCContentDetailMapKey: NSClassFromString(@"JCContentDetailViewController"),
             };
}

- (BOOL)presentedForClass:(Class)viewControllerClass
{
    if ([viewControllerClass isEqual:NSClassFromString(@"JCContentDetailViewController")]) {
        return YES;
    }
    return NO;
}

- (NSArray<Class> *)reuseViewControllerClasses
{
    return @[NSClassFromString(@"JCFirstLevelViewController")];
}

- (NSDictionary<NSString *,NSDictionary *> *)propertiesMapOfURLQueryForClasses
{
    return @{@"JCContentDetailViewController": @{@"pageindex": @"currentIndex"}};
}

@end

Jump operations with method openURL: or openWithMapKey:

Open URL between apps or modules.

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
{
    return [[JCNavigator sharedNavigator] openURL:url options:options];
}
[[JCNavigator sharedNavigator] openURL:[NSURL URLWithString:@"joych://com.joych.JCNavigatorDemo/firstlevel"]];
[[JCNavigator sharedNavigator] openURLString:@"joych://com.joych.jcnavigatordemo/contentdetail?pageindex=1"];

Category of JCNavigator implemented interfaces which are used for jumps between modules.

//  JCNavigator+JCTestModuleInterface.h

@interface JCNavigator (JCTestModuleInterface)

+ (void)openFirstLevelViewController;

+ (void)openSecondLevelViewController;

+ (void)openThirdLevelViewController;

+ (void)openContentDetailViewControllerWithCurrentIndex:(NSString *)currentIndex
                                                 testId:(NSString *)testId
                                              testArray:(NSArray *)testArray;

@end
//  JCNavigator+JCTestModuleInterface.m

@implementation JCNavigator (JCTestModuleInterface)

+ (void)load
{
    [[JCNavigator sharedNavigator] addModuleMap:[JCTestModuleMap new]];
}

+ (void)openFirstLevelViewController
{
    [[JCNavigator sharedNavigator] openWithMapKey:JCFirstLevelMapKey];
}

+ (void)openSecondLevelViewController
{
    [[JCNavigator sharedNavigator] openWithMapKey:JCSecondLevelMapKey];
}

+ (void)openThirdLevelViewController
{
    [[JCNavigator sharedNavigator] openWithMapKey:JCThirdLevelMapKey];
}

+ (void)openContentDetailViewControllerWithCurrentIndex:(NSString *)currentIndex testId:(NSString *)testId testArray:(NSArray           *)testArray
{
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:3];
    if ([currentIndex isKindOfClass:[NSString class]]) {
        params[@"currentIndex"] = currentIndex;
    }
    if ([testId isKindOfClass:[NSString class]]) {
        params[@"testId"] = testId;
    }
    if ([testArray isKindOfClass:[NSArray class]]) {
        params[@"testArray"] = testArray;
    }
    [[JCNavigator sharedNavigator] openWithMapKey:JCContentDetailMapKey propertiesBlock:^NSDictionary *{
        return params;
    } presented:YES animated:YES];
}

@end

Parameters passing between modules

Parameters passing between modules is realized by properties assignment.

  • Properties are suggested to be declared as NSString class because openURL: method only supports this data type.
  • Properties also can be declared as NSArray / NSDictionary / NSSet / UIImage and so on data types, which can be used with openWithMapKey:propertiesBlock: method. For decoupling between modules, although you can use a custom object, it is not recommended.
//  JCContentDetailViewController.h

@protocol JCContentDetailDelegate <NSObject>

@property (nonatomic, strong) NSString *currentIndex;
@property (nonatomic, strong) NSString *testId;
@property (nonatomic, strong) NSArray *testArray;

@end

@interface JCContentDetailViewController : UIViewController<JCContentDetailDelegates>

@end

CocoaPods

To integrate JCNavigator into your iOS project, specify it in your Podfile:

pod 'JCNavigator'

Contacts

If you have any questions or suggestions about the framework, please E-mail to contact me.

Author: Joych
E-mail: [email protected]

License

JCNavigator is released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].