Skip to content

Commit

Permalink
Remove annoying flatMap
Browse files Browse the repository at this point in the history
  • Loading branch information
SD10 committed Apr 11, 2018
1 parent 5f647bc commit c52d6e4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/Models/NSConstraintLayoutSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ public class NSLayoutConstraintSet {

/// All of the currently configured constraints
private var availableConstraints: [NSLayoutConstraint] {
return [top, bottom, left, right, centerX, centerY, width, height]
.flatMap {$0}
let constraints = [top, bottom, left, right, centerX, centerY, width, height]
var available: [NSLayoutConstraint] = []
for constraint in constraints {
if let value = constraint {
available.append(value)
}
}
return available
}

/// Activates all of the non-nil constraints
Expand Down

0 comments on commit c52d6e4

Please sign in to comment.