You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I try to use the example app with Swift3 and i face the crash issue in
func shortestColumnIndexInSection (_ section: NSInteger) -> NSInteger {
var index = 0
var shorestHeight = MAXFLOAT
(self.columnHeights[section] as AnyObject).enumerateObjects { (obj: Any, idx: NSInteger, pointer: UnsafeMutablePointer<ObjCBool>) in
let height = obj as! Float
if (height<shorestHeight){
shorestHeight = height
index = idx
}
}
return index
}
App getting crash in this line. let height = obj as! Float
When i try to check for that nil in the above function,(i.e) let height = obj as? Float if (height != nil && height<shorestHeight){ shorestHeight = height! index = idx }
My collectionview layout is in single coloum (i.e instead of two column it comes in single column)
Crash
The text was updated successfully, but these errors were encountered:
Not knowing what the issue is, plus I haven't used the module yet the code from above could be swiftified to (almost never ever use force-cast or IUO's):
// This is far more safe than the original code
if let height = obj as?Float, height < shortestHeight {
shortestHeight = height
index = idx
}
Btw. fix the typo in shorestHeight to shortestHeight.
Hi I try to use the example app with Swift3 and i face the crash issue in
App getting crash in this line.
let height = obj as! Float
When i try to check for that nil in the above function,(i.e)
let height = obj as? Float if (height != nil && height<shorestHeight){ shorestHeight = height! index = idx }
My collectionview layout is in single coloum (i.e instead of two column it comes in single column)
Crash
The text was updated successfully, but these errors were encountered: