From d8c9ca2e64e017753430b4d9752b5ff51a4799fa Mon Sep 17 00:00:00 2001 From: Neil Pankey Date: Tue, 15 Dec 2015 20:09:28 -0800 Subject: [PATCH] Doc comments for property extensions --- Source/Property.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Source/Property.swift b/Source/Property.swift index 1ff3b2e..5c2e21a 100644 --- a/Source/Property.swift +++ b/Source/Property.swift @@ -9,27 +9,33 @@ import ReactiveCocoa extension PropertyType where Value == Bool { + /// The conjunction of `self` and `other`. public func and(other: P) -> AndProperty { return AndProperty(terms: [AnyProperty(self), AnyProperty(other)]) } + /// The conjunction of `self` and `other`. public func and(other: AnyProperty) -> AndProperty { return AndProperty(terms: [AnyProperty(self), other]) } + /// The disjunction of `self` and `other`. public func or(other: P) -> OrProperty { return OrProperty(terms: [AnyProperty(self), AnyProperty(other)]) } + /// The disjunction of `self` and `other`. public func or(other: AnyProperty) -> OrProperty { return OrProperty(terms: [AnyProperty(self), other]) } + /// A negated property of `self`. public func not() -> NotProperty { return NotProperty(source: AnyProperty(self), invert: true) } } +/// Specialized `PropertyType` for the conjuction of a set of boolean properties. public struct AndProperty: PropertyType { public let terms: [AnyProperty] @@ -44,10 +50,12 @@ public struct AndProperty: PropertyType { } } + /// Creates a new property with an additional conjunctive term. public func and

(other: P) -> AndProperty { return AndProperty(terms: terms + [AnyProperty(other)]) } + /// Creates a new property with an additional conjunctive term. public func and(other: AnyProperty) -> AndProperty { return AndProperty(terms: terms + [other]) } @@ -57,6 +65,7 @@ public struct AndProperty: PropertyType { } } +/// Specialized `PropertyType` for the disjunction of a set of boolean properties. public struct OrProperty: PropertyType { public let terms: [AnyProperty] @@ -71,10 +80,12 @@ public struct OrProperty: PropertyType { } } + /// Creates a new property with an additional disjunctive term. public func or

(other: P) -> OrProperty { return OrProperty(terms: terms + [AnyProperty(other)]) } + /// Creates a new property with an additional disjunctive term. public func or(other: AnyProperty) -> OrProperty { return OrProperty(terms: terms + [other]) } @@ -84,6 +95,7 @@ public struct OrProperty: PropertyType { } } +/// Specialized `PropertyType` for the negation of a boolean property. public struct NotProperty: PropertyType { private let source: AnyProperty private let invert: Bool @@ -96,6 +108,7 @@ public struct NotProperty: PropertyType { return source.producer.map { $0 != self.invert } } + /// A negated property of `self`. public func not() -> NotProperty { return NotProperty(source: source, invert: !invert) }