This repository has been archived by the owner on Aug 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f46e2ec
Showing
57 changed files
with
2,235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Xcode | ||
.DS_Store | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
*.xcworkspace | ||
!default.xcworkspace | ||
xcuserdata | ||
profile | ||
*.moved-aside | ||
DerivedData | ||
.idea/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Pod::Spec.new do |s| | ||
s.name = "Bohr" | ||
s.version = "1.0.0" | ||
s.summary = "Settings screen composing framework" | ||
s.homepage = "https://github.com/Dromaguirre/Bohr" | ||
s.author = { "David Roman" => "[email protected]" } | ||
s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
|
||
s.platform = :ios, '8.0' | ||
s.ios.deployment_target = '8.0' | ||
|
||
s.source = { :git => "https://github.com/Dromaguirre/Bohr.git", :tag => s.version.to_s } | ||
s.source_files = 'Bohr/*.{h,m}' | ||
s.frameworks = 'Foundation', 'UIKit' | ||
s.requires_arc = true | ||
end |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0630" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "75C7ADFE1B1AB3280050C8AA" | ||
BuildableName = "Bohr.framework" | ||
BlueprintName = "Bohr" | ||
ReferencedContainer = "container:Bohr.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
buildConfiguration = "Debug"> | ||
<Testables> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Debug" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
allowLocationSimulation = "YES"> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "75C7ADFE1B1AB3280050C8AA" | ||
BuildableName = "Bohr.framework" | ||
BlueprintName = "Bohr" | ||
ReferencedContainer = "container:Bohr.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Release" | ||
debugDocumentVersioning = "YES"> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "75C7ADFE1B1AB3280050C8AA" | ||
BuildableName = "Bohr.framework" | ||
BlueprintName = "Bohr" | ||
ReferencedContainer = "container:Bohr.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// BOButtonTableViewCell.h | ||
// Bohr | ||
// | ||
// Created by David Román Aguirre on 4/6/15. | ||
// Copyright (c) 2015 David Roman. All rights reserved. | ||
// | ||
|
||
#import "BOTableViewCell.h" | ||
|
||
@interface BOButtonTableViewCell : BOTableViewCell | ||
|
||
+ (instancetype)cellWithTitle:(NSString *)title didTriggerBlock:(void (^)(void))didTriggerBlock; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// BOButtonTableViewCell.m | ||
// Bohr | ||
// | ||
// Created by David Román Aguirre on 4/6/15. | ||
// Copyright (c) 2015 David Roman. All rights reserved. | ||
// | ||
|
||
#import "BOButtonTableViewCell.h" | ||
|
||
#import "BOTableViewCell+Subclass.h" | ||
|
||
@interface BOButtonTableViewCell () | ||
|
||
@property (nonatomic, copy) void(^didTriggerBlock)(void); | ||
|
||
@end | ||
|
||
@implementation BOButtonTableViewCell | ||
|
||
+ (instancetype)cellWithTitle:(NSString *)title didTriggerBlock:(void (^)(void))didTriggerBlock { | ||
BOButtonTableViewCell *cell = [super cellWithTitle:title setting:nil]; | ||
cell.didTriggerBlock = didTriggerBlock; | ||
return cell; | ||
} | ||
|
||
- (void)setup { | ||
self.selectionStyle = UITableViewCellSelectionStyleDefault; | ||
self.textLabel.textAlignment = NSTextAlignmentCenter; | ||
} | ||
|
||
- (void)wasSelectedFromViewController:(BOTableViewController *)viewController { | ||
[super wasSelectedFromViewController:viewController]; | ||
if (self.didTriggerBlock) self.didTriggerBlock(); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// BOChoiceTableViewCell.h | ||
// Bohr | ||
// | ||
// Created by David Román Aguirre on 4/6/15. | ||
// Copyright (c) 2015 David Roman. All rights reserved. | ||
// | ||
|
||
#import "BOTableViewCell.h" | ||
|
||
@interface BOChoiceTableViewCell : BOTableViewCell | ||
|
||
+ (instancetype)cellWithTitle:(NSString *)title setting:(BOSetting *)setting options:(NSArray *)options; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// BOChoiceTableViewCell.m | ||
// Bohr | ||
// | ||
// Created by David Román Aguirre on 4/6/15. | ||
// Copyright (c) 2015 David Roman. All rights reserved. | ||
// | ||
|
||
#import "BOChoiceTableViewCell.h" | ||
|
||
#import "BOTableViewCell+Subclass.h" | ||
|
||
@interface BOChoiceTableViewCell () | ||
|
||
@property (nonatomic, strong) NSArray *options; | ||
|
||
@end | ||
|
||
@implementation BOChoiceTableViewCell | ||
|
||
+ (instancetype)cellWithTitle:(NSString *)title setting:(BOSetting *)setting options:(NSArray *)options { | ||
BOChoiceTableViewCell *cell = [super cellWithTitle:title setting:setting]; | ||
cell.options = options; | ||
return cell; | ||
} | ||
|
||
- (void)setup { | ||
self.selectionStyle = UITableViewCellSelectionStyleDefault; | ||
} | ||
|
||
- (void)wasSelectedFromViewController:(BOTableViewController *)viewController { | ||
[super wasSelectedFromViewController:viewController]; | ||
|
||
NSInteger currentOption = [self.setting.value integerValue]; | ||
|
||
if (currentOption < self.options.count-1) { | ||
self.setting.value = @(currentOption+1); | ||
} else { | ||
self.setting.value = @0; | ||
} | ||
} | ||
|
||
- (void)settingValueDidChange { | ||
self.detailTextLabel.text = self.options[[self.setting.value integerValue]]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// BODisclosureTableViewCell.h | ||
// Bohr | ||
// | ||
// Created by David Román Aguirre on 4/6/15. | ||
// Copyright (c) 2015 David Roman. All rights reserved. | ||
// | ||
|
||
#import "BOTableViewCell.h" | ||
|
||
@interface BODisclosureTableViewCell : BOTableViewCell | ||
|
||
+ (instancetype)cellWithTitle:(NSString *)title destinationViewController:(UIViewController *)destinationViewController; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// BODisclosureTableViewCell.m | ||
// Bohr | ||
// | ||
// Created by David Román Aguirre on 4/6/15. | ||
// Copyright (c) 2015 David Roman. All rights reserved. | ||
// | ||
|
||
#import "BODisclosureTableViewCell.h" | ||
|
||
#import "BOTableViewCell+Subclass.h" | ||
|
||
@interface BODisclosureTableViewCell () | ||
|
||
@property (nonatomic, strong) UIViewController *destinationViewController; | ||
|
||
@end | ||
|
||
@implementation BODisclosureTableViewCell | ||
|
||
+ (instancetype)cellWithTitle:(NSString *)title destinationViewController:(UIViewController *)destinationViewController { | ||
BODisclosureTableViewCell *cell = [super cellWithTitle:title setting:nil]; | ||
cell.destinationViewController = destinationViewController; | ||
return cell; | ||
} | ||
|
||
- (void)setup { | ||
self.selectionStyle = UITableViewCellSelectionStyleDefault; | ||
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator; | ||
} | ||
|
||
- (void)wasSelectedFromViewController:(BOTableViewController *)viewController { | ||
[super wasSelectedFromViewController:viewController]; | ||
[viewController.navigationController pushViewController:self.destinationViewController animated:YES]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// BOSetting+Private.h | ||
// Bohr | ||
// | ||
// Created by David Román Aguirre on 4/6/15. | ||
// Copyright (c) 2015 David Roman. All rights reserved. | ||
// | ||
|
||
#import "BOSetting.h" | ||
|
||
@interface BOSetting () | ||
|
||
typedef void(^BOSettingValueDidChangeBlock)(void); | ||
|
||
@property (nonatomic, copy) BOSettingValueDidChangeBlock valueDidChangeBlock; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// BOSetting.h | ||
// BOSettings | ||
// | ||
// Created by David Román Aguirre on 31/5/15. | ||
// Copyright (c) 2015 David Roman. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface BOSetting : NSObject | ||
|
||
@property (nonatomic, readonly) NSString *key; | ||
@property (nonatomic, assign) id value; | ||
|
||
+ (instancetype)settingWithDefaultValue:(id)defaultValue forKey:(NSString *)key; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// BOSetting.m | ||
// BOSettings | ||
// | ||
// Created by David Román Aguirre on 31/5/15. | ||
// Copyright (c) 2015 David Roman. All rights reserved. | ||
// | ||
|
||
#import "BOSetting+Private.h" | ||
|
||
@implementation BOSetting | ||
|
||
+ (instancetype)settingWithDefaultValue:(id)defaultValue forKey:(NSString *)key { | ||
return [[self alloc] initWithDefaultValue:defaultValue forKey:key]; | ||
} | ||
|
||
- (instancetype)initWithDefaultValue:(id)defaultValue forKey:(NSString *)key { | ||
if (self = [super init]) { | ||
_key = key; | ||
[[NSUserDefaults standardUserDefaults] registerDefaults:@{self.key: defaultValue}]; | ||
[[NSUserDefaults standardUserDefaults] addObserver:self forKeyPath:self.key options:NSKeyValueObservingOptionNew context:nil]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { | ||
self.value = change[@"new"]; | ||
if (self.valueDidChangeBlock) self.valueDidChangeBlock(); | ||
} | ||
|
||
- (id)value { | ||
return [[NSUserDefaults standardUserDefaults] objectForKey:self.key]; | ||
} | ||
|
||
- (void)setValue:(id)value { | ||
if (self.value != value) { | ||
[[NSUserDefaults standardUserDefaults] setObject:value forKey:self.key]; | ||
} | ||
} | ||
|
||
- (void)dealloc { | ||
[[NSUserDefaults standardUserDefaults] removeObserver:self forKeyPath:self.key]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// BOSwitchTableViewCell.h | ||
// Bohr | ||
// | ||
// Created by David Román Aguirre on 4/6/15. | ||
// Copyright (c) 2015 David Roman. All rights reserved. | ||
// | ||
|
||
#import "BOTableViewCell.h" | ||
|
||
@interface BOSwitchTableViewCell : BOTableViewCell | ||
|
||
@property (nonatomic, strong) UISwitch *toggleSwitch; | ||
|
||
@end |
Oops, something went wrong.