Vegetarians / Lotusoot
Licence: gpl-3.0
灵活的 Swift 组件解耦和通信工具
Stars: ✭ 324
Programming Languages
swift
15916 projects
Projects that are alternatives of or similar to Lotusoot
Http
An opinionated framework for scalable web 🌎
Stars: ✭ 136 (-58.02%)
Mutual labels: modular, router
Tinypart
TinyPart is an iOS modularization framework implemented by Ojective-C. It also supports URL-routing and inter-module communication. TinyPart是一个由Objective-C编写的面向协议的iOS模块化框架,同时它还支持URL路由和模块间通信机制。
Stars: ✭ 120 (-62.96%)
Mutual labels: modular, router
Zikrouter
Interface-oriented router for discovering modules, and injecting dependencies with protocol in Objective-C and Swift.
Stars: ✭ 516 (+59.26%)
Mutual labels: modular, router
Fluro
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.
Stars: ✭ 3,372 (+940.74%)
Mutual labels: router
Abstract State Router
Like ui-router, but without all the Angular. The best way to structure a single-page webapp.
Stars: ✭ 288 (-11.11%)
Mutual labels: router
React Overdrive
Super easy magic-move transitions for React apps
Stars: ✭ 3,001 (+826.23%)
Mutual labels: router
Graphpath
Graphpath generates an ASCII network diagram from the route table of a Unix/Linux
Stars: ✭ 321 (-0.93%)
Mutual labels: router
Simplcommerce
A simple, cross platform, modularized ecommerce system built on .NET Core
Stars: ✭ 3,474 (+972.22%)
Mutual labels: modular
Esp wifi repeater
A full functional WiFi Repeater (correctly: a WiFi NAT Router)
Stars: ✭ 3,818 (+1078.4%)
Mutual labels: router
Pjax Api
The second generation PJAX for advanced web frameworks.
Stars: ✭ 291 (-10.19%)
Mutual labels: router
Rxrouter
A lightweight, simple, smart and powerful Android routing library.
Stars: ✭ 320 (-1.23%)
Mutual labels: router
Angular
UI-Router for Angular: State-based routing for Angular (v2+)
Stars: ✭ 287 (-11.42%)
Mutual labels: router
Routing Controllers
Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage in Express / Koa using TypeScript and Routing Controllers Framework.
Stars: ✭ 3,557 (+997.84%)
Mutual labels: router
Freerouting
Advanced PCB autorouter (finally, no Java installation required)
Stars: ✭ 307 (-5.25%)
Mutual labels: router
Eventline
Micro-framework for routing and handling events for bots and applications 🤖. IFTTT for developers 👩💻👨💻
Stars: ✭ 305 (-5.86%)
Mutual labels: router
Laravel Starter
A CMS like modular starter application project built with Laravel 8.x.
Stars: ✭ 299 (-7.72%)
Mutual labels: modular
Lotusoot
Lotusoot is a router tool and a decoupling tool of modular project.
Installtion
pod 'Lotusoot'
How to use
1. Configuration
- In Xcode: Click on your project in the file list, choose your target under
TARGETS
, click theBuild 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 below
Check 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
, addLotusoot.plist
into your project and uncheck Copy items if needed
Tip: Add the
Lotusoot.plist
to your .gitignore file to prevent unnecessary conflicts.
2. Use
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// register all routes
LotusootCoordinator.registerAll()
return true
}
- Call a service
let lotus = s(AccountLotus.self)
let accountModule: AccountLotus = LotusootCoordinator.lotusoot(lotus: lotus) as! AccountLotus
accountModule.login(username: "admin", password: "wow") { (error) in
print(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) in
print(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 definesLotus
protocol for all modules. ALotus
protocol defines all the functionality that open to other modules。For Example:
public protocol AccountLotus {
func login(username: String, password: String, complete: (Error?) -> Void)
func register(username: String, password: String, complete: (Error?) -> Void)
func email(username: String) -> String
func showLoginVC(username: String, password: String)
}
- Implement the
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]
:
// @NameSpace(TestAccountModule)
// @Lotusoot(AccountLotusoot)
// @Lotus(AccountLotus)
class AccountLotusoot: NSObject, AccountLotus {
func email(username: String) -> String {
return OtherService.email(username: "zhoulingyu")
}
func login(username: String, password: String, complete: (Error?) -> Void) {
LoginService.login(username: username, password: password, complete: complete)
}
func register(username: String, password: String, complete: (Error?) -> Void) {
RegisterService.register(username: username, password: password, complete: complete)
}
func showLoginVC(username: String, password: String) {
print("show login view controller")
}
}
Lotusoot
MUST inherit fromNSObject
- In your main project
import Lotusoot
、import ModulePublic
. You are free to call all the service and routers now
Tip: You can refer Demo -> NewProject
Demo
Demo 工程,Please do not forget build every Scheme
first.
TO DO
- [ ] Fetch router dynamically
- [ ] Unified way of viewcontroller jump
- [ ] Custom Animation
License
Lotusoot
Use 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].