Comments (9)
Yeah this has been an idea I've had from the beginning. I'd like to discuss with you what the best approach would be.
Let's start off by discussing a simple problem: should "optional" cells depend only on boolean setting values (BOSwitchTableViewCell)? That'd simplify a lot of work, but I'm not sure about the limitations that such decision could impose.
from bohr.
Generally speaking, I've seen only bool-dependent examples in real life. However, I can imagine a case where UI should be updated when you select one of enum options in child settings view controller: returning to my example with endpoints, if you select development
endpoint from list of options, the settings should show more switches/settings.
from bohr.
my original idea was to add optional block as a parameter to cell constructor, like
cell = [BOTableViewCell key:"foo" .... visibleIf: ^ (Settings *settings) {
\\query settings object if they meet particular condition
return settings["endpoint"] == "development";
}]
and also some kind of property to each cell, like forcesReload
(NO
by default), so changing cell with this property set to YES
is going to reload whole table and reevaluate visibleIf
condition
from bohr.
@garnett that sounds super clever. I'm definitely into that method ๐
We could make it even more magical if we found a way to automatically determine if reloading is necessary or not depending on which setting each cell depends on. I'll think about a way to achieve that.
from bohr.
I can think of a visibilityKey
property along with a visibilityBlock
property passed to the right cell when its visibilityKey
changes. That way, if there's a value change for that visibilityKey
, we would immediately know we need to reload the table.
Also, as in most cases a cell won't need dynamic visibility, I wouldn't put anything related to it in the init method, but rather let the developer change it in the handler
block.
from bohr.
Sounds good!
from bohr.
Hey there! I finally got some time to implement this feature and I think it's turned out pretty well. Check it out!
from bohr.
@davdroman looks exactly how I imagined it, ๐
from bohr.
Terrific! I'll adjust a couple little things and it'll be ready for release!
from bohr.
Related Issues (20)
- Can't set UISwitch on property HOT 1
- Swifty Bohr HOT 3
- ValueDidChange in BOSetting HOT 2
- BOStepperTableViewCell.h missing HOT 1
- Small Animation Issue HOT 3
- Adding an image to the cell HOT 2
- Add support for disabling / enabling a cell. HOT 1
- Add an option to change the BOTableViewSection appearance HOT 1
- [self bo_setFont:font] โ -[__NSCFNumber length]: unrecognized selector HOT 2
- change cell text - question HOT 6
- Valid number of numberOfDecimals not working HOT 3
- change the font of sections and cells HOT 1
- title disappear after click on BOButtonTableViewCell HOT 2
- accessing text values of all cells HOT 2
- Label and Text fields are not properly aligned
- my friend, i need one cell with image at the right side to show the user's avatar๏ผhow should i do it ??
- Using pod version 1.1.1 Bohr.h header has path issues
- Cell with icon on the left side
- BOChoiceTableViewCell has no member optionValues
- Method possibly missing a [super awakeFromNib] call
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bohr.