here is my code for layout… here horizontal collection view is placing indexpath like one below another
1 3 5
2 4 6
but i need
1 2 3
4 5 6
public function broadcastOn()
{
try {
Log::info("broadcastOn");
return new Channel('restaurant.' . $this->data['id'] . '.' . $this->data['restaurant_uid']);
} catch (Exception $e) {
Log::error("Exception occurred in broadcastOn: " . $e->getMessage());
// You can return an empty array or null here, or handle the exception as needed.
return [];
}
}
if collectionView == buyxGetyCollectionView {
let fullHeight = collectionView.frame.height
let fullWidth = collectionView.frame.width
var width = 50.0
var height = 50.0
if buyxGetyArray.count == 2 {
width = (fullWidth / 2) - 7
height = (fullHeight) - 5
} else if buyxGetyArray.count == 3 {
width = (fullWidth / 3) - 7
height = fullHeight - 5
} else if buyxGetyArray.count == 4 {
width = (fullWidth / 2) - 7
height = (fullHeight / 2) - 7
} else if buyxGetyArray.count == 5 || buyxGetyArray.count == 6 {
width = (fullWidth / 3) - 7
height = (fullHeight / 2) - 7
} else if buyxGetyArray.count == 7 || buyxGetyArray.count == 8 {
width = (fullWidth / 4) - 8
height = (fullHeight / 2) - 7
} else {
width = (fullWidth / 4) - 12
height = (fullHeight / 2) - 7
}
return CGSize(width: width, height: height)
}
but i want as below image
if it is possible please tell the solution. if not possible please tell the alternate solution.