Skip to content

Commit

Permalink
Simplify by optional-chaining instead of guarding
Browse files Browse the repository at this point in the history
  • Loading branch information
sberrevoets committed Feb 27, 2017
1 parent b7ef60e commit 2bd4d8f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Source/Views/AlertView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,12 @@ class AlertView: AlertControllerView {
}

private func updateCollectionViewScrollDirection() {
guard let layout = self.actionsCollectionView.collectionViewLayout as? UICollectionViewFlowLayout else
{
return
}
let layout = self.actionsCollectionView.collectionViewLayout as? UICollectionViewFlowLayout

if self.actionLayout == .horizontal || (self.actions.count == 2 && self.actionLayout == .automatic) {
layout.scrollDirection = .horizontal
layout?.scrollDirection = .horizontal
} else {
layout.scrollDirection = .vertical
layout?.scrollDirection = .vertical
}
}

Expand Down

0 comments on commit 2bd4d8f

Please sign in to comment.