2017-04-15 6 views
0

ダイナミックラベルの高さと動的行の高さには、次のコードでReactive CocoaまたはRxSwiftを使用する必要があります。ReactiveCocoaを迅速に使用できますか?

Reactive CocoaをSwift3で使用できますか? ReactiveCocoaとRxSwiftの違いは何ですか?

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 
    let cell: BTSTableViewCell = self.tableView.dequeueReusableCell(withIdentifier: "BTSTableViewCellIdentifier")! as! BTSTableViewCell 

    cell.configureWithPost(posts[indexPath.row]) 
    cell.delegate = self 
    return cell 

} 
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 

    // 259.5+ labelHeight+ bigImageHeight 

    let postViewModel = posts[indexPath.row] 

    //caption height 
    var captionHeight = postViewModel.textDetail?.height(withConstrainedWidth: tableView.bounds.size.width - 20, font: UIFont.systemFont(ofSize: 17)) 

    captionHeight = ceil(captionHeight!) 

    var finalCaptionHeight: CGFloat = 0.0; 

    if postViewModel.showDetailedCaption { 
     finalCaptionHeight = captionHeight! 
    } 
    else { 
     finalCaptionHeight = min(41, captionHeight!) 
    } 
    return 259.5 + postViewModel.getBigImageHeightFor(tableView.bounds.size.width) + finalCaptionHeight 

} 
+0

@Peresはあなたの質問に答えますが、どうしてあなたは「動的なラベルの高さと動的な行の高さに対してReactive CocoaまたはRxSwift [...]を使用する必要があると思いますか? –

+0

@Sebastian実際、私はそれが私の必要条件なので、私はそれを使用する必要があります。 – Bharath

答えて

2

私は反応ココアはSwift3に使用することはできますか?

はいできます。プロジェクトはlocated hereです。実際の「エンジン」はReactiveSwiftですが、ReactiveCocoaにはUIバインディングしかないことに注意することが重要です。

ReactiveCocoaとRxSwiftの違いは何ですか?

比較hereを見つけることができます。しかし、ボトムラインは、どちらも2つの非常に有能なフレームワークです。あなたはあなたが選ぶものとは別にそれを間違って取得することはありません。

+0

ありがとうございます。上記のコードをRxSwiftに変換するのを手伝ってもらえますか? – Bharath

+1

@Bharathあなたの質問の範囲外です。この回答を修正したものと記して(あなたがそうだと思うなら)、新しい質問を開きます。 – Peres

関連する問題