Giter Site home page Giter Site logo

boa's Introduction

Boa

Boa is a sample weather application using Cobra, Gorgon and Moccasin, written in Swift.

BoaGif

Bootstrapping

Cobra works by bootstrapping component frameworks, property files, and application modules on application launch, like so:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    logDebug("Application starting...")
    
    //
    // STEP 1
    // Enabling debug logging for frameworks. You shouldn't enable logging in production
    //
    Gorgon.Log.enableDebugging = true
    Cobra.Log.enableDebugging = true
    
    //
    // STEP 2
    // Create a Cobra configuration for assembling the components and properties for the application
    //
    let config = Config(components: [
        Component<DaemonAssembly>(),
        Component<ServiceAssembly>()
    ], properties: [
        JsonProperty(name: "properties")
    ])
    
    //
    // STEP 3
    // Provide the configuration to the Cobra application
    //
    try! App.sharedInstance.config(config)

    //
    // STEP 4
    // Register Feature to Module proxies for the Cobra application routes
    //
    App.sharedInstance.registerProxies([
        Proxy<AddCityFeatureType>(modules: Module<AddCityAssembly>()),
        Proxy<WeatherFeatureType>(modules: Module<WeatherAssembly>()),
        Proxy<WeatherDetailFeatureType>(modules: Module<WeatherDetailAssembly>())
    ])
    
    //
    // STEP 5
    // Route to our first feature in our application window
    //
    try! App.sharedInstance.feature(WeatherFeatureType.self).showInWindow(window!)
    return true
}

VIPER Modules

The Weather application code consists of three VIPER-based modules: WeatherDetail, AddCity, and Weather. These correlate to respective screens the user sees in the application (Weather being the main screen). Using Moccasin, VIPER scaffolding for each of these modules were generated via Xcode templates.

TODO

  • Connect to web service to get real-time weather information.
  • Add persistence
  • Finish add city feature

boa's People

Contributors

eelyroc avatar ernestma avatar gasthana0 avatar

Stargazers

86 avatar Haitao Xia avatar  avatar

Watchers

Srikalyan Swayampakula avatar  avatar James Cloos avatar Todd Hodes avatar Ryan West avatar Choongil Fleischman avatar Brian Martin avatar  avatar Mike Owens avatar consultsri avatar Joe Anakata avatar  avatar

boa's Issues

Error in example app

In Boa/Modules/WeatherDetail/WeatherPageViewController.swift,
there's an error in the code snippet on line number 109:

extension WeatherPageViewController {
    fileprivate func initViewControllers() {
        let weatherDetailStoryboard = UIStoryboard(name: "WeatherDetail", bundle: nil)
        
        orderedWeatherDetailViewControllers = weatherReports.map {
            let weatherDetailVC = weatherDetailStoryboard.instantiateViewController(withIdentifier: "WeatherDetail") as! WeatherDetailViewController
            weatherDetailVC.weatherReport = $0
            weatherDetailVC.styler = styler
            return weatherDetailVC
        }
    }
}

There should be used ? or ! in order to apply correct method, which returns [T] instead of just returning optional type U? for example. I think it is a result of compiler changes explained here:
https://swift.org/blog/iuo/

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.