All Projects → Karumi → Bothamui

Karumi / Bothamui

Licence: apache-2.0
Model View Presenter Framework written in Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Bothamui

Android Kotlin Mvp Clean Architecture
Clean architecture blueprint using Kotlin and MVP pattern.
Stars: ✭ 105 (-70.59%)
Mutual labels:  mvp, mvp-pattern
Android Mvp Architecture
🏛 A basic sample android application to understand MVP in a very simple way. Just clone, build, run and understand MVP.
Stars: ✭ 203 (-43.14%)
Mutual labels:  mvp, mvp-pattern
Mvparms
⚔️ A common architecture for Android applications developing based on MVP, integrates many open source projects, to make your developing quicker and easier (一个整合了大量主流开源项目高度可配置化的 Android MVP 快速集成框架).
Stars: ✭ 10,146 (+2742.02%)
Mutual labels:  mvp, mvp-pattern
Mvpandroid
Sample app to demonstrate MVP (Model - View - Presenter) architecture in android
Stars: ✭ 91 (-74.51%)
Mutual labels:  mvp, mvp-pattern
wikilight
A lightweight Wikipedia Client
Stars: ✭ 50 (-85.99%)
Mutual labels:  mvp, mvp-pattern
Ngx Tour Of Heroes Mvp
Tour of Heroes Angular app using the Model-View-Presenter pattern
Stars: ✭ 92 (-74.23%)
Mutual labels:  mvp, mvp-pattern
Kotlinmvparchitecture
Clean MVP Architecture with Dagger2 + Retrofit2 + Mockito + Fresco + EasiestGenericRecyclerAdapter using Kotlin. Added Unit Tests(Kotlin Tests)!
Stars: ✭ 143 (-59.94%)
Mutual labels:  mvp, mvp-pattern
Android Clean Architecture Boilerplate
Apply clean architecture on Android
Stars: ✭ 141 (-60.5%)
Mutual labels:  mvp, mvp-pattern
Trickl
trickl torrent client
Stars: ✭ 50 (-85.99%)
Mutual labels:  mvp, mvp-pattern
mezon
Mezon is a simple php framework wich will help you to create business applications.
Stars: ✭ 35 (-90.2%)
Mutual labels:  mvp, mvp-pattern
Memorize
🚀 Japanese-English-Mongolian dictionary. It lets you find words, kanji and more quickly and easily
Stars: ✭ 72 (-79.83%)
Mutual labels:  mvp, mvp-pattern
KotlinMvpTemplateGenerator
Android Studio template for Kotlin with MVP + Dagger2 + Retrofit2
Stars: ✭ 65 (-81.79%)
Mutual labels:  mvp, mvp-pattern
Mvpart
🎨 A new Android MVP architecture (此框架旨在解决传统 MVP 类和接口太多, 并且 Presenter 和 View 通过接口通信过于繁琐, 重用 Presenter 代价太大等问题).
Stars: ✭ 776 (+117.37%)
Mutual labels:  mvp, mvp-pattern
Kotlinrxmvparchitecture
Clean MVP Architecture with RxJava + Dagger2 + Retrofit2 + Mockito + Fresco + EasiestGenericRecyclerAdapter using Kotlin. Includes Unit Tests(Kotlin Tests)!
Stars: ✭ 94 (-73.67%)
Mutual labels:  mvp, mvp-pattern
Rxweather
Architecting Android with RxJava
Stars: ✭ 570 (+59.66%)
Mutual labels:  mvp, mvp-pattern
Android-Starter-Kit
This is up-to-date android studio project for native android application, that is using modern tools and libraries.
Stars: ✭ 16 (-95.52%)
Mutual labels:  mvp, mvp-pattern
EdgeMvp
一个MVP架构利器。自动生成接口文件,且不需要实现接口。
Stars: ✭ 56 (-84.31%)
Mutual labels:  mvp, mvp-pattern
visum
Android reactive MVP stack
Stars: ✭ 19 (-94.68%)
Mutual labels:  mvp, mvp-pattern
Avenging
MVP pattern example on Android: no Dagger or RxJava example
Stars: ✭ 279 (-21.85%)
Mutual labels:  mvp
Dynamics 365 Workflow Tools
Dynamics 365 Workflow Tools is a Community solution that expands Microsoft Dynamics 365 (CRM) Workflow features with lots of new posibilities. This helps you to build very advanced Codeless solutions in CRM.
Stars: ✭ 331 (-7.28%)
Mutual labels:  mvp

Karumi logoBothamUI Build Status CocoaPods Compatible

BothamUI is MVP (Model-View-Presenter) framework written in Swift.

This project will help you setup all your presentation logic. BothamUI provides classes to represent the main components of this pattern like BothamViewController and BothamPresenter.

In addition we will use a wireframe navigation model and a service locator example[[5] [di]].

Screenshots

Screenshot1

Application UI/UX designs by Luis Herrero.

Data provided by Marvel. © 2015 MARVEL

Usage

This framework contains all the classes needed to implement your presentation logic following the MVP pattern. To use the view package, make your ViewController extend from Botham ViewController and specify in the storyboard wich class and Storyboard ID is linked to:

import BothamUI

class SampleViewController: BothamViewController {
    /*...*/
}

storyboardReference

Storyboard

BothamStoryboard provide a series of methods to help you instantiate view controllers by there storyboard ID. By default instantiateViewController() will search for view controller with the storyboard ID with the same name as the class.

import BothamUI

let mainStoryboard = BothamStoryboard(name: "Main")
let viewController: SampleViewController = mainStoryboard.instantiateViewController("SampleViewController")
let viewController: SampleViewController = mainStoryboard.instantiateViewController()

Presenter

To follow the MVP pattern, BothamUI also provides a BothamPresenter protocol that will be responsible for all your presentation logic. BothamUI will take care of linking your view (a BothamViewController) with your presenter and subscribing it to its lifecycle. In order to do that, create a class that implement BothamPresenter and link it to your view:

import BothamUI

class SamplePresenter: BothamPresenter {
    private weak var ui: SampleUI?

    init(ui: CharacterDetailUI) {
        self.ui = ui
    }
    
    func viewDidLoad() {
        /* ... */
    }
}
protocol SampleUI: BothamUI {
	/* ... */
}
class SampleViewController: BothamViewController, SampleUI {
    /*...*/
}

Dependency injection

BothamUI is built around the concept of dependency injection, all the dependencies are provided by constructor or properties, base on what UIKit allows us.

ViewController Instantiation

In the example a Service Locator is used in order to instantiate view controllers, but you can also use Swinject or others DI frameworks.

class ServiceLocator {

    static let sharedInstance = ServiceLocator()

    func provideSampleViewController() -> SampleViewController {
        let viewController: SampleViewController = provideMainStoryboard().viewController()
        viewController.presenter = SamplePresenter(ui: viewController)
        return viewController
    }
}

Lifecycle

Once both, view and presenter, are linked you can react to your view lifecycle directly from the presenter. You will be also able to call your view easily from the presenter:

class SamplePresenter: BothamPresenter {
    private weak var ui: SampleUI?

    init(ui: CharacterDetailUI) {
        self.ui = ui
    }
    
    func viewDidLoad() {
        self.ui?.showMessage("Welcome to Botham")
    }
}

To understand when the lifecycle methods are called take a look at the following table:

BothamPresenter UIViewController
viewDidLoad viewDidLoad
viewWillAppear viewWillAppear
viewDidAppear viewDidAppear
viewWillDisappear viewWillDisappear
viewDidDisappear viewDidDisappear

Caveats

  • ViewControllers instantiated view UIStoryboard, can't reference Generic Type.
  • Presenter and ViewController have a circular reference (like a ViewController and Datasource).

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 0.39.0+ is required to build BothamUI.

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

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'BothamUI', '~> 1.0'

Then, run the following command:

$ pod install

Do you want to contribute?

Feel free to report us or add any useful feature to the library, we will be glad to improve it with your help.

Keep in mind that your PRs must be validated by Travis-CI.

License

Copyright 2015 Karumi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the 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].