Skip to content

Super awesome + simple layouts for iOS applications views written in JSON

License

Notifications You must be signed in to change notification settings

wiresurfer/layout_dexter

Repository files navigation

Layout Dexter

Layout as API endpoints! Your backend returns formatted layout. Your App just renders them! Dynamic, customizable and super-quick to build.

Key Features

  • Layouts specified in JSON
  • Can work with local and remote layout files
  • Hot UI/UX Push : Inject layouts post builds
    • Hot pushes from remote services/API
    • eg. List view being returned as JSON from a feeds API?!
  • Subset of UIElements supported
  • TODO: Add more comprehensive support
  • TODO: Add support for interactions/events
  • TODO: Add thorough parse checking
  • TODO: Add extensions for user defined parsers for JSON properties/classnames
  • TODO: Add support for advanced text layouting into multiple columns using CoreText

Usage

Add SBDynamicLayoutView.h/SBDynamicLayoutView.m to your project and #include them in the ViewController you want to add the layouts too.

    SBDynamicLayoutView* dynamicLayout = [[SBDynamicLayoutView alloc] initWithFrame:self.view.bounds];
    NSString* path = [[NSBundle mainBundle] pathForResource:@"layout" ofType:@"json"];
    NSData* response =[[NSMutableData alloc] initWithContentsOfFile:path];
    [dynamicLayout initWithJson:[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableLeaves error:Nil]];
    [self.view addSubview: dynamicLayout];

Take a look at layout.json for a simple layout

Note the use of children_remote to refer to a JSON file on a remote URL.

About Layout Dexter

Layout Dexter is based on a dinner table discussion and some hacking around. The code is more of a proof of concept. I would be spending roughly the period of the holidays to make this a bit more polished/usable. Contributions welcome.

Disclaimers: This was whipped up in roughly an hour. So its fairly primitive. Objective-C is not my first langugage and I would love to hear from the "gurus" about what are better ways of achieving this. More importantly I want to know if doing such a thing(json for layouts/ remote layouts changing vies) even makes remote sense. Then there are Questions about whether this kind of code is acceptable from an Appstore Certification point of view.

For any feedback/query/suggestions/rants: kr.shaishav@gmail.com. Subject Prefix: "layout_dexter:"

About

Super awesome + simple layouts for iOS applications views written in JSON

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published