Giter Site home page Giter Site logo

infinum / ios-viper-xcode-templates Goto Github PK

View Code? Open in Web Editor NEW
586.0 31.0 82.0 9.41 MB

Used for generating template files for the VIPER architecture, which solves the common Massive View Controller issues in iOS apps.

License: Apache License 2.0

Makefile 1.51% HTML 60.08% Ruby 38.41%
open-source ios

ios-viper-xcode-templates's Issues

UITabBar support

I had tab bar support manually added to previous version but if it could be added natively to this repository that would be great

Viper Wireframes option to be storyboard based or programmatically view controller based

I would like the option for the Wireframe classes to be storyboard or non interface builder view controller based.

//
//  LoginWireframe.swift
//  ViperExample
//
//  Created by Jerome Isaacs on 8/9/19.
//  Copyright (c) 2019 r4e. All rights reserved.
//
//  This file was generated by the ๐Ÿ VIPER generator
//

import UIKit

final class LoginWireframe: BaseWireframe {

    // MARK: - Private properties -

    private let storyboard = UIStoryboard(name: "<#Login#>", bundle: nil)

    // MARK: - Module setup -

    init() {
        let moduleViewController = storyboard.instantiateViewController(ofType: LoginViewController.self)
        super.init(viewController: moduleViewController)
        
        let interactor = LoginInteractor()
        let presenter = LoginPresenter(view: moduleViewController, interactor: interactor, wireframe: self)
        moduleViewController.presenter = presenter
    }

}

// MARK: - Extensions -

extension LoginWireframe: LoginWireframeInterface {
}

In this case, I would've liked the ability to pick between a storyboard or instantiating a view controller directly.

Wireframe V2

I would like to discuss merging feature/v2 branch to master .
First I would like if you could go over the proposed changes to settle all creative differences.

Interfaces ordering in the Interface file (Rx template)

Current

In the latest version of the VIPER generator, when Rx version is selected, enum ModuleName with ViewOutput and ViewInput is created on the top of the file, before other protocols.

Proposal

The proposal is to move that enum at the bottom of the interface file so that protocols are first listed. The main reason is that Interactor should have most of the business logic inside and as in Wireframe navigation enum is removed, we will have more navigation methods listed there. In most cases, ViewInput / ViewOutput will have generic properties like close, add, items, buttonState, etc. that are not so useful to see first in the Interfaces file.

What will this accomplish

This change could lead to a better file organization and easier information search as the main interfaces are on top. ViewInput / ViewOutput structs are just structs used in the configure(with: method and therefore it is ok to have them at the end of the file.

Poll

Should we move ViewInput / ViewOutput to the end of the Interfaces file?

/polls Yes No

How to handle the communication between the two modules ?

The VIPER is great and I have 2 questions:

  1. WireFrameA hold the reference WireFameB, how to decouple it ?
  2. How ModuleA can pass the parameters to ModuleB and ModuleA can listen some callback from ModuleB? Where the action can be done? WireFrameA <------>WireframeB ?

Interfaces ordering in the Interface file (Rx template)

Current

In the latest version of the VIPER generator, when Rx version is selected, enum ModuleName with ViewOutput and ViewInput is created on the top of the file, before other protocols.

Proposal

The proposal is to move that enum to the bottom of the interface file so that protocols are first listed. The main reason is that Interactor should have most of the business logic inside and as in Wireframe navigation enum is removed, we will have more navigation methods listed there. In most cases, ViewInput / ViewOutput will have generic properties like close, add, items, buttonState, etc. that are not so useful to see first in the Interfaces file.

What will this accomplish

This change could lead to a better file organization and easier information search as the main interfaces are on top. ViewInput / ViewOutput structs are just structs used in the configure(with: method and therefore it is ok to have them at the end of the file.

Poll

Should we move ViewInput / ViewOutput to the end of the Interfaces file?


Using unowned reference in Presenter class

I have a scenario where user goes to next page, by pushing view controller. The next page has a collectionView and an API call, if user goes to next page, API is called and based on response collectionView is reloaded. Now, if user clicks back button very quickly(before response comes), so view controller is destroyed from memory, but since the view reference was unowned private unowned let view: KBPlusMemberDetailViewInterface, it still exists. Now, user is on the previous page and the API gives data on next page, and self.view.collectionView.reloadData() is called on the next page(which is not in memory anymore), but since self is destroyed, so the app is crashed. How can we solve this?

Interactor question

Hi, after completing my first Viper project (and creating everything by hand) I decided to try your templates for the next project.
I have a question regarding the Interactor in your templates. Why is there no connection to a presenter? How can the Interactor respond to the presenter (Interactor output). I saw in your examples you are using callbacks. Is this how you imagined it in this template? Or am I missing something?
tl;dr why does the Interactor not have access to a weak presenter property for his output?

Customizing base classes

Thanks for great viper implementation.

I want to have BasePresenter class and BaseInteractor class like BaseWireFrame to add some base stuffs, is there any way to make sure generated interactors and presenters are extending from my new base classes?

Interactor example

Please, could you give the better way to integrate with Interactor?
Thanks ;)

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.