Giter Site home page Giter Site logo

archi4swift's Introduction

Archi4Swift

A simple architecture of apple new develop language ----------======[ !? Swift ?! ]======----------

The architecture has many modules in future,but now it only has the HttpEngine and SuperDataSevice.

HttpEngine

Super clear function name to package the NSURLConnection class. To send http request, such as:

HttpEngine("http://example.json")
    .fly(.POST, ["key":"value"], ["key":"value"])
    .completed { success, error, result in
        //Your process result code.
}

Yeah,it's so simple.

SuperDataService

It's a business layer service for the ViewController which need the data from the server, it also call the http engine to get data,so why call it super ? Because it supply the single line fetch data way. In this way, the architeture is pure, the next you will develop only the request args and result parser, you could't care the how the way of get data from server. ...... it's simple,such as:

var args = WeatherParamArgs(cityId:cityId)
var parser = WeatherParser()   

SuperDataService()
	.fetch(args)
	.nextParse(parser)
	.done { success, error, result in
    	if(success) {
        	var info:WeatherInfo = result as WeatherInfo
        	println("weatherinfo city---- \(info.city!) --- week --- \(info.week)")
    	} else {
        	println("error city id : \(cityId)")
    	}
	}

Contributing

  • I am happy to receive any pull requests, and you will say any suggestion of swift in here. let's do it!
  • Any issue is appreciated.

Next

  • 1.Complete the architecture to the swift grammar
  • 2.Binding
  • 2.Swift operation queue
  • 3.Errorsystem
  • 4.Write a project use this architecture

License

MIT

archi4swift's People

Watchers

Qiang avatar  avatar

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.