Skip to content
This repository has been archived by the owner on Jun 26, 2019. It is now read-only.

Commit

Permalink
Nullifying constraint nullifies state
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Mergulhão committed Jan 18, 2018
1 parent 68fa99d commit 51c28bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Ambience.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'Ambience'
s.version = '0.1.0'
s.version = '0.1.1'
s.summary = 'An ambient light accessibility framework for iOS.'

# This description is used to generate tags and improve search results.
Expand Down
14 changes: 7 additions & 7 deletions Ambience/Classes/AmbienceConstraint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public func <(lhs: AmbienceConstraint, rhs: AmbienceConstraint) -> Bool {
public typealias AmbienceConstraints = Set<AmbienceConstraint>

public enum AmbienceConstraint : Hashable, Comparable, CustomStringConvertible {
case invert(upper : Brightness)
case regular(lower : Brightness, upper : Brightness)
case contrast(lower : Brightness)
case invert(upper : Brightness?)
case regular(lower : Brightness?, upper : Brightness?)
case contrast(lower : Brightness?)

public var description : String {
switch self {
case .invert(let upper): return "Invert<\(upper)>"
case .regular(let lower, let upper): return "Invert<\(lower), \(upper)>"
case .regular(let lower, let upper): return "Regular<\(lower), \(upper)>"
case .contrast(let lower): return "Contrast<\(lower)>"
}
}
Expand All @@ -45,11 +45,11 @@ public enum AmbienceConstraint : Hashable, Comparable, CustomStringConvertible {
internal var rangeFunctor : ((Brightness) -> Bool) {
switch self {
case .invert(let upper):
return { $0 <= upper }
return upper != nil ? ({ $0 <= upper! }) : ({ _ in false })
case .regular(let lower, let upper):
return { $0 <= upper && $0 >= lower }
return upper != nil && lower != nil ? ({ $0 <= upper! && $0 >= lower! }) : ({ _ in false })
case .contrast(let lower):
return { $0 >= lower }
return lower != nil ? ({ $0 >= lower! }) : ({ _ in false })
}
}
}
2 changes: 1 addition & 1 deletion Example/Pods/Target Support Files/Ambience/Info.plist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 51c28bc

Please sign in to comment.