Giter Site home page Giter Site logo

yizzuide / xflegoviper Goto Github PK

View Code? Open in Web Editor NEW
221.0 19.0 61.0 8.62 MB

🚀 A seamless framework for build app from MVC, MVVM, VIPER (etc.) design pattern in iOS world. (OC & Swift)

License: MIT License

Objective-C 97.78% Ruby 0.45% Dart 1.77%
viper component-architecture ios modular plugin-engine extensibility swift

xflegoviper's Introduction

logo

cocoapods language LICENSE version

Note

🚀 A seamless framework for build app from MVC, MVVM, VIPER (etc.) design pattern in iOS world. (OC & Swift)

  • Assemble a VIPER module as fast so far, only need one line code.
  • Build-In powerful component event communication.
  • Real-Time track Component link 💫 .
  • Consider MVx, VIPER (etc.) module as component, using the same transition and event API.
  • Add plugin mechanism for custom extension other design pattern module and URL Route.
  • Add URL interceptor for intercept special URL before transition.

🍺 Thanks VIPER!

VIPER Design Pattern

Component Architecture

Component Architecture

Example

Demo

Demo

Swift Demo

see Lego-swift

Complete project

see BDJProjectExample

Video

Requirements

  • Xcode 7.0+
  • IOS 6.0+

4.x Release

XFLegoVIPER 4.x is now available (July 2017). 🎉 It's now add Swift (all version) language support. 🎉

Installation

CocoaPods

To integrate XFLegoVIPER into your Xcode project using CocoaPods, specify it in your Podfile:

platform :ios, '8.0'
use_frameworks! # for Swift!!!

target '<Your Target Name>' do
    pod 'XFLegoVIPER', '~> 4.0'
end

Import the XFLegoVIPER.h umbrella header.

  • With use_frameworks! in your Podfile
    • Swift: import XFLegoVIPER
    • Objective-C: #import <XFLegoVIPER/XFLegoVIPER.h> (or with Modules enabled: @import XFLegoVIPER;)
  • Without use_frameworks! in your Podfile
    • Swift: Add #import "XFLegoVIPER.h" to your bridging header.
    • Objective-C: #import "XFLegoVIPER.h"

❤Using Template❤

Now you can use template file to create a module which make of stuff class as fast as possible.

Too complicated? See Video

1.Install the templates

Xcode templates can be found in the repository's /Template/Architecture folder. To install them, open your terminal and run:

cd PATH/TO/REPO
mkdir -p ~/Library/Developer/Xcode/Templates/
cp -R Template/Architecture ~/Library/Developer/Xcode/Templates/

2.Using xcode create module files

  1. Quit Xcode and open again
  2. Right click a group, select New File...
  3. Scrolling to Architecture Section, double click VIPER or MVVM item
  4. Input module name (you need add class prefix), and next, final click create action

3.Fix blue folder issue

we have blue folder under select group, what's wrong? Let's fix it:

  1. Right click blue folder, select Show in Finder
  2. Back to Xcode, right click blue folder again, select Delete->Remove References
  3. Back to opened Finder, drag new-folder to Xcode under a group

OK! It Work!

VIPER Module

XFLegoVIPER Module Layer

Documentation

3.x/4.x(Objc) | 4.x(Swift)

Change log

see change log

Reference

iOS Architecture Patterns English | Chinese

Architecting iOS Apps with VIPER English | Chinese

Author

yizzuide, [email protected]

QQ Group:450518005

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

License

XFLegoVIPER is available under the MIT license. See the LICENSE file for more info.

xflegoviper's People

Contributors

monkeywithacupcake avatar shanshuiren avatar yizzuide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xflegoviper's Issues

present一个组件后,退出时执行[self dismissViewAction]奔溃

[config enableLog];开启打印日志时,当退出组件时执行打印组件跟踪路径导致崩溃:

__kindof id<XFComponentRoutable> component = [__componentTable objectForKey:__componentKeyArr[0]];

__componentKeyArr此时空数组,索引越界导致崩溃。

Thread 1: "*** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array"

MVVM模块下,RACObserve(self.dataDriver, expressData)奔溃

在mVVM模块下,bindViewData方法中,仅打开默认的绑定代码块RACObserve:

 XF_Define_Weak
    [RACObserve(self.dataDriver, expressData) subscribeNext:^(NSString *imgUrl) {
        XF_Define_Strong
        // 如果有显示数据加载完成
    }];

奔溃位置:

#15	0x00000001065d1b0c in -[RACKVOTrampoline initWithTarget:observer:keyPath:options:block:] at /Users/jhmac/hsg/SupervisionSel/Pods/ReactiveCocoa/ReactiveCocoa/RACKVOTrampoline.m:50

there is a crash when enablelog is on

use XF_ShowURLComponent2Window_Fast(@"XXXX") to change rootWindow and if page from "start" to "main" that's all right but if page form "start" to "login" and then into "main" there was a crash when enableLog is on.

then i find this:
NSMapTable {
[7] Login -> <ZRLoginPresenter: 0x600000115c30>
[12] IndexTab -> <ZRIndexTabPresenter: 0x6000000b33e0>
}

<__NSArrayM 0x60400025fef0>(
Start,
Login,
IndexTab
)

it causes component became nil in below codes.

XFComponentManager.m

__kindof id component = [__componentTable objectForKey:__componentKeyArr[0]];
[self _printComponentTree:component logStr:logStrM];

so why did it happen? and how to make it work correctly?
when i close enablelog all things is ok.

关于 classPrefix 和 stuffix

现在框架在 oc 上面必须有classPrefix 和 stuffix,这种机制下有两种情况下目前不好解决。

  1. 项目内的第三方控件库,第三方控件库都有自己的命名
  2. 公司内部封装的多个项目共用的库

希望后面能够支持不规则的组件名称,比如注册url和组件名的时候以手动指定的方式或者其它方式。
@yizzuide 楼主怎么看?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.