我正在尝试创建一个调度程序来消耗一些数据。
调度程序必须能够:
我用一个模型模拟了手动消耗MutableProperty
let consume = MutableProperty<Void>()
Run Code Online (Sandbox Code Playgroud)
我正在尝试用一个模型来模拟自动消耗SignalProducer
let timer = SignalProducer<Void, NoError>
Run Code Online (Sandbox Code Playgroud)
我可以通过组合这两个生产者的最新值来第一次需要使用该数据,例如
SignalProducer.combineLatest(consume.producer, timer)
.take(first: 1)
.map() { _ in return () }
Run Code Online (Sandbox Code Playgroud)
这样,无论哪个先发生,生产者都会发送一个值,无论是手动消耗还是自动消耗。
我不知道我怎样才能永远做到这一点。
有人可以帮忙吗?
我一直在搜索很多,但没有发现任何与多个自定义行有关的内容,我需要为我的应用程序创建一个设置tableView,其中我需要从xib文件加载行,如:
ROW 1 = >> XIB 1.
ROW 2 = >> XIB 2.
ROW 3 = >> XIB 3.
ROW 4 = >> XIB 4.
我现在的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell=nil;
//We use CellType1 xib for certain rows
if(indexPath.row==0){
static NSString *CellIdentifier = @"ACell";
cell =(ACell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell==nil){
NSArray *nib= [[NSBundle mainBundle] loadNibNamed:@"ACell" owner:self options:nil];
cell = (ACell *)[nib objectAtIndex:0];
}
//Custom cell with whatever
//[cell.customLabelA setText:@"myText"]
}
//We use CellType2 xib for other rows …Run Code Online (Sandbox Code Playgroud)