Settings screen composing framework

Related tags

Table View Bohr
Overview

THIS PROJECT IS NO LONGER MAINTAINED. HERE ARE SOME SUITABLE ALTERNATIVES:


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), by default depending on its position in its table view section but the setting value can be overridden. When selected, a checkmark appears on the right side.
  • BOButtonTableViewCell: allows the user to perform an action when the cell is tapped.
  • BOStepperTableViewCell: allows the user to change numeric values by tapping on a +- control.

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.

Comments
  • Support

    Support "dynamic" options

    Use case:

    1. There is a option called "Custom endpoint"
    2. Switching it to on uncovers one more option below: "URL"

    I have some ideas how implement that in a nice way, now I have a flag in my viewController:

            if (self.flag) {
                [section addCell:[BODateTableViewCell cellWithTitle:@"url" key:@"url" handler:nil]];
            }
    

    rebuilding list is done by:

    [self setup];
    [self.tableView reloadData];
    

    I have some ideas how to do it in more declarative way, and ready to discuss them if you think it's worthy to have this feature.

    enhancement 
    opened by delebedev 9
  • OptionTableViewCell : allow specific values so the cell's index is not used

    OptionTableViewCell : allow specific values so the cell's index is not used

    The current implementation of optionTableCell uses the cell's index as the setting value when it is selected.

    This makes it problematic to change the order of appearance of the settings as their indexes is used as the value and therefore the new cell at that index will be selected in the next release of the application.

    I suggest allowing the app to specify a string value for each option that can be used as the setting value when it is selected.

    Example:

    [self.boTableViewController addSection:[BOTableViewSection sectionWithHeaderTitle:@"favorite color" handler:^(BOTableViewSection *section) {
        [section addCell:[BOOptionTableViewCell cellWithTitle:@"Orange" key:@"favcolor" handler:^(BOOptionTableViewCell *cell) {
            cell.value = @"orange";
        }]];
        [section addCell:[BOOptionTableViewCell cellWithTitle:@"Red" key:@"favcolor" handler:^(BOOptionTableViewCell *cell) {
            cell.value = @"red";
        }]];
    }]];
    
    opened by gmoledina 7
  • Swift 2.0 and Xcode 7 Support?

    Swift 2.0 and Xcode 7 Support?

    Is swift supported and if so.. How do I go about using this control in my project? Could you update the "Read Me" or just answer here in this issue?

    enhancement 
    opened by RayanSaeed 7
  • [FEATURE] Number TextField

    [FEATURE] Number TextField

    Hi there!

    I'm working now with your library and I've come with a feature that could be an extension for BOTextViewCell which only accepts int numbers or decimal numbers on it. Do you think is viable? Or it's reachable with the current library?

    Regards!

    opened by minuscorp 7
  • change cell text - question

    change cell text - question

    So i have a BOButtonTableViewCell with Turn Passcode On when the user first open settings. When the user taps the button a lock view appears where he can enable a passcode for the app. When the lockview is dismissed and the user has set his desired passcode i want the text of the button to change to Turn Passcode Off

    is there any other way to achieve this besides keeping a reference of the cell and changing the title? i mean just reloading a simple cell thanks

    opened by mythodeia 6
  • ChoiceTableViewCell : allow specific setting values so the option's indexes aren't used

    ChoiceTableViewCell : allow specific setting values so the option's indexes aren't used

    Same concept as we had for the OptionTableViewCell - this allows specifying the setting value for each choice. Extremely useful when paired up with a separate destinationViewController as well.

    Thanks again for making this open source, it's working out very well for me !

    Also, would it be possible to tag a release after this PR is merged ?

    opened by gmoledina 6
  • Feature request: set static footer programmatically

    Feature request: set static footer programmatically

    Common thing on settings screens - to show version and build number in footer. This can't be done from storyboard, only in runtime, so I want property like defaultFooterTitle. It even can be configured for each section. So priorities for section footers will be: 1) storyboard 2) default from property 3) cells dynamic footers.

    Thanks!

    enhancement 
    opened by ealeksandrov 5
  • callback when choice is changed

    callback when choice is changed

    Hello and thanks for this great library. I was wondering if there is a way to know when a user changes a value in an BOChoiceTableViewCell cell. I haven't subclassed the cell so i am using the demo for now. So i want to be able to do something when i user changes his choice in the cell. can you help? thanks

    opened by mythodeia 4
  • [Feature] DatePickerCell

    [Feature] DatePickerCell

    Hi there!

    I really love your library, I think there're no resources like this apart from InAppSettingsKit and I really support your job.

    I just open the issue to let you know that a big feature to this awesome library would be to support DatePicker. I know this is easily extensible and I'll try to implement this feature after this week of holidays as I need it to my settings view.

    Keep It up and I'm really looking forward to your next release!

    opened by minuscorp 4
  • Expose subclassing header files

    Expose subclassing header files

    In order to be able to subclass BO-Cells properly when using the library as a framework (like for example with Carthage), the subclass-header files have to be public and added to the Bohr.h file

    Changes:

    • Changed visibilty of BOTableViewCell+Subclass.h, BOTextTableViewCell+Subclass.h and BOSetting.h to public
    • Added BOTableViewCell+Subclass.h and BOTextTableViewCell+Subclass.h to Bohr.h
    opened by Argent 3
  • Small Animation Issue

    Small Animation Issue

    in the demo project i added the following line between the 2 switches in the 1st section:

    [section addCell:[BOStepperTableViewCell cellWithTitle:@"Stepper" key:@"stepper" handler:nil]];
    

    Now if you try to change value of the 1st switch there is a small animation issue while the tableview is trying to animate switch 2 into the view.

    Same goes if i put the stepper as the 1st cell. if however i put the stepper as the 3rd cell (last one of 1st section) the animation works fine

    bug 
    opened by mythodeia 3
  • Method possibly missing a [super awakeFromNib] call

    Method possibly missing a [super awakeFromNib] call

    While building with Xcode 8.3.2, following compiler warning is received:

    .../Pods/Bohr/Bohr/BOTableViewController.m:54:1: Method possibly missing a [super awakeFromNib] call

    opened by martin072 0
  • Cell with icon on the left side

    Cell with icon on the left side

    Does it support adding an icon on the left side of the cell, similar to the iPhone settings ? or should i edit the source code so it supports adding an icon ?

    opened by Ahmad-Dari 0
  • Using pod version 1.1.1 Bohr.h header has path issues

    Using pod version 1.1.1 Bohr.h header has path issues

    Update cocoapods to 1.1.1 and pod 'Bohr', '3.0.0'

    Bohr will have path issues.

    need to remove subdirectory Bohr and use quotes

    #import "BOTableViewController.h"
    
    opened by icykey 0
  • Label and Text fields are not properly aligned

    Label and Text fields are not properly aligned

    The labels and fields in Section 2 of the demo app are not aligned. The accessory view is slightly misaligned on the Y axis. The blue text field should be moved down a couple of pixels, it seems:

    Issue Image

    opened by tciuro 0
  • title disappear after click on BOButtonTableViewCell

    title disappear after click on BOButtonTableViewCell

    I create a BOButtonTableViewCell and set destinationViewController for it, but after go the destination view controller and then go back to Bohr controller, the item's title disappears!

            [section addCell:[BOButtonTableViewCell cellWithTitle:@"Sample Text" key:nil handler:^(BOButtonTableViewCell *cell) {
                cell.mainFont = [UIFont fontWithName:FONT_MAIN size:18];
    
                SampleViewController *dvc = [[SampleViewController alloc] init];
                cell.destinationViewController = dvc;
    
            }]];
    

    Before: <img width="321"src="https://cloud.githubusercontent.com/assets/611607/13378298/30b7de66-de17-11e5-87cf-2e8b3148a30f.png">

    After:

    How to solve this issue?

    opened by novinfard 2
Releases(3.0.0)
  • 3.0.0(Sep 27, 2015)

    • iOS 9 support.
    • Dropped storyboard support in favor of programmatic support (as discussed in #8).
    • Added support for dynamic options.
    • BOTableViewCell subclasses now use native accessoryView cell property to show accessory views.
    • Added BODateTableViewCell class (thanks to @firecast from #7).
    • BOTimeTableViewCell is now a subclass of BODateTableViewCell.
    • Added expansionView property for BOTableViewCell subclasses to conveniently show an underlying view when pressed. You no longer need to take care of any auto layout business for this type of views on the cell (although you may need to specify a height for such view in expansionHeight method).
    • Added BONumberTableViewCell (thanks to @minuscorp from #15) and BOTextTableViewCell+Subclass.h, which allows for easy subclassing of BOTextTableViewCell.
    • And of course, A TON of bug fixes.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0-rc.2(Sep 25, 2015)

  • 3.0.0-rc.1(Sep 4, 2015)

  • 3.0.0-alpha.5(Sep 3, 2015)

  • 3.0.0-alpha.4(Sep 2, 2015)

    • Attempts to fix known layout issues.
    • Added BONumberTableViewCell (thanks to @minuscorp from #15) and BOTextTableViewCell+Subclass.h, which allows for easy subclassing of BOTextTableViewCell.
    • BOTextTableViewCell now automatically trims start and end whitespaces from input text.

    Please note

    • This version is intended only as a preview and may potentially break before a further, more stable release.
    • README.md will only be updated when a stable version is released.
    Source code(tar.gz)
    Source code(zip)
    Bohr.framework.zip(142.08 KB)
  • 3.0.0-alpha.3(Aug 29, 2015)

    • Fixed some layout issues, although device rotation is taking too long for some reason.

    Please note

    • This version is intended only as a preview and may potentially break before a further, more stable release.
    • README.md will only be updated when a stable version is released.
    Source code(tar.gz)
    Source code(zip)
    Bohr.framework.zip(131.30 KB)
  • 3.0.0-alpha.2(Aug 28, 2015)

    • Added BODateTableViewCell (thanks to @firecast from #7).
    • BOTimeTableViewCell is now a subclass of BODateTableViewCell.
    • Added expansionView property for BOTableViewCell subclasses to conveniently show an underlying view when pressed. You no longer need to take care of any auto layout business for this type of views on the cell (although you may need to specify a height for such view in expansionHeight method).

    Please note

    • This version is intended only as a preview and may potentially break before a further, more stable release.
    • README.md will only be updated when a stable version is released.
    Source code(tar.gz)
    Source code(zip)
    Bohr.framework.zip(131.38 KB)
  • 3.0.0-alpha.1(Aug 28, 2015)

    • Dropped storyboard support.
    • BOTableViewCell subclasses now use native accessoryView cell property to show accessory views.
    • Tries to address issues such as #8 and #11.

    Please note

    • This version is intended only as a preview and may potentially break before a further, more stable release.
    • README.md will only be updated when a stable version is released.
    Source code(tar.gz)
    Source code(zip)
    Bohr.framework.zip(125.69 KB)
  • 2.1.0(Jun 30, 2015)

  • 2.0.1(Jun 28, 2015)

  • 2.0.0(Jun 26, 2015)

    • Setting screens are now built with Interface Builder thanks to IBInspectable properties (bad thing IBDesignable isn’t compatible with UITableView cells yet).
    • Dynamic footer titles! Quite an amazing feature that adds up for a great setting screen.
    • Support for dismissing the keyboard through a tap or a swipe on the table view (fixing #2).
    • Fixed #1.
    Source code(tar.gz)
    Source code(zip)
    Bohr.framework.zip(102.65 KB)
  • 1.0.1(Jun 20, 2015)

Owner
David Roman
David Roman
A subclass of UITableView that styles it like Settings.app on iPad

TORoundedTableView As of iOS 13, Apple has released an official version of this table view style called UITableViewStyleInsetGrouped! Yay! In order to

Tim Oliver 162 Nov 2, 2022
Framework to help you better manage UITableViews

UITableView made simple ?? Main Features ?? Skip the UITableViewDataSource & UITableViewDelegate boilerplate and get right to building your UITableVie

null 84 Feb 4, 2022
This framework allows you to build Table views using UIKit with syntax similar to SwiftUI

This framework allows you to build Table views using UIKit with syntax similar to SwiftUI

Fun 60 Dec 17, 2022
This iOS framework allows settings to be in-app in addition to or instead of being in the Settings app.

InAppSettingsKit InAppSettingsKit (IASK) is an open source framework to easily add in-app settings to your iOS or Catalyst apps. Normally iOS apps use

Ortwin Gentz, FutureTap 3.1k Jan 2, 2023
This "Calculator" application is a simple one screen design of calculator screen i have made this single screen design application just to practice AutoLayout concepts.

Calculator Layout This "Calculator" application is a simple one screen design of calculator screen i have made this single screen design application j

Chetan Parate 1 Oct 29, 2021
FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.

SWIFT OBJECTIVE-C FSPagerView is an elegant Screen Slide Library implemented primarily with UICollectionView. It is extremely helpful for making Banne

Wenchao Ding 6.7k Jan 2, 2023
Login screen - Sample screen created for job application

LoginDemo Login app screen Evaluation of coding skills for job application We wo

Juan Carlos Pazos 6 Jul 11, 2022
Login-screen-UI - A simple iOS login screen written in Swift 5

This project has been updated to Swift 5 and Xcode 11.2 About This is a simple i

Kushal Shingote 2 Feb 4, 2022
Enables you to hide ur UIViews and make them screen/screen shot proof. objective c/c++ only

SecureView Enables you to hide ur UIViews and make them screen/screen shot proof. objective c/c++ only Usage UIWindow* mainWindow; - (void) setup {

Red16 6 Oct 13, 2022
SPLarkController - Custom transition between controllers. Settings controller for your iOS app.

SPLarkController About Transition between controllers to top. You can change animatable height after presentation controller. For presentation and dis

Ivan Vorobei 965 Dec 17, 2022
Dedicated settings app for accessing tweaks preference bundles.

Tweak Settings A dedicated settings app for tweak preferences Author Dana Buehre (CreatureSurvive) [email protected] © Dana Buehre (CreatureSurviv

Dana Buehre 29 Dec 19, 2022
A silly CLI for replacing macosx.internal SDK settings in .xcodeproj files with macosx

fix-macos-internal-sdk A silly CLI for replacing macosx.internal SDK settings in .xcodeproj files with macosx.

Keith Smiley 14 Dec 6, 2022
Log every incoming notification to view them again later, also includes attachments and advanced settings to configure

Vē Natively integrated notification logger Installation Add this repository to your package manager

alexandra 43 Dec 25, 2022
A TimeZonePicker UIViewController similar to the iOS Settings app. Search and select from a range of cities and countries to find your most suitable time zone.

TimeZonePicker A TimeZonePicker UIViewController similar to the iOS Settings app. Search and select from a range of cities and countries to find your

Gligor Kotushevski 125 Dec 13, 2022
Intuitive cycling tracker app for iOS built with SwiftUI using Xcode. Features live route tracking, live metrics, storage of past cycling routes and many customization settings.

GoCycling Available on the iOS App Store https://apps.apple.com/app/go-cycling/id1565861313 App Icon About Go Cycling is a cycling tracker app built e

Anthony Hopkins 64 Dec 19, 2022
Custom transition between controllers. Settings controller for your iOS app.

SPLarkController About Transition between controllers to top. You can change animatable height after presentation controller. For presentation and dis

Ivan Vorobei 965 Dec 17, 2022
Swift library that makes easier to serialize the user's preferences (app's settings) with system User Defaults or Property List file on disk.

PersistentStorageSerializable PersistentStorageSerializable is a protocol for automatic serialization and deserialization of Swift class, struct or NS

Ivan Rublev 163 Jun 3, 2021
Reusable & customizable SwiftUI settings sheet as a Swift package

PackAPrefPane Reusable & customizable SwiftUI settings sheet as a Swift package Features Swift package 100% Swift 99% SwiftUI Simple design Lightweigh

W1W1-M 9 Nov 6, 2022
Sideload iOS apps regardless of security settings

m1-ios-sideloader Sideload iOS apps regardless of security settings Notes Does not support encrypted IPAs at this time - you can grab decrypted IPAs w

Eric Rabil 20 Dec 4, 2022
Content Hugging Priority settings using Auto Layout

AutoLayoutContentHugging Swift 5 and Xcode 12. Content Hugging Priority settings using Auto Layout. Content Hugging Priority give you granular control

Camila Rodrigues 0 Jan 21, 2022