• Stars
    star
    171
  • Rank 222,266 (Top 5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

As tasty as McFlurry is

Overview

Pod version

VIPER McFlurry is a modern framework for implementing VIPER architecture in iOS application. It offers several tools and components that help either start new projects with VIPER or move from MVC.

McFlurry

Key Features

  • The framework itself pushes you to implement a proper VIPER architecture,
  • It provides an extremely nice and easy way to implement intermodule data transfer,
  • Used in default Generamba template.

Usage

This example works only for Module with UIViewController as View. However, it's possible to use this approach even with UIView and UITableViewCell acting as View.

  • Create Module input protocol for target module inherited from RamblerViperModuleInput:
@protocol SomeModuleInput <RamblerViperModuleInput>

- (void)moduleConfigurationMethod;

@end
  • Make Presenter of target module conform to this protocol.
  • Inject Presenter as moduleInput property of the view. You can skip this step if presenter is a view property with name "output".
  • Add Segue from source module ViewController to target module ViewController.
  • Inject Source ViewController into Source Router as property "transition handler".
  • In Router method call transition handler to open target module with configuration during segue.
[[self.transitionHandler openModuleUsingSegue:SegueIdentifier]
	thenChainUsingBlock:^id<RamblerViperModuleOutput>(id<SomeModuleInput> moduleInput) {
		[moduleInput moduleConfigurationMethod];
		return nil;
	}];

Working with Module output

  • Create Module output protocol for target module inherited from RamblerViperModuleOutput:
@protocol SomeModuleOutput <RamblerViperModuleOutput>

- (void)moduleConfigurationMethod;

@end
  • Make source module presenter to conform to this protocol.
  • Add to target module presenter method:
- (void)setModuleOutput:(id<RamblerViperModuleOutput>)moduleOutput;
  • Return source module presenter from configuration block in router:
[[self.transitionHandler openModuleUsingSegue:SegueIdentifier]
	thenChainUsingBlock:^id<RamblerViperModuleOutput>(id<SomeModuleInput> moduleInput) {
		[moduleInput moduleConfigurationMethod];
		return sourceRouterPresenter; // Return of module output
	}];

Working with Module Factory

Module factory can be replaced with segues for most cases. Except you need to create complex module or nontrivial module instantiation logic.

  • Use RamblerViperModuleFactory object as module fabric with Typhoon.
  • Set definition Initializer to initWithViewControllerLoader:andViewControllerIdentifier:
    • First parameter is the object which loads the view controller, e.g. UIStoryboard or TyphoonNibLoader instance,
    • Second parameter is view controller's identifier, e.g. RestorationID or NibName of ViewController.
  • Typhoon will initialize module from ViewController.
  • Inject this Factory into router.
  • Call Transition Handler's method - openModuleUsingFactory:withTransitionBlock:.
  • Second block is place where transition from one to another viewController/transitionHandler should be performed:
    [[self.transitionHandler openModuleUsingFactory:self.betaModuleFactory
                                withTransitionBlock:^(id <RamblerViperModuleTransitionHandlerProtocol> sourceModuleTransitionHandler,
                                        id <RamblerViperModuleTransitionHandlerProtocol> destinationModuleTransitionHandler) {

                                    UIViewController *sourceViewController = (id) sourceModuleTransitionHandler;
                                    UIViewController *destinationViewController = (id) destinationModuleTransitionHandler;

                                    [sourceViewController.navigationController pushViewController:destinationViewController
                                                                                         animated:YES];

                                }] thenChainUsingBlock:^id<RamblerViperModuleOutput>(id<RamblerModuleBetaInput> moduleInput) {
                                   [moduleInput configureWithExampleString:exampleString];
                                   return nil;
                               }];
  • In example above one module is pushed to navigation stack of another module.
  • Modules are linked with intermodule data transfer block.

Installation

Add to podfile

pod "ViperMcFlurry"

License

MIT

Authors

Rambler&Co team:

More Repositories

1

rambler-it-ios

open source VIPER application
Objective-C
333
star
2

swipe-layout-android

Android UI widget
Java
324
star
3

rambler-ui

😈 UI library for creating interfaces in Rambler guidelines with React power
JavaScript
191
star
4

criteo-1tb-benchmark

Benchmark of different ML algorithms on Criteo 1TB dataset
Jupyter Notebook
145
star
5

airflow-declarative

Airflow declarative DAGs via YAML
Python
131
star
6

actix-web-validator

Rust library for providing validation mechanism to actix-web with Validator crate.
Rust
100
star
7

hydrogen

More faster and convenient Doctrine ORM abstraction layer
PHP
85
star
8

scaraplate

Scaraplate is a wrapper around cookiecutter which allows to repeatedly rollup project templates onto concrete projects.
Python
60
star
9

rambler-webpack-boilerplate

Webpack (dev-server) Testem Mocha Chai
JavaScript
60
star
10

rusby

Ruby to Rust method transpiler
Ruby
34
star
11

RamblerTyphoonUtils

one love
Objective-C
28
star
12

rship

Rocket Ship – node.js tool for developing and building isomorphic web applications
JavaScript
26
star
13

aioriak

Python asyncio client for Riak
Erlang
26
star
14

RamblerSegues

Embed segue and Cross Storyboard segues library.
Shell
24
star
15

fastlane-flows

deliver it smoothly
Ruby
20
star
16

webpack-pipeline

Ruby
20
star
17

dashramba

the ultimate dashboard
JavaScript
12
star
18

frontend

Информация о внутренних встречах frontend разработчиков
12
star
19

raconfig

C++ header-only library for comfortable program configuration handling
C++
10
star
20

RambagramPageControl

UIPageControl replacement
Objective-C
10
star
21

actix-cache

Actix cache is a proxy actor and infrastructure for asynchronous and clear cache interaction for Actix actor and Actix-web frameworks.
Rust
9
star
22

video-ad-sdk

VAST/VPAID SDK that allows video ads to be played on top of any player
TypeScript
8
star
23

fish0

Rambler Site Fish patterns
Ruby
8
star
24

rspec-visual

Gem for "visual" testing with rspec via screenshot comparison.
Ruby
8
star
25

dotfiles

Rambler&Co Dotfiles for your javascripts
JavaScript
7
star
26

rambler-it-android

Android client for it.rambler-co.ru
7
star
27

viralligator

Elixir
6
star
28

tracing-syslog

Support for tracing events natively to syslog, preserving structured information
Rust
5
star
29

render-react

Renders React.js components into your Ruby views
JavaScript
5
star
30

magic-transport

Transport for communication between iframe and parent window
TypeScript
5
star
31

widgetly

Library that helps you to create widgets, including widgets that work via an iframe
TypeScript
4
star
32

reflexio

Business flow manager
TypeScript
4
star
33

cbr_currencies

Ruby gem for retrieving currencies data from CentroBank
Ruby
4
star
34

Rambler-Rate-Android

Java
4
star
35

foosball-api

Backend for the foosball champ app
3
star
36

thrustmq

Plain Golang message queue designed for speed, durability & simplicity
Go
3
star
37

lopataJs

Various tools for jqueryless development
JavaScript
3
star
38

danger-spec_postfix

Ruby
2
star
39

JRF

JSON-RPC Framework
PHP
2
star
40

unity-utils

Ruby
1
star
41

release_dove

Ruby gem that helps visualizing changelog.md
Ruby
1
star
42

backend

Информация о внутренних мероприятиях для backend разработчиков
1
star
43

java-webhdfs

Hadoop WebHDFS API client java library
Java
1
star
44

licenselint

A linter for NPM package licenses to avoid dependencies that not compatible with license of your software
TypeScript
1
star
45

rds-content-banners

Rambler digital solutions скрипт для расстановки рекламы внутри тела топика.
HTML
1
star