Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
GMRouter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMRouter
Commits
51dd6ba8
Commit
51dd6ba8
authored
Aug 10, 2020
by
jz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add common router
parent
bbdec0a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
GMTableViewController.m
Example/GMRouter/GMTableViewController.m
+1
-1
GMRouter+gm.h
GMRouter/Classes/GMRouter+gm.h
+1
-0
GMRouter+gm.m
GMRouter/Classes/GMRouter+gm.m
+7
-2
No files found.
Example/GMRouter/GMTableViewController.m
View file @
51dd6ba8
...
...
@@ -46,7 +46,7 @@
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
UIViewController
*
vc
=
[[
GMRouter
sharedInstance
]
pushScheme
:
@"
gengmei://
common"
completeBlock
:
^
(
NSDictionary
*
_Nonnull
params
)
{
UIViewController
*
vc
=
[[
GMRouter
sharedInstance
]
pushScheme
:
@"common"
completeBlock
:
^
(
NSDictionary
*
_Nonnull
params
)
{
}];
}
...
...
GMRouter/Classes/GMRouter+gm.h
View file @
51dd6ba8
...
...
@@ -10,6 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
extern
NSString
*
const
GMRouterProtocolPrefix
;
@interface
GMRouter
(
gm
)
/**
...
...
GMRouter/Classes/GMRouter+gm.m
View file @
51dd6ba8
...
...
@@ -18,7 +18,7 @@
NSString
*
const
GMRouterActionPrefix
=
@"Action_"
;
NSString
*
const
GMRouterActionSuffix
=
@":"
;
NSString
*
const
GMRouterTargetPrefix
=
@"Target_"
;
NSString
*
const
GMRouterProtocolPrefix
=
@"gengmei://"
;
/**
增加一个模块, 需要在路由做映射,
TODO: 后续改为数组的形式传过来
...
...
@@ -81,7 +81,12 @@ static NSMutableDictionary *routeMap = nil;
}
-
(
id
)
pushScheme
:
(
NSString
*
)
urlScheme
completeBlock
:
(
GMRouterBlock
)
routerBlock
{
NSString
*
encodeUrlScheme
=
[
self
URLEncodeString
:
urlScheme
];
NSString
*
encodeUrlScheme
;
if
([
encodeUrlScheme
hasPrefix
:
GMRouterProtocolPrefix
])
{
encodeUrlScheme
=
[
self
URLEncodeString
:
urlScheme
];
}
else
{
encodeUrlScheme
=
[
NSString
stringWithFormat
:
@"%@%@"
,
GMRouterProtocolPrefix
,
urlScheme
];
}
NSURL
*
url
=
[
NSURL
URLWithString
:
encodeUrlScheme
];
if
(
!
url
)
{
// debugLog(@"协议出错了!");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment