Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (26 sloc) 591 Bytes
//
// BoolExtensions.swift
// SwifterSwift
//
// Created by Omar Albeik on 07/12/2016.
// Copyright © 2016 SwifterSwift
//
// MARK: - Properties
public extension Bool {
/// SwifterSwift: Return 1 if true, or 0 if false.
///
/// false.int -> 0
/// true.int -> 1
///
var int: Int {
return self ? 1 : 0
}
/// SwifterSwift: Return "true" if true, or "false" if false.
///
/// false.string -> "false"
/// true.string -> "true"
///
var string: String {
return self ? "true" : "false"
}
}
You can’t perform that action at this time.