Skip to content

Repository files navigation

BinaryChoice

XcodeSwiftGitHub tag (latest SemVer)GitHub

IMPORTANT

2024.04.02: This project has been deprecated.

What

BinaryChoice is a Swift Package Manager package for iOS/tvOS (10.0 and above), watchOS (4.0 and above), and macOS (10.14 and above), under Swift 5.0 and above, defining protocols for types that can be initialised from a boolean value and/or can be represented by a boolean value:

/// A protocol to represent types that have a boolean representation.
///
publicprotocolBooleanConvertible{varbooleanDescription:Bool{get}}
/// A protocol to represent types that can be initialized from a boolean value.
///
publicprotocolInitializableByBoolean{init(_ value:Bool)}
/// A protocol to represent types having only two values, which can then be
/// mapped to *true* and *false* in a one-to-one fashion, in both directions.
///
publicprotocolBinaryChoice:InitializableByBoolean,BooleanConvertible{}
/// The Bool type has a natural conformance to *BinaryChoice*.
///
extensionBool:BinaryChoice{
/// Returns *self*.
publicvarbooleanDescription:Bool{self}}

Installation

BinaryChoice is provided only as a Swift Package Manager package, because I'm moving away from CocoaPods and Carthage, and can be easily installed directly from Xcode.

Author

Wagner Truppel, trupwl@gmail.com

License

BinaryChoice is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages