In Xcode: Click on your project in the file list, choose your target under TARGETS, click the Build Phases tab and add a New Run Script Phase by clicking the little plus icon in the top left
Drag the new Run Script phase above the Compile Sources phase and belowCheck Pods Manifest.lock, expand it and paste the following script:
python ${PODS_ROOT}/Lotusoot/Lotusoot/Lotusoot.py ${SRC_ROOT}${SRCROOT} Lotusoot
# parameter1: scan path# parameter2: ${SRCROOT}, output path of Lotusoot.plist# parameter3: suffix of Lotusoot(Can bes omited), Omit leads to script execution time
Build your project, in Finder you will now see a Lotusoot.plist in the $SRCROOT-folder, add Lotusoot.plist into your project and uncheck Copy items if needed
Tip: Add the Lotusoot.plist to your .gitignore file to prevent unnecessary conflicts.
let lotus =s(AccountLotus.self)
let accountModule: AccountLotus = LotusootCoordinator.lotusoot(lotus: lotus) as! AccountLotus
accountModule.login(username: "admin", password: "wow") { (error) inprint(error ??"")
}
Register a router
let error: NSError?= LotusootRouter.register(route: "newproj://account/login") { (lotusootURL) in
accountModule.showLoginVC(username: "admin", password: "wow")
}
Open an URL
let param: Dictionary= ["username":"admin",
"password":"wow"]
// no call back
LotusootRouter.open(route: "newproj://account/login", params: param)
// has call back
LotusootRouter.open(route: "newproj://account/login", params: param).completion { (error) inprint(error ??"open success")
}
// ⚠️Not recommanded, use ?pram0=xxx lead to mismanagement
// This method just for H5 page of Hybrid project
LotusootRouter.open(url: "newproj://account/login?username=zhoulingyu").completion { (error) in
print(error ?? "open success")
}
3. Annotation and Suggest
Good usage example of Lotusoot:
Create Public module, where it defines Lotus protocol for all modules. A Lotus protocol defines all the functionality that open to other modules。For Example:
Implement the Lotus protocol you have defined in Public Module, you can call it Lotusoot. In Lotusoot, you must add Annotation for current Lotusoot, include: [email protected], [email protected], [email protected]:
Vegetarians/Lotusoot
Lotusoot
Lotusoot is a router tool and a decoupling tool of modular project.
Installtion
How to use
1. Configuration
TARGETS
, click theBuild Phases
tab and add a New Run Script Phase by clicking the little plus icon in the top leftCheck Pods Manifest.lock
, expand it and paste the following script:Lotusoot.plist
in the$SRCROOT-folder
, addLotusoot.plist
into your project and uncheck Copy items if needed2. Use
3. Annotation and Suggest
Good usage example of
Lotusoot
:Public module
, where it definesLotus
protocol for all modules. ALotus
protocol defines all the functionality that open to other modules。For Example:Lotus
protocol you have defined inPublic Module
, you can call itLotusoot
. InLotusoot
, you must add Annotation for currentLotusoot
, include:[email protected]
,[email protected]
,[email protected]
:import Lotusoot
、import ModulePublic
. You are free to call all the service and routers nowDemo
Demo 工程,Please do not forget build every
Scheme
first.TO DO
License
Lotusoot
Use MIT License