Ruby on Rails-style development comes to Apple’s Swift

Ngoc Huynh

The Swifton framework shares the model-view-controller development pattern with Rails.

Apple’s trendy Swift language is getting a Web framework inspired by the popular Ruby on Rails MVC framework.

Open source Swifton, running on Mac OS X and Linux, is in an early stage of development. But it’s already picking up traction, attractibg more than 1,200 stargazers on GitHub within a couple of days of its release this week, said Swifton’s main developer, Saulius Grigaitis, founder and CTO of Ruby on Rails and Swift consulting firm Necolt.

Swifton shares the model-view-controller development pattern with Rails. For the model aspect of the framework, Swifton is ORM-agnostic. “Swifton comes with simple in-memory MemoryModel class that you can inherit and use for your apps,” Swifton’s Github documentation states. Similar to Rails, Swifton features an ApplicationController class. A controller in Swifton inherits from ApplicationController, which in turn inherits from the Controller class.

For views, Swifton backs Mustache-like templates via the Stencil template language. The view is rendered with controller’s method render(template_path, object), according to documentation. Views are loaded from the views directory by default, with developers able to change the default setting. “Currently, views are not cached, so you don’t need to restart server or recompile after views are changed,” the GitHub page notes.

Swifton is offered via an MIT license, supports JSON, and features the Currasow server, a Swift Nest HTTP server. The framework also comes with a router, although developers can use other routers. Use of Swifton requires installing the latest development snapshot of Swift from or swiftenv.

Share the news now

Source :