Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iosdc_2017.pdf

Kyohei Ito
September 17, 2017
830

 iosdc_2017.pdf

Kyohei Ito

September 17, 2017
Tweet

Transcript

  1. let list: [String] = ["1", "2", "3", "4", "5"] func

    collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return list.count * 2 } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! CollectionViewCell cell.label.text = list[indexPath.item % list.count] return cell }
  2. viewModel.currentContent .debounce(0.1, scheduler: MainScheduler.instance) .do(onNext: { [weak self] slot in

    guard let me = self else { return } me.timeLabel.text = "00" me.titleLabel.attributedText = "Title" me.detailLabel.text = "Detail" }) .subscribe(onNext: { [weak self] content in guard let me = self else { return } me.titleLabel.invalidateIntrinsicContentSize() me.detailLabel.invalidateIntrinsicContentSize() me.layoutIfNeeded() }) .disposed(by: disposeBag)