GithubHelp home page GithubHelp logo

isabella232 / bohr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sumi-interactive/bohr

0.0 0.0 0.0 9.91 MB

Settings screen composing framework

License: MIT License

Ruby 0.99% Objective-C 99.01%

bohr's Introduction

Header

Bohr allows you to set up a settings screen for your app with three principles in mind: ease, customization and extensibility.

GIF 1

By default, Bohr supports multiple setting types such as strings, booleans or times. However, this framework has been built with extensibility in mind, meaning you can build your own custom classes to support any kind of setting type you want.

Why "Bohr"?

"Bohr" comes from Niels Bohr, conceiver of an atomic model which introduces the concept of electronic configuration, a way to organize electrons by layers around the atom nucleus.

True story.

Installation

Carthage

github "DavdRoman/Bohr"

CocoaPods

pod 'Bohr'

Manual

Drag and copy all files in the Bohr folder into your project.

At a glance

Basic setup

The settings screen you're going to set up is represented by a UITableViewController subclass called BOTableViewController. Such controller manages BOTableViewSection instances, and each one of those manages a set of BOTableViewCell instances.

Here's an example of a really simple setup included in the demo project. Please check it out to see the full implementation. Please notice the code below belongs inside the setup method of a subclassed BOTableViewController.

- (void)setup {
	[self addSection:[BOTableViewSection sectionWithHeaderTitle:@"Section 1" handler:^(BOTableViewSection *section) {
		[section addCell:[BOSwitchTableViewCell cellWithTitle:@"Switch 1" key:@"bool_1" handler:nil]];
	}]];
}

Built-in BOTableViewCell's

There's a bunch of built-in BOTableViewCell subclasses ready to be used:

  • BOSwitchTableViewCell: manages BOOL values through a UISwitch control.
  • BOTextTableViewCell: manages NSString values through a UITextField control.
  • BONumberTableViewCell: manages NSNumber values through a UITextField control.
  • BODateTableViewCell: manages NSDate values representing a certain date. A revealing UIDatePicker is used to set the time.
  • BOTimeTableViewCell: manages NSDate values representing a certain time. A revealing UIDatePicker is used to set the time.
  • BOChoiceTableViewCell: manages NSInteger values (which you can understand as "options" from a NS_ENUM) through taps on the cell itself.
  • BOOptionTableViewCell: manages a single NSInteger value (which you can understand as an "option" from a NS_ENUM) depending on its position in its table view section. When selected, a checkmark appears on the right side.
  • BOButtonTableViewCell: allows the user to perform an action when the cell is tapped.

Subclassing BOTableViewCell

Building a BOTableViewCell subclass is fairly straightforward.

First of all, the framework contains a header file called BOTableViewCell+Subclass.h. You must import that header in your subclass implementation file:

#import <Bohr/BOTableViewCell+Subclass.h>

That way you'll be able to access all the possible elements for you to implement in your subclass.

Please take a look to some of the built-in cells for a more detailed demonstration on how to subclass BOTableViewCell.

License

Bohr is available under the MIT license.

bohr's People

Contributors

kyoji2 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.