Skip to content

aichiko0225/RealmExamples

Repository files navigation

RealmExamples

主要是Realm & coobjc & JLRoutes 的相关用法。

JLRoutes部分

主要是实现了简单的路由功能,可能后面还有扩展功能

AppDelegate中配置默认的路由实现方式

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [[CCRouterManager shareManager] configDefaultRoutes];
    return YES;
}

用法也很简单

+ (BOOL)routeURL:(nullable NSURL *)URL;

- (BOOL)routeURL:(nullable NSURL *)URL;

+ (BOOL)routeURL:(nullable NSURL *)URL withParameters:(nullable NSDictionary<NSString *, id> *)parameters;

- (BOOL)routeURL:(nullable NSURL *)URL withParameters:(nullable NSDictionary<NSString *, id> *)parameters;

也可以传入一个回调函数

@interface JLRoutes (Block)

+ (BOOL)routeURL:(nullable NSURL *)URL callback:(RoutesCallback)callback;

+ (BOOL)routeURL:(nullable NSURL *)URL withParameters:(nullable NSDictionary<NSString *, id> *)parameters callback:(RoutesCallback)callback;

@end

Example

- (IBAction)route1:(UIButton *)sender {
    NSString *routePath = [routePath1 stringByAppendingString:@"?keyword=xxkeyword&title=test_title"];
    BOOL r1 = [JLRoutes routeURL:[NSURL URLWithRoutePath:routePath]];
    
    BOOL r2 = [JLRoutes routeURL:[NSURL URLWithRoutePath:routePath2]];
    
    BOOL r3 = [JLRoutes routeURL:[NSURL URLWithRoutePath:routePath3] callback:^(id  _Nonnull data) {
        NSLog(@"route3 callback %@", data);
    }];
    
    
    
}

About

Realm & coobjc & JLRoutes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published