Created
April 17, 2017 15:29
-
-
Save MylesCaley/d6257386fc8e1cbdc8417ca46a4e89dd to your computer and use it in GitHub Desktop.
RxDataSources - get data
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
func collectionView(_ collectionView: UICollectionView, heightForAnnotationAtIndexPath indexPath: IndexPath, withWidth width: CGFloat) -> CGFloat { | |
let x = dataSource?[indexPath] | |
let font = UIFont(name: "OpenSans", size: 11)! | |
let rect = NSString(string: x?.brief ?? "").boundingRect(with: CGSize(width: width, height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, attributes: [NSFontAttributeName: font], context: nil) | |
// if multiple types | |
// var height = 400 | |
// | |
// switch x! { | |
// case let .feedUpdateSectionItem(item): | |
// if item.prototypeUpdate?.media.first != nil { | |
// height = 403 | |
// } else { | |
// height = 203 | |
// } | |
// case let .feedProjectSectionItem(item): | |
// if item.prototype?.media != nil { | |
// height = 426 | |
// } else { | |
// height = 203 | |
// } | |
// | |
// case let .feedIdeaSectionItem(item): | |
// if item.idea?.media.first != nil { | |
// height = 426 | |
// } else { | |
// height = 146 | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment